195253 Commits

Author SHA1 Message Date
Sebastian Huber
36ecfe1c1c RTEMS: Add -mvrsave multilibs
gcc/ChangeLog:

	* config/rs6000/rtems.h (CPP_OS_DEFAULT_SPEC): Define __PPC_VRSAVE__ if
	-mvrsave is present.
	* config/rs6000/t-rtems: Add -mvrsave multilib variants for
	-mcpu=e6500.
2022-09-08 07:28:37 +02:00
GCC Administrator
fe2a8ce93c Daily bump. 2022-09-08 00:18:33 +00:00
Jonathan Wakely
d7f282c424 libstdc++: Add missing runtime exception to licence notice
This file is missing the GCC Runtime Library Exception text in the
licence header. That is unintentional, and it should have been present.

libstdc++-v3/ChangeLog:

	* include/std/barrier: Add missing runtime exception.
2022-09-07 20:25:00 +01:00
Martin Liska
b8cd1630d0 Restore detection of HAVE_XCOFF_DWARF_EXTRAS
gcc/ChangeLog:

	* configure.ac: Restore detection of  HAVE_XCOFF_DWARF_EXTRAS.
	* config/rs6000/rs6000.cc (HAVE_XCOFF_DWARF_EXTRAS): Reset it.
	* configure: Regenerate.
	* config.in: Regenerate.
2022-09-07 19:41:53 +02:00
Jason Merrill
b9cb441c98 c++: diagnostic for template placeholder in parm [PR106793]
Talking about the declarator form doesn't help when fixing that would get
you a different error about placeholders not being valid in a parameter.

This also adds a <> fixit, which isn't enough for most templates, but is a
start.

	PR c++/106793

gcc/cp/ChangeLog:

	* decl.cc (grokdeclarator): Improve placeholder diagnostics.
	* parser.cc (cp_parser_type_id_1): Add fixit.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp23/auto-array2.C: Adjust.
	* g++.dg/cpp1z/class-deduction113.C: New test.
2022-09-07 13:37:10 -04:00
Jeff Law
756ccf97cf Update my email address
/
	* MAINTAINERS: Update my email address.
2022-09-07 12:34:16 -04:00
Surya Kumari Jangala
bec35caafa sched1: Fix -fcompare-debug issue in schedule_region [PR105586]
In schedule_region(), a basic block that does not contain any real insns
is not scheduled and the dfa state at the entry of the bb is not copied
to the fallthru basic block. However a DEBUG insn is treated as a real
insn, and if a bb contains non-real insns and a DEBUG insn, it's dfa
state is copied to the fallthru bb. This was resulting in
-fcompare-debug failure as the incoming dfa state of the fallthru block
is different with -g. We should always copy the dfa state of a bb to
it's fallthru bb even if the bb does not contain real insns.

2022-08-22  Surya Kumari Jangala  <jskumari@linux.ibm.com>

gcc/
	PR rtl-optimization/105586
	* sched-rgn.cc (save_state_for_fallthru_edge): New function.
	(schedule_region): Use it for all blocks.

gcc/testsuite/
	PR rtl-optimization/105586
	* gcc.target/powerpc/pr105586.c: New test.
2022-09-07 10:22:35 -05:00
Arsen Arsenović
a961ad1b13 c++: top level bind when rewriting coroutines [PR106188]
In the edge case of a coroutine not containing any locals, the ifcd/switch
temporaries would get added to the coroutine frame, corrupting its
layout. To prevent this, we can make sure there is always a BIND_EXPR at
the top of the function body, and thus, always a place for our new
temporaries to go without interfering with the coroutine frame.

PR c++/106188 - Incorrect frame layout after transforming conditional statement without top-level bind expression
PR c++/106713 - if (co_await ...) crashes with a jump to ud2

	PR c++/106188
	PR c++/106713

gcc/cp/ChangeLog:

	* coroutines.cc (coro_rewrite_function_body): Ensure we have a
	BIND_EXPR wrapping the function body.

gcc/testsuite/ChangeLog:

	* g++.dg/coroutines/pr106188.C: New test.

Signed-off-by: Arsen Arsenović <arsen@aarsen.me>
2022-09-07 10:47:49 -04:00
Patrick Palka
cdcc27c1ca libstdc++: Optimize is_reference
Instead of defining is_reference in terms of is_[lr]value_reference,
just define it directly.

libstdc++-v3/ChangeLog:

	* include/std/type_traits (is_reference): Make the primary
	template derive from false_type.  Define two partial
	specializations that derive from true_type.
2022-09-07 10:21:51 -04:00
Patrick Palka
66af6e991b libstdc++: Optimize is_void and is_null_pointer
Instead of defining these in terms of a helper class template
and the relatively expensive __remove_cv_t, just declare four
explicit specializations of the main template, one for each choice
of cv-quals.

libstdc++-v3/ChangeLog:

	* include/std/type_traits (__is_void_helper): Remove.
	(is_void): Make the primary template derive from false_type,
	and define four explicit specializations that derive from
	true_type.
	(__is_null_pointer_helper, is_null_pointer): Likewise.
2022-09-07 10:21:45 -04:00
Jason Merrill
873d395c29 libstdc++: small dynamic_cast optimization
This change speeds up the simple benchmark below by about 40%.

struct A { virtual ~A() {} };
struct B: A { } b;
A* ap = &b;
void *sink;
int main()
{
  for (long i = 0; i < 4000000000L; ++i)
    sink = dynamic_cast<B*>(ap);
}

libstdc++-v3/ChangeLog:

	* libsupc++/dyncast.cc (__dynamic_cast): Avoid virtual function
	call in simple success case.
2022-09-07 10:11:54 -04:00
Joseph Myers
0a91bdaf17 c: New C2x keywords
C2x follows C++ in making alignas, alignof, bool, false,
static_assert, thread_local and true keywords; implement this
accordingly.  This implementation makes them normal keywords in C2x
mode just like any other keyword (C2x leaves open the possibility of
implementation using predefined macros instead - thus, there aren't
any testcases asserting that they aren't macros).  As in C++ and
previous versions of C, true and false are handled like signed 1 and 0
in #if (there was an intermediate state in some C2x drafts where they
had different macro expansions that were unsigned in #if).

Bootstrapped with no regressions for x86_64-pc-linux-gnu.

As with the removal of unprototyped functions, this change has a high
risk of breaking some old code and people doing GNU/Linux distribution
builds may wish to see how much is broken in a build with a -std=gnu2x
default.

gcc/
	* ginclude/stdalign.h [defined __STDC_VERSION__ &&
	__STDC_VERSION__ > 201710L]: Disable all content.
	* ginclude/stdbool.h [defined __STDC_VERSION__ && __STDC_VERSION__
	> 201710L] (bool, true, false): Do not define.

gcc/c-family/
	* c-common.cc (c_common_reswords): Use D_C2X instead of D_CXXONLY
	for alignas, alignof, bool, false, static_assert, thread_local and
	true.

gcc/c/
	* c-parser.cc (c_parser_static_assert_declaration_no_semi)
	(c_parser_alignas_specifier, c_parser_alignof_expression): Allow
	for C2x spellings of keywords.
	(c_parser_postfix_expression): Handle RID_TRUE and RID_FALSE.

gcc/testsuite/
	* gcc.dg/c11-keywords-1.c, gcc.dg/c2x-align-1.c,
	gcc.dg/c2x-align-6.c, gcc.dg/c2x-bool-2.c,
	gcc.dg/c2x-static-assert-3.c, gcc.dg/c2x-static-assert-4.c,
	gcc.dg/c2x-thread-local-1.c: New tests.
	* gcc.dg/c2x-bool-1.c: Update expectations.

libcpp/
	* include/cpplib.h (struct cpp_options): Add true_false.
	* expr.cc (eval_token): Check true_false not cplusplus to
	determine whether to handle true and false keywords.
	* init.cc (struct lang_flags): Add true_false.
	(lang_defaults): Update.
	(cpp_set_lang): Set true_false.
2022-09-07 13:56:46 +00:00
Martin Liska
7abcdb06e3 Restore XCOFF for DWARF on AIX.
PR bootstrap/106855

gcc/ChangeLog:

	* collect2.cc (scan_prog_file): Restore if XCOFF_DEBUGGING_INFO.
	* config/rs6000/rs6000.cc (rs6000_option_override_internal):
	  Restore usage of XCOFF_DEBUGGING_INFO.
	* config/rs6000/xcoff.h (XCOFF_DEBUGGING_INFO): Restore.
	* dwarf2asm.cc (XCOFF_DEBUGGING_INFO): Restore support for
	  XCOFF_DEBUGGING_INFO.
	(dw2_asm_output_nstring): Likewise.
	(USE_LINKONCE_INDIRECT): Likewise.
	* dwarf2out.cc (XCOFF_DEBUGGING_INFO): Likewise.
	(HAVE_XCOFF_DWARF_EXTRAS): Likewise.
	(output_fde): Likewise.
	(output_call_frame_info): Likewise.
	(have_macinfo): Likewise.
	(add_AT_loc_list): Likewise.
	(add_AT_view_list): Likewise.
	(output_compilation_unit_header): Likewise.
	(output_pubnames): Likewise.
	(output_aranges): Likewise.
	(output_line_info): Likewise.
	(output_macinfo): Likewise.
	(dwarf2out_finish): Likewise.
	(dwarf2out_early_finish): Likewise.
2022-09-07 14:18:04 +02:00
Richard Biener
a262f969d6 tree-optimization/106866 - avoid dead abnormal edges from DCE
When DCE clears cfun->calls_setjmp then suddenly we don't need
any abnormal call edges anymore.  The following makes sure to
prune them which otherwise can confuse other passes.

	PR tree-optimization/106866
	* tree-ssa-dce.cc (eliminate_unnecessary_stmts): When
	we changed cfun->calls_setjmp make sure to purge all
	abnormal call edges.

	* gcc.dg/uninit-pr106866.c: New testcase.
2022-09-07 13:51:19 +02:00
Tom de Vries
04bb15e48e [gdb/build] Fix build breaker with --enable-shared
When building gdb with --enable-shared, I run into:
...
ld: build/zlib/libz.a(libz_a-inffast.o): relocation R_X86_64_32S against \
  `.rodata' can not be used when making a shared object; recompile with -fPIC
ld: build/zlib/libz.a(libz_a-inflate.o): warning: relocation against \
  `inflateResetKeep' in read-only section `.text'
collect2: error: ld returned 1 exit status
make[3]: *** [libbfd.la] Error 1
...

This is a regression since commit a08bdb159bb ("[gdb/build] Fix gdbserver
build with -fsanitize=thread").

The problem is that a single case statement in configure is shared to handle
special requirements for both the host libiberty and host zlib, which has the
effect that only one is handled.

Fix this by handling libiberty and zlib each in its own case statement.

Build on x86_64-linux, with and without --enable-shared.

ChangeLog:

2022-09-07  Tom de Vries  <tdevries@suse.de>

	* configure.ac: Set extra_host_libiberty_configure_flags and
	extra_host_zlib_configure_flags in separate case statements.
	* configure: Regenerate.
2022-09-07 13:19:05 +02:00
Aldy Hernandez
22cefe5c22 [PR106867] Add test for PR.
PR tree-optimization/106867

gcc/testsuite/ChangeLog:

	* gcc.dg/tree-ssa/pr106867.c: New test.
2022-09-07 13:04:15 +02:00
Xianmiao Qu
eae270beb7 C-SKY: Fix expanding of float LE comparing with zero for fpuv3.
The original code will cause the warning:
/usr/lib/gcc-snapshot/bin/g++  -fno-PIE -c   -g -O2   -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE   -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror -fno-common  -DHAVE_CONFIG_H -I. -I. -I../../gcc/gcc -I../../gcc/gcc/. -I../../gcc/gcc/../include -I../../gcc/gcc/../libcpp/include -I../../gcc/gcc/../libcody  -I../../gcc/gcc/../libdecnumber -I../../gcc/gcc/../libdecnumber/dpd -I../libdecnumber -I../../gcc/gcc/../libbacktrace   -o csky.o -MT csky.o -MMD -MP -MF ./.deps/csky.TPo ../../gcc/gcc/config/csky/csky.cc
In file included from ../../gcc/gcc/config/csky/csky.h:183,
                from ./tm.h:20,
                from ../../gcc/gcc/backend.h:28,
                from ../../gcc/gcc/config/csky/csky.cc:27:
../../gcc/gcc/config/csky/csky.cc: In function 'bool csky_emit_compare_float(rtx_code, rtx, rtx)':
../../gcc/gcc/config/csky/csky_isa.h:29:37: error: enum constant in boolean context [-Werror=int-in-bool-context]
  29 | #define CSKY_ISA_FEATURE_DEFINE(x)  isa_bit_ ## x
      |                                     ^~~~~~~~
../../gcc/gcc/config/csky/csky_isa.h:30:37: note: in expansion of macro 'CSKY_ISA_FEATURE_DEFINE'
  30 | #define CSKY_ISA_FEATURE_GET(x)     CSKY_ISA_FEATURE_DEFINE (x)
      |                                     ^~~~~~~~~~~~~~~~~~~~~~~
../../gcc/gcc/config/csky/csky.cc:6346:43: note: in expansion of macro 'CSKY_ISA_FEATURE_GET'
6346 |                                        || CSKY_ISA_FEATURE_GET(fpv2_df)
      |                                           ^~~~~~~~~~~~~~~~~~~~
../../gcc/gcc/config/csky/csky_isa.h:29:37: error: enum constant in boolean context [-Werror=int-in-bool-context]
  29 | #define CSKY_ISA_FEATURE_DEFINE(x)  isa_bit_ ## x
      |                                     ^~~~~~~~
../../gcc/gcc/config/csky/csky_isa.h:30:37: note: in expansion of macro 'CSKY_ISA_FEATURE_DEFINE'
  30 | #define CSKY_ISA_FEATURE_GET(x)     CSKY_ISA_FEATURE_DEFINE (x)
      |                                     ^~~~~~~~~~~~~~~~~~~~~~~
../../gcc/gcc/config/csky/csky.cc:6346:43: note: in expansion of macro 'CSKY_ISA_FEATURE_GET'
6346 |                                        || CSKY_ISA_FEATURE_GET(fpv2_df)
      |                                           ^~~~~~~~~~~~~~~~~~~~
../../gcc/gcc/config/csky/csky_isa.h:29:37: error: enum constant in boolean context [-Werror=int-in-bool-context]
  29 | #define CSKY_ISA_FEATURE_DEFINE(x)  isa_bit_ ## x
      |                                     ^~~~~~~~
../../gcc/gcc/config/csky/csky_isa.h:30:37: note: in expansion of macro 'CSKY_ISA_FEATURE_DEFINE'
  30 | #define CSKY_ISA_FEATURE_GET(x)     CSKY_ISA_FEATURE_DEFINE (x)
      |                                     ^~~~~~~~~~~~~~~~~~~~~~~
../../gcc/gcc/config/csky/csky.cc:6347:43: note: in expansion of macro 'CSKY_ISA_FEATURE_GET'
6347 |                                        || CSKY_ISA_FEATURE_GET(fpv2_divd)))
      |                                           ^~~~~~~~~~~~~~~~~~~~

The 'CSKY_ISA_FEATURE_DEFINE (x)' is an enum contant, it will cause the condition always being true.
In addition to warning, it will let FPUV3 to generate a move instruction, which is unnecessary.
In a simple test case, the move instruction can be combined, so it was not found in the testsuite.
But in some complex scenarios, this may generate some redundant instructions.
The correct way is to use 'CSKY_ISA_FEATURE' instead of 'CSKY_ISA_FEATURE_DEFINE'.

gcc/
	* config/csky/csky.cc (csky_emit_compare_float): Fix the expanding of
	float LE comparing with zero for fpuv3.
	* config/csky/csky.h (TARGET_SUPPORT_FPV2): New, true if any fpuv2
	features are enabled.
2022-09-07 19:03:10 +08:00
Richard Biener
0386609923 tree-optimization/106860 - fix profile scaling in split_loop
The following fixes a mistake in loop splitting which assumes loop
latches have a single predecessor and that edge is from the exit
test.  Instead work from the single exit edge we have to find the
edge towards the latch.

	PR tree-optimization/106860
	* tree-ssa-loop-split.cc (split_loop): Find the exit to
	latch edge from the loop exit edge instead of from the
	latch.  Verify we're going to find it.

	* g++.dg/opt/pr106860.C: New testcase.
2022-09-07 12:08:59 +02:00
Richard Biener
d14514641d mark region also for USE predicate discovery
The following makes sure to mark the dominating region also for
USE predicate discovery, avoiding compute_control_dep_chain to
walk to unrelated areas, eating up walking budget.

	* gimple-predicate-analysis.cc (dfs_mark_dominating_region):
	Adjust to take the region exit source as argument.
	(uninit_analysis::init_from_phi_def): Adjust.
	(uninit_analysis::init_use_preds): Mark the dominating region
	before computing control dependences.
2022-09-07 12:07:52 +02:00
Richard Sandiford
d610613290 aarch64: Fix +nosimd handling of FPR moves
8-bit and 16-bit FPR moves would ICE for +nosimd+fp, and some other
moves would handle FPR<-zero inefficiently.  This is very much a
niche case at the moment, but something like it becomes more
important with SME streaming mode.

The si, di and vector tests already passed, they're just included for
completeness.

We're a bit inconsistent about whether alternatives involving FPRs
are marked with arch==fp or arch=* (i.e. default).  E.g. FPR loads
and stores are sometimes * and sometimes fp.

IMO * makes more sense.  FPRs should not be used at all without
TARGET_FLOAT, so TARGET_FLOAT represents the base architecture
when FPRs are enabled.  I think it's more useful if non-default
arches represent a genuine restriction.

gcc/
	* config/aarch64/aarch64.md (*mov<SHORT:mode>_aarch64): Extend
	w<-w, r<-w and w<-r alternatives to !simd, using 32-bit moves
	in that case.  Extend w<-r to w<-Z.
	(*mov<HFBF:mode>_aarch64): Likewise, but with Y instead of Z.
	(*movti_aarch64): Use an FMOV from XZR for w<-Z if MOVI is not
	available.
	(define_split): Do not apply the floating-point immediate-to-register
	split to zeros, even if MOVI is not available.

gcc/testsuite/
	* gcc.target/aarch64/movqi_1.c: New test.
	* gcc.target/aarch64/movhi_1.c: Likewise.
	* gcc.target/aarch64/movsi_1.c: Likewise.
	* gcc.target/aarch64/movdi_2.c: Likewise.
	* gcc.target/aarch64/movti_2.c: Likewise.
	* gcc.target/aarch64/movhf_1.c: Likewise.
	* gcc.target/aarch64/movsf_1.c: Likewise.
	* gcc.target/aarch64/movdf_1.c: Likewise.
	* gcc.target/aarch64/movtf_2.c: Likewise.
	* gcc.target/aarch64/movv8qi_1.c: Likewise.
	* gcc.target/aarch64/movv16qi_1.c: Likewise.
2022-09-07 10:52:04 +01:00
Richard Sandiford
f58d5545d6 aarch64: Prevent FPR register asms for +nofp
+nofp disabled the automatic allocation of FPRs, but it didn't stop
users from explicitly putting register variables in FPRs.  We'd then
either report an ICE or generate unsupported instructions.

It's still possible (and deliberately redundant) to specify FPRs in
clobber lists.

gcc/
	* config/aarch64/aarch64.cc (aarch64_conditional_register_usage):
	Disallow use of FPRs in register asms for !TARGET_FLOAT.

gcc/testsuite/
	* gcc.target/aarch64/nofp_2.c: New test.
2022-09-07 10:52:03 +01:00
Lulu Cheng
0067ba052b LoongArch: Fix pr106828 by define hook TARGET_ASAN_SHADOW_OFFSET in loongarch backend [PR106828].
gcc/ChangeLog:

	PR target/106828
	* config/loongarch/loongarch.cc (loongarch_asan_shadow_offset): New.
	(TARGET_ASAN_SHADOW_OFFSET): New.

gcc/testsuite/ChangeLog:

	PR target/106828
	* g++.target/loongarch/pr106828.C: New test.
2022-09-07 16:53:10 +08:00
Jakub Jelinek
e90af965e5 openmp: Fix handling of target constructs in static member functions [PR106829]
Just calling current_nonlambda_class_type in static member functions returns
non-NULL, but something that isn't *this and if unlucky can match part of the
IL and can be added to target clauses.
      if (DECL_NONSTATIC_MEMBER_P (decl)
          && current_class_ptr)
is a guard used elsewhere (in check_accessibility_of_qualified_id).

2022-09-07  Jakub Jelinek  <jakub@redhat.com>

	PR c++/106829
	* semantics.cc (finish_omp_target_clauses): If current_function_decl
	isn't a nonstatic member function, don't set data.current_object to
	non-NULL.

	* g++.dg/gomp/pr106829.C: New test.
2022-09-07 08:54:13 +02:00
Jakub Jelinek
572f5e1bc6 libcpp: Named universal character escapes and delimited escape sequence tweaks
On Tue, Aug 30, 2022 at 09:10:37PM +0000, Joseph Myers wrote:
> I'm seeing build failures of glibc for powerpc64, as illustrated by the
> following C code:
>
> #if 0
> \NARG
> #endif
>
> (the actual sysdeps/powerpc/powerpc64/sysdep.h code is inside #ifdef
> __ASSEMBLER__).
>
> This shows some problems with this feature - and with delimited escape
> sequences - as it affects C.  It's fine to accept it as an extension
> inside string and character literals, because \N or \u{...} would be
> invalid in the absence of the feature (i.e. the syntax for such literals
> fails to match, meaning that the rule about undefined behavior for a
> single ' or " as a pp-token applies).  But outside string and character
> literals, the usual lexing rules apply, the \ is a pp-token on its own and
> the code is valid at the preprocessing level, and with expansion of macros
> appearing before or after the \ (e.g. u defined as a macro in the \u{...}
> case) it may be valid code at the language level as well.  I don't know
> what older C++ versions say about this, but for C this means e.g.
>
> #define z(x) 0
> #define a z(
> int x = a\NARG);
>
> needs to be accepted as expanding to "int x = 0;", not interpreted as
> using the \N feature in an identifier and produce an error.

The following patch changes this, so that:
1) outside of string/character literals, \N without following { is never
   treated as an error nor warning, it is silently treated as \ separate
   token followed by whatever is after it
2) \u{123} and \N{LATIN SMALL LETTER A WITH ACUTE} are not handled as
   extension at all outside of string/character literals in the strict
   standard modes (-std=c*) except for -std=c++{23,2b}, only in the
   -std=gnu* modes, because it changes behavior on valid sources, e.g.
   #define z(x) 0
   #define a z(
   int x = a\u{123});
   int y = a\N{LATIN SMALL LETTER A WITH ACUTE});
3) introduces -Wunicode warning (on by default) and warns for cases
   of what looks like invalid delimited escape sequence or named
   universal character escape outside of string/character literals
   and is treated as separate tokens

2022-09-07  Jakub Jelinek  <jakub@redhat.com>

libcpp/
	* include/cpplib.h (struct cpp_options): Add cpp_warn_unicode member.
	(enum cpp_warning_reason): Add CPP_W_UNICODE.
	* init.cc (cpp_create_reader): Initialize cpp_warn_unicode.
	* charset.cc (_cpp_valid_ucn): In possible identifier contexts, don't
	handle \u{ or \N{ specially in -std=c* modes except -std=c++2{3,b}.
	In possible identifier contexts, don't emit an error and punt
	if \N isn't followed by {, or if \N{} surrounds some lower case
	letters or _.  In possible identifier contexts when not C++23, don't
	emit an error but warning about unknown character names and treat as
	separate tokens.  When treating as separate tokens \u{ or \N{, emit
	warnings.
gcc/
	* doc/invoke.texi (-Wno-unicode): Document.
gcc/c-family/
	* c.opt (Winvalid-utf8): Use ObjC instead of objC.  Remove
	" in comments" from description.
	(Wunicode): New option.
gcc/testsuite/
	* c-c++-common/cpp/delimited-escape-seq-4.c: New test.
	* c-c++-common/cpp/delimited-escape-seq-5.c: New test.
	* c-c++-common/cpp/delimited-escape-seq-6.c: New test.
	* c-c++-common/cpp/delimited-escape-seq-7.c: New test.
	* c-c++-common/cpp/named-universal-char-escape-5.c: New test.
	* c-c++-common/cpp/named-universal-char-escape-6.c: New test.
	* c-c++-common/cpp/named-universal-char-escape-7.c: New test.
	* g++.dg/cpp23/named-universal-char-escape1.C: New test.
	* g++.dg/cpp23/named-universal-char-escape2.C: New test.
2022-09-07 08:44:38 +02:00
Jiufu Guo
ea6e89e07f rs6000: remove unused splitter on const_scalar_int_operand
There are two splitters, both are calling rs6000_emit_set_const to emit
instructions for constant building.
One splitter checks `const_int_operand`, this splitter is always used.
Another spitter checks `const_scalar_int_operand`, this one is never
used now.

Checking the history, that splitter is introduced around 1999 for
HOST_BITS_PER_WIDE_INT=32, as below:

(define_split
  [(set (match_operand:DI 0 "gpc_reg_operand" "")
	(match_operand:DI 1 "const_double_operand" ""))]
  "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
   && num_insns_constant (operands[1], DImode) > 1"

And `HOST_BITS_PER_WIDE_INT == 32` is eliminated later, since it is
`const_double_operand` can cover it.
When wide_int is introduced, `const_double_operand` is replaced by
`const_scalar_int_operand`.

Now, HOST_BITS_PER_WIDE_INT is forced to 64, this splitter is safe
to remove.

gcc/ChangeLog:

	* config/rs6000/rs6000.md (const_scalar_int splitter): Remove.
2022-09-07 13:35:18 +08:00
Jiufu Guo
34ea461fdb rs6000: fix misleading new patterns of splitters
As a comment in
https://gcc.gnu.org/pipermail/gcc-patches/2022-August/599556.html

Those splitters call rs6000_emit_set_const directly, and the replacements
are never used.  Using (pc) would be less misleading.

gcc/ChangeLog:

	* config/rs6000/rs6000.md: (constant splitters): Use "(pc)" as the
	replacements.
2022-09-07 13:21:56 +08:00
Ian Lance Taylor
c0852b51b7 runtime: ignore __morestack function in runtime.Callers
We were ignoring all functions starting with "__morestack_", but not
the function "__morestack" itself.  Without this change, some tests
such as recover.go started failing recently, though I'm not sure
exactly what changed.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/427935
2022-09-06 18:39:50 -07:00
Kewen Lin
7a43e52a48 rs6000/test: Fix empty TU in some cases of effective targets [PR106345]
As the failure of test case gcc.target/powerpc/pr92398.p9-.c in
PR106345 shows, some test sources for some powerpc effective
targets use empty translation unit wrongly.  The test sources
could go with options like "-ansi -pedantic-errors", then those
effective target checkings will fail unexpectedly with the
error messages like:

  error: ISO C forbids an empty translation unit [-Wpedantic]

This patch is to fix empty TUs with one dummy function definition
accordingly.

	PR testsuite/106345

gcc/testsuite/ChangeLog:

	* lib/target-supports.exp (check_effective_target_powerpc_sqrt): Add
	a function definition to avoid pedwarn about empty translation unit.
	(check_effective_target_has_arch_pwr5): Likewise.
	(check_effective_target_has_arch_pwr6): Likewise.
	(check_effective_target_has_arch_pwr7): Likewise.
	(check_effective_target_has_arch_pwr8): Likewise.
	(check_effective_target_has_arch_pwr9): Likewise.
	(check_effective_target_has_arch_pwr10): Likewise.
	(check_effective_target_has_arch_ppc64): Likewise.
	(check_effective_target_ppc_float128): Likewise.
	(check_effective_target_ppc_float128_insns): Likewise.
	(check_effective_target_powerpc_vsx): Likewise.
2022-09-06 20:37:57 -05:00
liuhongt
c13223b790 Extend vectorizer to handle nonlinear induction for neg, mul/lshift/rshift with a constant.
For neg, the patch create a vec_init as [ a, -a, a, -a, ...  ] and no
vec_step is needed to update vectorized iv since vf is always multiple
of 2(negative * negative is positive).

For shift, the patch create a vec_init as [ a, a >> c, a >> 2*c, ..]
as vec_step as [ c * nunits, c * nunits, c * nunits, ... ], vectorized iv is
updated as vec_def = vec_init >>/<< vec_step.

For mul, the patch create a vec_init as [ a, a * c, a * pow(c, 2), ..]
as vec_step as [ pow(c,nunits), pow(c,nunits),...] iv is updated as vec_def =
vec_init * vec_step.

The patch handles nonlinear iv for
1. Integer type only, floating point is not handled.
2. No slp_node.
3. iv_loop should be same as vector loop, not nested loop.
4. No UD is created, for mul, use unsigned mult to avoid UD, for
   shift, shift count should be less than type precision.

gcc/ChangeLog:

	PR tree-optimization/103144
	* tree-vect-loop.cc (vect_is_nonlinear_iv_evolution): New function.
	(vect_analyze_scalar_cycles_1): Detect nonlinear iv by upper function.
	(vect_create_nonlinear_iv_init): New function.
	(vect_peel_nonlinear_iv_init): Ditto.
	(vect_create_nonlinear_iv_step): Ditto
	(vect_create_nonlinear_iv_vec_step): Ditto
	(vect_update_nonlinear_iv): Ditto
	(vectorizable_nonlinear_induction): Ditto.
	(vectorizable_induction): Call
	vectorizable_nonlinear_induction when induction_type is not
	vect_step_op_add.
	* tree-vect-loop-manip.cc (vect_update_ivs_after_vectorizer):
	Update nonlinear iv for epilogue loop.
	* tree-vectorizer.h (enum vect_induction_op_type): New enum.
	(STMT_VINFO_LOOP_PHI_EVOLUTION_TYPE): New Macro.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/pr103144-mul-1.c: New test.
	* gcc.target/i386/pr103144-mul-2.c: New test.
	* gcc.target/i386/pr103144-neg-1.c: New test.
	* gcc.target/i386/pr103144-neg-2.c: New test.
	* gcc.target/i386/pr103144-shift-1.c: New test.
	* gcc.target/i386/pr103144-shift-2.c: New test.
2022-09-07 08:38:18 +08:00
GCC Administrator
25aeb92221 Daily bump. 2022-09-07 00:17:51 +00:00
Jason Merrill
0a2fba3697 c++: C++23 operator[] allows default arguments
This usage was intended to be allowed by P2128, but it didn't make it into
the final wording.  Fixed by CWG 2507.

	DR2507

gcc/cp/ChangeLog:

	* decl.cc (grok_op_properties): Return sooner for C++23 op[].

gcc/testsuite/ChangeLog:

	* g++.dg/cpp23/subscript8.C: New test.
2022-09-06 16:20:41 -04:00
Richard Biener
0a4a2667dc tree-optimization/106754 - fix compute_control_dep_chain defect
The following handles the situation of a loop exit along the
control path to the PHI def or from there to the use in a different
way, aoviding premature abort of the walks as noticed in the two
cases where the exit is outermost (gcc.dg/uninit-pred-11.c) or
wrapped in a condition that is on the path (gcc.dg/uninit-pred-12.c).
Instead of handling such exits during recursion we now pick them
up in the parent when walking post-dominators.  That requires an
additional post-dominator walk at the outermost level which is
facilitated by splitting out the walk to a helper function and
the existing wrapper added earlier.

The patch also removes the bogus early exit from
uninit_analysis::init_use_preds, fixing a simplified version
of the PR106155 testcase.

	PR tree-optimization/106754
	* gimple-predicate-analysis.cc (compute_control_dep_chain_pdom):
	New function, split out from compute_control_dep_chain.  Handle
	loop-exit like conditions here by pushing to the control vector.
	(compute_control_dep_chain): Adjust and streamline dumping.
	In the wrapper perform a post-dominator walk as well.
	(uninit_analysis::init_use_preds): Remove premature early exit.

	* gcc.dg/uninit-pred-12.c: New testcase.
	* gcc.dg/uninit-pr106155-1.c: Likewise.
2022-09-06 14:55:51 +02:00
Max Filippov
9e0c269672 xtensa: gcc: add static PIE support
gcc/
	* config/xtensa/linux.h (LINK_SPEC): Add static-pie.
2022-09-06 05:13:31 -07:00
Aldy Hernandez
f5dc9da0a9 Handle > INF and < INF correctly in range-op-float.cc
The gfortran.dg/minlocval*.f90 tests are generating conditionals past
the infinities.  For example:

	if (x <= +Inf)
	  foo (x);
	else
	  bar (x);

It seems to me that the only possible value for x on the false side is
either NAN or undefined (for !HONOR_NANS).

gcc/ChangeLog:

	* range-op-float.cc (build_le): Handle NANs and going past infinity.
	(build_lt): Same.
	(build_ge): Same.
	(build_gt): Same.
	(foperator_lt::op1_range): Avoid adjustments to range if build_*
	returned false.
	(foperator_lt::op2_range): Same.
	(foperator_le::op1_range): Same.
	(foperator_le::op2_range): Same.
	(foperator_gt::op1_range): Same.
	(foperator_gt::op2_range): Same.

gcc/testsuite/ChangeLog:

	* gcc.dg/tree-ssa/vrp-float-inf-1.c: New test.
2022-09-06 13:48:05 +02:00
Richard Biener
12f0783111 Fix use predicate computation for uninit analysis
In uninit analysis we try to prove that a use is always properly guarded
so it is never reached when the used value is not initialized.  This
fails to be conservative when during the computation of the use
predicate components of the || .. || .. chain are dropped so we have
to detect this case and fall back to the conservative computation.

	* gimple-predicate-analysis.cc (compute_control_dep_chain):
	Add output flag to indicate whether we possibly have dropped
	any chains.  Return whether the info is complete from the
	wrapping overload.
	(uninit_analysis::init_use_preds): Adjust accordingly, with
	a workaround for PR106754.
	(uninit_analysis::init_from_phi_def): Properly guard the
	case where we complete an empty chain.
2022-09-06 13:41:18 +02:00
Philipp Fent
190c644c06 libstdc++: Fix pretty printer tests of tuple indexes
Signed-off-by: Philipp Fent <fent@in.tum.de>

libstdc++-v3/ChangeLog:

	* testsuite/libstdc++-prettyprinters/48362.cc: Fix expected
	tuple indices.
	* testsuite/libstdc++-prettyprinters/cxx11.cc: Likewise.
2022-09-06 12:12:00 +01:00
Jan-Benedict Glaw
26ea6ca1fc Document unused function argument
This patch fixes a small warning about the unused outer_rtx argument in the
msp430 backend.

2022-09-06  Jan-Benedict Glaw  <jbglaw@lug-owl.de>

gcc/ChangeLog:
	* config/msp430/msp430.cc (msp430_single_op_cost): Document unused argument.
2022-09-06 13:05:21 +02:00
Prathamesh Kulkarni
e55674b86a tree-ssa-forwprop.cc: Adjust res_type when operands have differing vector lengths.
gcc/
	* tree-ssa-forwprop.cc (simplify_permutation): Set res_type to a vector
	type with same element type as arg0, and length as op2.
2022-09-06 15:18:22 +05:30
Richard Biener
1a4e1425f8 tree-optimization/106844 - fix ICE in init_use_preds
The following fixes an oversight in the last change to
compute_control_dep_chain where we have to return whether we found
a chain.

	PR tree-optimization/106844
	* gimple-predicate-analysis.cc (compute_control_dep_chain):
	Return whether we found a chain.

	* gcc.dg/pr106844.c: New testcase.
2022-09-06 10:55:31 +02:00
Richard Biener
e33e61d417 tree-optimization/106841 - gather and hybrid SLP
Hybrid SLP detection currently fails to consider a not direct
offset operand of a scatter/gather operation.  The following fixes
this.

	PR tree-optimization/106841
	* tree-vect-slp.cc (vect_detect_hybrid_slp): Also process
	scatter/gather offset.

	* g++.dg/vect/pr106841.cc: New testcase.
2022-09-06 10:55:31 +02:00
Tobias Burnus
d6582c662c Fix Fortran/openmp: Partial OpenMP 5.2 doacross
This removed a checking snippet which accidentally was left in in commit
r13-2446-g938cda536019cd6a1bc0dd2346381185b420bbf8 ; this caused
fails in gfortran.dg/gomp/doacross-5.f90 (added in that very commit).
Note that a similar but refined check is now done in the middle end.
(The ME version additionally checks whether doacross is present.)

gcc/fortran/
	* openmp.cc (resolve_omp_clauses): Remove ordered/linear
	check as it is handled now in the middle end.
2022-09-06 10:02:13 +02:00
Jakub Jelinek
0bd514107d openmp: Be consistent on parsing offsets between normal sink vector and omp_cur_iteration - 1
For normal sink vectors, we just check that the token is CPP_NUMBER and with
INTEGER_CST value, while for omp_cur_iteration I was additionally requiring
integer_type_node type (so only 1, 001, 0x0001 but not 1L or 1ULL etc.).
I think we need to clarify what we actually should allow in the standard, until
then it is better to be consistent.

2022-09-06  Jakub Jelinek  <jakub@redhat.com>

gcc/c/
	* c-parser.cc (c_parser_omp_clause_doacross_sink): Don't verify val
	in omp_cur_iteration - 1 has integer_type_node type.
gcc/cp/
	* parser.cc (cp_parser_omp_clause_doacross_sink): Don't verify val
	in omp_cur_iteration - 1 has integer_type_node type.
gcc/testsuite/
	* c-c++-common/gomp/doacross-6.c (corge): Don't expect an error here.
	Add a few further tests.
2022-09-06 09:28:06 +02:00
Jakub Jelinek
1bf8b7adc2 openmp: Fix ICE when splitting invalid depend(source)/depend(sink:vec)
As we now create OMP_CLAUSE_DOACROSS rather than OMP_CLAUSE_DEPEND when
depend is used with source/sink modifiers, c_omp_split_clauses can see
OMP_CLAUSE_DOACROSS clause too before we diagnose it as erroneous.

The following patch treats it like OMP_CLAUSE_DEPEND during
the splitting but adds an assertion.

2022-09-06  Jakub Jelinek  <jakub@redhat.com>

	PR c/106836
	* c-omp.cc (c_omp_split_clauses): Handle OMP_CLAUSE_DOACROSS.

	* c-c++-common/gomp/pr106836.c: New test.
2022-09-06 09:23:40 +02:00
Jan-Benedict Glaw
bc1bc808d8 No actual regclasses for bpf
Building for for bpf-unknown-none target, recent GCCs will issue an unused
variable warning as the REGNO_REG_CLASS macro doesn't actually use its
argument. Reference the argument as (void) to silence the warning.

.../gcc/configure --prefix=... --enable-werror-always --enable-languages=all --disable-gcov --disable-shared --disable-threads --target=bpf-unknown-none --without-headers
[...]
make V=1 all-gcc
[...]

/usr/lib/gcc-snapshot/bin/g++  -fno-PIE -c   -g -O2   -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE   -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror -fno-common  -DHAVE_CONFIG_H -I. -I. -I../../gcc/gcc -I../../gcc/gcc/. -I../../gcc/gcc/../include -I../../gcc/gcc/../libcpp/include -I../../gcc/gcc/../libcody  -I../../gcc/gcc/../libdecnumber -I../../gcc/gcc/../libdecnumber/dpd -I../libdecnumber -I../../gcc/gcc/../libbacktrace   -o regcprop.o -MT regcprop.o -MMD -MP -MF ./.deps/regcprop.TPo ../../gcc/gcc/regcprop.cc
../../gcc/gcc/regcprop.cc: In function 'bool copyprop_hardreg_forward_1(basic_block, value_data*)':
../../gcc/gcc/regcprop.cc:794:24: error: unused variable 'regno' [-Werror=unused-variable]
  794 |           unsigned int regno = REGNO (SET_SRC (set));
      |                        ^~~~~
cc1plus: all warnings being treated as errors
make[1]: *** [Makefile:1146: regcprop.o] Error 1
make[1]: Leaving directory '/var/lib/laminar/run/gcc-bpf-unknown-none/1/toolchain-build/gcc'
make: *** [Makefile:4565: all-gcc] Error 2

gcc/
	* config/bpf/bpf.h (REGNO_REG_CLASS): Reference arguments as (void).
2022-09-06 09:20:37 +02:00
Jakub Jelinek
3f585bdaa7 openmp: Introduce gimple_omp_ordered_standalone_p
On Sat, Sep 03, 2022 at 10:07:27AM +0200, Jakub Jelinek via Gcc-patches wrote:
> Incrementally, I'd like to change the way we differentiate between
> stand-alone and block-associated ordered constructs, because the current
> way of looking for presence of doacross clause doesn't work well if those
> clauses are removed because they had been invalid (wrong syntax or
> unknown variables in it etc.)

The following, so far only lightly tested, patch implements that.

2022-09-06  Jakub Jelinek  <jakub@redhat.com>

gcc/
	* gimple.h (enum gf_mask): Add GF_OMP_ORDERED_STANDALONE enumerator.
	(gimple_omp_subcode):  Use GIMPLE_OMP_ORDERED instead of
	GIMPLE_OMP_TEAMS as upper bound.
	(gimple_omp_ordered_standalone_p, gimple_omp_ordered_standalone): New
	inline functions.
	* gimplify.cc (find_standalone_omp_ordered): Look for OMP_ORDERED with
	NULL OMP_ORDERED_BODY rather than with OMP_DOACROSS clause.
	(gimplify_expr): Call gimple_omp_ordered_standalone for OMP_ORDERED
	with NULL OMP_ORDERED_BODY.
	* omp-low.cc (check_omp_nesting_restrictions): Use
	gimple_omp_ordered_standalone_p test instead of
	omp_find_clause (..., OMP_CLAUSE_DOACROSS).
	(lower_omp_ordered): Likewise.
	* omp-expand.cc (expand_omp, build_omp_regions_1,
	omp_make_gimple_edges): Likewise.
gcc/cp/
	* pt.cc (tsubst_expr) <case OMP_ORDERED>: If OMP_BODY was NULL, keep
	it NULL after instantiation too.
gcc/testsuite/
	* c-c++-common/gomp/sink-3.c: Don't expect a superfluous error during
	error recovery.
	* c-c++-common/gomp/doacross-6.c (foo): Add further tests.
2022-09-06 09:19:24 +02:00
Eric Botcazou
fc52efeb9c [Ada] Mark artificial formal parameters in the debug info
gcc/ada/

	* gcc-interface/decl.cc (gnat_to_gnu_param): Set DECL_ARTIFICIAL.
2022-09-06 09:14:24 +02:00
Eric Botcazou
0b66f882f7 [Ada] Fix problematic line debug info attached to call to finalizer
The End_Label is not defined for body nodes so a small tweak is needed.

gcc/ada/

	* gcc-interface/trans.cc (At_End_Proc_to_gnu): Use the End_Label of
	the child Handled_Statement_Sequence for body nodes.
	(set_end_locus_from_node): Minor tweaks.
2022-09-06 09:14:23 +02:00
Eric Botcazou
ef12e74ce7 [Ada] Fix internal error on double renaming of private constant
The first renaming uses the type of the full view of the constant but not
the second, which introduces problematic view conversions downstream.

gcc/ada/

	* gcc-interface/trans.cc (Full_View_Of_Private_Constant): New
	function returning the Full_View of a private constant, after
	looking through a chain of renamings, if any.
	(Identifier_to_gnu): Call it on the entity.  Small cleanup.
2022-09-06 09:14:23 +02:00
Eric Botcazou
e2909e105d [Ada] Fix missing name for access type in generic instantiation
Pointer types aren't named types in C so we need to take extra care in Ada
to make sure that the name of access types is preserved.

gcc/ada/

	* gcc-interface/utils.cc (gnat_pushdecl): Preserve named
	TYPE_DECLs consistently for all kind of pointer types.
2022-09-06 09:14:23 +02:00
Eric Botcazou
a80e058397 [Ada] Extend No_Dependence restriction to code generation (continued)
gcc/ada/

	* gcc-interface/trans.cc (gnat_to_gnu) <N_Op_Divide>: Report a
	violation of No_Dependence on System.GCC if the result type is
	larger than a word.
	<N_Op_Shift>: Likewise.
	<N_Op_Mod>: Likewise.
	<N_Op_Rem>: Likewise.
	(convert_with_check): Report a violation of No_Dependence on
	System.GCC for a conversion between an integer type larger than
	a word and a floating-point type.
2022-09-06 09:14:23 +02:00