Commit Graph

192259 Commits

Author SHA1 Message Date
Jason Merrill
72bdfcb848 c++: missing aggregate base ctor [PR102045]
When make_base_init_ok changes a call to a complete constructor into a call
to a base constructor, we were never marking the base ctor as used, so it
didn't get emitted.

	PR c++/102045

gcc/cp/ChangeLog:

	* call.cc (make_base_init_ok): Call make_used.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp1z/aggr-base12.C: New test.
2022-03-28 09:35:58 -04:00
Jason Merrill
71e1db540c c++: mangling union{1} in template [PR104847]
My implementation of union non-type template arguments in r11-2016 broke
braced casts of union type, because they are still in syntactic (undigested)
form.

	PR c++/104847

gcc/cp/ChangeLog:

	* mangle.cc (write_expression): Don't write a union designator when
	undigested.

gcc/testsuite/ChangeLog:

	* g++.dg/abi/mangle-union1.C: New test.
2022-03-28 09:35:58 -04:00
Jason Merrill
07be8f8da4 c++: ICE with alias in pack expansion [PR103769]
This was breaking because when we stripped the 't' typedef in s<t<Args>...>
to be s<Args...>, the TYPE_MAIN_VARIANT of "Args..." was still
"t<Args>...", because type pack expansions are treated as types.  Fixed by
using the right function to copy a "type".

	PR c++/99445
	PR c++/103769

gcc/cp/ChangeLog:

	* tree.cc (strip_typedefs): Use build_distinct_type_copy.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/variadic-alias5.C: New test.
2022-03-28 09:35:58 -04:00
Tom de Vries
52f42dce15 [libgomp, testsuite] Fix hardcoded libexec in plugin/configfrag.ac
When building an nvptx offloading configuration on openSUSE Leap 15.3, the
site script /usr/share/site/x86_64-unknown-linux-gnu is activated, setting
libexecdir to ${exec_prefix}/lib rather than ${exec_prefix}/libexec:
...
| # If user did not specify libexecdir, set the correct target:
| # Nor FHS nor openSUSE allow prefix/libexec. Let's default to prefix/lib.
|
| if test "$libexecdir" = '${exec_prefix}/libexec' ; then
|       libexecdir='${exec_prefix}/lib'
| fi
...

However, in libgomp libgomp/plugin/configfrag.ac we hardcode libexec:
...
    # Configure additional search paths.
    if test x"$tgt_dir" != x; then
      offload_additional_options="$offload_additional_options \
        -B$tgt_dir/libexec/gcc/\$(target_alias)/\$(gcc_version) \
	-B$tgt_dir/bin"
...

Fix this by using /$(libexecdir:\$(exec_prefix)/%=%)/ instead of /libexec/.

Tested on x86_64-linux with nvptx accelerator.

libgomp/ChangeLog:

2022-03-28  Tom de Vries  <tdevries@suse.de>

	* plugin/configfrag.ac: Use /$(libexecdir:\$(exec_prefix)/%=%)/
	instead of /libexec/.
	* configure: Regenerate.
2022-03-28 14:09:02 +02:00
Jonathan Wakely
567eb37c76 libstdc++: Fix typos in comments in tests
libstdc++-v3/ChangeLog:

	* testsuite/20_util/optional/monadic/and_then.cc: Fix typo.
	* testsuite/20_util/optional/monadic/transform.cc: Likewise.
	* testsuite/22_locale/codecvt/always_noconv/char/1.cc: Likewise.
	* testsuite/22_locale/codecvt/encoding/char/1.cc: Likewise.
	* testsuite/22_locale/codecvt/in/char/1.cc: Likewise.
	* testsuite/22_locale/codecvt/max_length/char/1.cc: Likewise.
	* testsuite/22_locale/codecvt/out/char/1.cc: Likewise.
	* testsuite/22_locale/codecvt/unshift/char/1.cc: Likewise.
2022-03-28 12:20:42 +01:00
Martin Liska
a74ccc8cb0 gcc-changelog: Update revert_regex.
contrib/ChangeLog:

	* gcc-changelog/git_commit.py: Match trailing dot literally.
2022-03-28 12:42:46 +02:00
Martin Liska
c8464cf444 gcc-changelog: Make This reverts stricter.
contrib/ChangeLog:

	* gcc-changelog/git_commit.py: Make the parsing stricter.
2022-03-28 12:29:29 +02:00
Richard Biener
bc86a86a4f tree-optimization/105070 - annotate bit cluster tests with locations
The following makes sure to annotate the tests generated by
switch lowering bit-clustering with locations which otherwise
can be completely lost even at -O0.

2022-03-28  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/105070
	* tree-switch-conversion.h
	(bit_test_cluster::hoist_edge_and_branch_if_true): Add location
	argument.
	* tree-switch-conversion.cc
	(bit_test_cluster::hoist_edge_and_branch_if_true): Annotate
	cond with location.
	(bit_test_cluster::emit): Annotate all generated expressions
	with location.
2022-03-28 11:34:06 +02:00
Andre Vieira
9f37d31324 aarch64: Update Neoverse N2 core definition
gcc/ChangeLog:

	* config/aarch64/aarch64-cores.def: Update Neoverse N2 core entry.
2022-03-28 09:27:01 +01:00
liuhongt
e4352a0fee Fix typo in vec_setv8hi_0.
pinsrw is available for both reg and mem operand under sse2.
pextrw requires sse4.1 for mem operands.

The patch change attr "isa" for pinsrw mem alternative from sse4_noavx
to noavx, will enable below optimization.

-        movzwl  (%rdi), %eax
         pxor    %xmm1, %xmm1
-        pinsrw  $0, %eax, %xmm1
+        pinsrw  $0, (%rdi), %xmm1
         movdqa  %xmm1, %xmm0

gcc/ChangeLog:

	PR target/105066
	* config/i386/sse.md (vec_set<mode>_0): Change attr "isa" of
	alternative 4 from sse4_noavx to noavx.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/pr105066.c: New test.
2022-03-28 16:14:37 +08:00
Jakub Jelinek
50f9148f7a predcom: Fix up component::component [PR105056]
The recent change didn't initialize comp_step while previously we used
XCNEW to allocate it.

I think RS_ANY is better than RS_INTERNAL (== 0) as the default.

2022-03-28  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/105056
	* tree-predcom.cc (component::component): Initialize also comp_step.
2022-03-28 09:51:28 +02:00
Richard Biener
f6819b7fea add missing dg-require alias to gcc.dg/torture/pr100786.c
2022-03-28  Richard Biener  <rguenther@suse.de>

	* gcc.dg/torture/pr100786.c: Add dg-require alias.
2022-03-28 09:49:10 +02:00
GCC Administrator
2c1c55d701 Daily bump. 2022-03-28 00:16:40 +00:00
H.J. Lu
08e6933288 x86: Use Yw constraint on *ssse3_pshufbv8qi3
Since AVX512VL and AVX512BW are required for AVX512 VPSHUFB, replace the
"Yv" register constraint with the "Yw" register constraint.

gcc/

	PR target/105068
	* config/i386/sse.md (*ssse3_pshufbv8qi3): Replace "Yv" with
	"Yw".

gcc/testsuite/

	PR target/105068
	* gcc.target/i386/pr105068.c: New test.
2022-03-27 11:54:09 -07:00
Jonathan Wakely
b78e0ce28b libstdc++: Define std::expected for C++23 (P0323R12)
Because this adds a new class template called std::unexpected, we have
to stop declaring the std::unexpected() function (which was deprecated
in C++11 and removed in C++17).

libstdc++-v3/ChangeLog:

	* doc/doxygen/user.cfg.in: Add new header.
	* include/Makefile.am: Likewise.
	* include/Makefile.in: Regenerate.
	* include/precompiled/stdc++.h: Add new header.
	* include/std/version (__cpp_lib_expected): Define.
	* libsupc++/exception [__cplusplus > 202002] (unexpected)
	(unexpected_handler, set_unexpected): Do not declare for C++23.
	* include/std/expected: New file.
	* testsuite/20_util/expected/assign.cc: New test.
	* testsuite/20_util/expected/cons.cc: New test.
	* testsuite/20_util/expected/illformed_neg.cc: New test.
	* testsuite/20_util/expected/observers.cc: New test.
	* testsuite/20_util/expected/requirements.cc: New test.
	* testsuite/20_util/expected/swap.cc: New test.
	* testsuite/20_util/expected/synopsis.cc: New test.
	* testsuite/20_util/expected/unexpected.cc: New test.
	* testsuite/20_util/expected/version.cc: New test.
2022-03-27 18:50:31 +01:00
GCC Administrator
d2906412ad Daily bump. 2022-03-27 00:16:33 +00:00
Thomas Schwinge
43911ddd18 Remove mysterious '-# Defining these options here in addition to common.opt is necessary' command-line option
Before:

    $ [...]/gcc '-# Defining these options here in addition to common.opt is necessary' -S -x c /dev/null && echo MYSTERIOUS
    MYSTERIOUS

After:

    $ [...]/gcc '-# Defining these options here in addition to common.opt is necessary' -S -x c /dev/null && echo MYSTERIOUS
    gcc: error: unrecognized command-line option ‘-# Defining these options here in addition to common.opt is necessary’

This commit changes:

    --- [...]/build-gcc/gcc/optionlist	2022-03-24 22:12:07.936746648 +0100
    +++ [...]/build-gcc/gcc/optionlist	2022-03-24 22:30:06.976737341 +0100
    @@ -1,4 +1,3 @@
    -# Defining these options here in addition to common.opt is necessary# in order for the default -Wall setting of -Wuse-after-free=2 to take# effect.
     ###Driver
     -all-warningsAda AdaWhy AdaSCIL Alias(Wall)
     -all-warningsC ObjC C++ ObjC++ Warning Alias(Wall)
    [...]

    --- [...]/build-gcc/gcc/options.cc	2022-03-24 22:12:09.548727738 +0100
    +++ [...]/build-gcc/gcc/options.cc	2022-03-24 22:30:08.904727249 +0100
    @@ -3222,15 +3222,6 @@
     const struct cl_option cl_options[] =
     {
      /* [0] = */ {
    -    "-# Defining these options here in addition to common.opt is necessary",
    -    "# effect.",
    -    NULL,
    -    NULL,
    -    NULL, NULL, N_OPTS, N_OPTS, 68, /* .neg_idx = */ -1,
    -    0,
    -    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    -    (unsigned short) -1, 0, CLVC_INTEGER, 0, -1, -1 },
    - /* [1] = */ {
         "-###",
         NULL,
         NULL,
    [...]

..., and re-numbers all following options.

    --- [...]/build-gcc/gcc/options.h	2022-03-21 23:24:25.894226828 +0100
    +++ [...]/build-gcc/gcc/options.h	2022-03-24 22:30:07.288735708 +0100
    @@ -9753,2118 +9753,2117 @@

     enum opt_code
     {
    -  OPT___Defining_these_options_here_in_addition_to_common_opt_is_necessary = 0,/* -# Defining these options here in addition to common.opt is necessary */
    [...]

..., and likewise re-numbers all following options.

Clean-up for commit 671a283636
"Add -Wuse-after-free [PR80532]".

	gcc/c-family/
	* c.opt: Properly quote comment.
2022-03-26 21:31:30 +01:00
Roger Sayle
41d1f11f5f PR middle-end/104885: Fix ICE with large stack frame on powerpc64.
My recent testcase for PR c++/84964.C stress tests the middle-end by
attempting to pass a UINT_MAX sized structure on the stack.  Although
my fix to PR84964 avoids the ICE after sorry on x86_64 and similar
targets, a related issue still exists on powerpc64 (and similar
ACCUMULATE_OUTGOING_ARGS/ARGS_GROW_DOWNWARD targets) which don't
issue a "sorry, unimplemented" message, but instead ICE elsewhere.

After attempting several alternate fixes, the simplest solution is
to just defensively check in mark_stack_region_used that the upper
bound of the region lies within the allocated stack_usage_map
array, which is of size highest_outgoing_arg_in_use.  When this isn't
the case, the code now follows the same path as for variable sized
regions, and uses stack_usage_watermark rather than a map.

2022-03-26  Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog
	PR middle-end/104885
	* calls.cc (mark_stack_region_used): Check that the region
	is within the allocated size of stack_usage_map.
2022-03-26 08:10:27 -10:00
Jakub Jelinek
6459e65376 ecog: Return 1 from insn_invalid_p if REG_INC reg overlaps some stored reg [PR103775]
The following testcase ICEs on aarch64-linux with -g and
assembles with a warning otherwise, because it emits
ldrb w0,[x0,16]!
instruction which sets the x0 register multiple times.
Due to disabled DCE (from -Og) we end up before REE with:
(insn 12 39 13 2 (set (reg:SI 1 x1 [orig:93 _2 ] [93])
        (zero_extend:SI (mem/c:QI (pre_modify:DI (reg/f:DI 0 x0 [114])
                    (plus:DI (reg/f:DI 0 x0 [114])
                        (const_int 16 [0x10]))) [1 u128_1+0 S1 A128]))) "pr103775.c":5:35 117 {*zero_extendqisi2_aarch64}
     (expr_list:REG_INC (reg/f:DI 0 x0 [114])
        (nil)))
(insn 13 12 14 2 (set (reg:DI 0 x0 [orig:112 _2 ] [112])
        (zero_extend:DI (reg:SI 1 x1 [orig:93 _2 ] [93]))) "pr103775.c":5:16 111 {*zero_extendsidi2_aarch64}
     (nil))
which is valid but not exactly efficient as x0 is dead after the
insn that auto-increments it.  REE turns it into:
(insn 12 39 44 2 (set (reg:DI 0 x0)
        (zero_extend:DI (mem/c:QI (pre_modify:DI (reg/f:DI 0 x0 [114])
                    (plus:DI (reg/f:DI 0 x0 [114])
                        (const_int 16 [0x10]))) [1 u128_1+0 S1 A128]))) "pr103775.c":5:35 119 {*zero_extendqidi2_aarch64}
     (expr_list:REG_INC (reg/f:DI 0 x0 [114])
        (nil)))
(insn 44 12 14 2 (set (reg:DI 1 x1)
        (reg:DI 0 x0)) "pr103775.c":5:35 -1
     (nil))
which is invalid because it sets x0 multiple times, one
in SET_DEST of the PATTERN and once in PRE_MODIFY.
As perhaps other passes than REE might suffer from it, IMHO it is better
to reject this during change validation.

2022-03-26  Jakub Jelinek  <jakub@redhat.com>

	PR rtl-optimization/103775
	* recog.cc (check_invalid_inc_dec): New function.
	(insn_invalid_p): Return 1 if REG_INC operand overlaps
	any stored REGs.

	* gcc.dg/pr103775.c: New test.
2022-03-26 16:21:36 +01:00
Patrick Palka
ff465bd8a0 c++: diagnosing if-stmt with non-constant branches [PR105050]
When an if-stmt is determined to be non-constant because both of its
branches are non-constant, we issue a somewhat generic error which,
since the error also points to the 'if' token, misleadingly suggests
the condition is at fault:

  constexpr-105050.C:8:3: error: expression ‘<statement>’ is not a constant expression
      8 |   if (p != q && *p < 0)
        |   ^~

This patch clarifies the error message to instead read:

  constexpr-105050.C:8:3: error: neither branch of ‘if’ is a constant expression
      8 |   if (p != q && *p < 0)
        |   ^~

	PR c++/105050

gcc/cp/ChangeLog:

	* constexpr.cc (potential_constant_expression_1) <case IF_STMT>:
	Clarify error message when a if-stmt is non-constant because its
	branches are non-constant.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp1y/constexpr-105050.C: New test.
2022-03-26 10:20:18 -04:00
Patrick Palka
04f19580e8 c++: ICE when building builtin operator->* set [PR103455]
Here when constructing the builtin operator->* candidate set according
to the available conversion functions for the operand types, we end up
considering a candidate with C1=T (through B's dependent conversion
function) and C2=F, during which we crash from DERIVED_FROM_P because
dependent_type_p sees a TEMPLATE_TYPE_PARM outside of a template
context.

Sidestepping the question of whether we should be considering such a
dependent conversion function here in the first place, it seems futile
to test DERIVED_FROM_P for anything other than an actual class type, so
this patch fixes this ICE by simply guarding the DERIVED_FROM_P test
with CLASS_TYPE_P instead of MAYBE_CLASS_TYPE_P.

	PR c++/103455

gcc/cp/ChangeLog:

	* call.cc (add_builtin_candidate) <case MEMBER_REF>: Test
	CLASS_TYPE_P instead of MAYBE_CLASS_TYPE_P.

gcc/testsuite/ChangeLog:

	* g++.dg/overload/builtin6.C: New test.
2022-03-26 10:20:16 -04:00
H.J. Lu
ede5f5224d x86: Use x constraint on KL patterns
Since KL instructions have no AVX512 version, replace the "v" register
constraint with the "x" register constraint.

	PR target/105058
	* config/i386/sse.md (loadiwkey): Replace "v" with "x".
	(aes<aesklvariant>u8): Likewise.
2022-03-26 07:15:39 -07:00
H.J. Lu
99591cf43f x86: Use x constraint on SSSE3 patterns with MMX operands
Since PHADDW/PHADDD/PHADDSW/PHSUBW/PHSUBD/PHSUBSW/PSIGNB/PSIGNW/PSIGND
have no AVX512 version, replace the "Yv" register constraint with the
"x" register constraint.

	PR target/105052
	* config/i386/sse.md (ssse3_ph<plusminus_mnemonic>wv4hi3):
	Replace "Yv" with "x".
	(ssse3_ph<plusminus_mnemonic>dv2si3): Likewise.
	(ssse3_psign<mode>3): Likewise.
2022-03-26 07:15:34 -07:00
David Malcolm
8c8993c753 analyzer: fix ICE on memset of untracked region [PR105057]
In r12-7809-g5f6197d7c197f9d2b7fb2e1a19dac39a023755e8 I added an
optimization to avoid tracking the state of certain memory regions
in the store.

Unfortunately, I didn't cover every way in which
store::get_or_create_cluster can be called for a base region, leading
to assertion failure ICEs in -fanalyzer on certain function calls
with certain params.

I've worked through all uses of store::get_or_create_cluster and found
four places where the assertion could fire.

This patch fixes them, and adds regression tests where possible.

gcc/analyzer/ChangeLog:
	PR analyzer/105057
	* store.cc (binding_cluster::make_unknown_relative_to): Reject
	attempts to create a cluster for untracked base regions.
	(store::set_value): Likewise.
	(store::fill_region): Likewise.
	(store::mark_region_as_unknown): Likewise.

gcc/testsuite/ChangeLog:
	PR analyzer/105057
	* gcc.dg/analyzer/fread-2.c: New test, as a regression test for
	ICE in store::set_value on untracked base region.
	* gcc.dg/analyzer/memset-2.c: Likewise, for ICE in
	store::fill_region.
	* gcc.dg/analyzer/strcpy-2.c: Likewise, for ICE in
	store::mark_region_as_unknown.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-03-26 09:05:30 -04:00
Jakub Jelinek
f0fdd92e9d Manually add entry for r12-7818-g3ab5c8cd03d92bf4ec41e351820349d92fbc40c4
Because update_version_git gave up on it.
2022-03-26 11:28:35 +01:00
GCC Administrator
31e989a278 Daily bump. 2022-03-26 10:22:39 +00:00
Jakub Jelinek
0268c547de Add another commit to ignore
We can't handle r12-7818-g3ab5c8cd03d92bf4ec41e351820349d92fbc40c4

	* gcc-changelog/git_update_version.py: Add
	3ab5c8cd03 to ignored commits.
2022-03-26 11:20:58 +01:00
Jakub Jelinek
1806829e08 c++: Fix up __builtin_{bit_cast,convertvector} parsing
Jonathan reported on IRC that we don't parse
__builtin_bit_cast (type, val).field
etc.
The problem is that for these 2 builtins we return from
cp_parser_postfix_expression instead of setting postfix_expression
to the cp_build_* value and falling through into the postfix regression
suffix handling loop.

2022-03-26  Jakub Jelinek  <jakub@redhat.com>

	* parser.cc (cp_parser_postfix_expression)
	<case RID_BILTIN_CONVERTVECTOR, case RID_BUILTIN_BIT_CAST>: Don't
	return cp_build_{vec,convert,bit_cast} result right away, instead
	set postfix_expression to it and break.

	* c-c++-common/builtin-convertvector-3.c: New test.
	* g++.dg/cpp2a/bit-cast15.C: New test.
2022-03-26 08:11:58 +01:00
Hans-Peter Nilsson
75d1c8fea9 reload: Adjust comment in find_reloads about subset, not intersection
gcc:
	* reload.cc (find_reloads): Align comment with code where
	considering the intersection of register classes then tweaking the
	regclass for the current alternative or rejecting it.
2022-03-26 05:31:22 +01:00
Peter Bergner
81faedaa8e rs6000: Update testsuite to use -mdejagnu-cpu= and -mdejagnu-tune= options
This patch updates the POWER testsuite test cases using -mcpu= and -mtune=
to use the preferred -mdejagnu-cpu= and -mdejagnu-tune= options.  This also
obviates the need for the dg-skip-if directive, since the user cannot
override the -mcpu= value being used to compile the test case.

2022-03-25  Peter Bergner  <bergner@linux.ibm.com>

gcc/testsuite/

	* g++.dg/pr65240-1.C: Use -mdejagnu-cpu=.  Remove dg-skip-if.
	* g++.dg/pr65240-2.C: Likewise.
	* g++.dg/pr65240-3.C: Likewise.
	* g++.dg/pr65240-4.C: Likewise.
	* g++.dg/pr65242.C: Likewise.
	* g++.dg/pr67211.C: Likewise.
	* g++.dg/pr69667.C: Likewise.
	* g++.dg/pr71294.C: Likewise.
	* g++.dg/pr84279.C: Likewise.
	* g++.dg/torture/ppc-ldst-array.C: Likewise.
	* gfortran.dg/nint_p7.f90: Likewise.
	* gfortran.dg/pr102860.f90: Likewise.
	* gcc.target/powerpc/fusion.c: Use -mdejagnu-cpu= and -mdejagnu-tune=.
	* gcc.target/powerpc/fusion2.c: Likewise.
	* gcc.target/powerpc/int_128bit-runnable.c: Use -mdejagnu-cpu=.
	* gcc.target/powerpc/test_mffsl.c: Likewise.
	* gfortran.dg/pr47614.f: Likewise.
	* gfortran.dg/pr58968.f: Likewise.
2022-03-25 17:59:39 -05:00
H.J. Lu
bdd7b679e8 x86: Use -msse2 on gcc.target/i386/pr95483-1.c
Replace -msse with -msse2 since <emmintrin.h> requires SSE2.

	PR testsuite/105055
	* gcc.target/i386/pr95483-1.c: Replace -msse with -msse2.
2022-03-25 14:03:21 -07:00
Jonathan Wakely
674ec67905 libstdc++: Add more doxygen comments in <bit>
libstdc++-v3/ChangeLog:

	* include/std/bit (bit_cast, byteswap, endian): Add doxygen
	comments.
2022-03-25 20:21:48 +00:00
Christophe Lyon
3ab5c8cd03 arm: Revert Auto-vectorization for MVE: add pack/unpack patterns PR target/104882
This reverts commit r12-1434-g046a3beb1673bf to fix PR target/104882.

As discussed in the PR, it turns out that the MVE ISA has no natural
mapping with GCC's vec_pack_trunc / vec_unpack standard patterns, unlike
Neon or SVE for instance.

This patch also adds the executable testcase provided in the PR.
This test passes at -O3 because the generated code does not need
to use the pack/unpack patterns, hence the use of -O2 which now
triggers vectorization since a few months ago.

2022-03-18  Christophe Lyon  <christohe.lyon@arm.com>

	PR target/104882
	Revert
	2021-06-11  Christophe Lyon  <christophe.lyon@linaro.org>

	gcc/
	* config/arm/mve.md (mve_vec_unpack<US>_lo_<mode>): Delete.
	(mve_vec_unpack<US>_hi_<mode>): Delete.
	(@mve_vec_pack_trunc_lo_<mode>): Delete.
	(mve_vmovntq_<supf><mode>): Remove '@' prefix.
	* config/arm/neon.md (vec_unpack<US>_hi_<mode>): Move back
	from vec-common.md.
	(vec_unpack<US>_lo_<mode>): Likewise.
	(vec_pack_trunc_<mode>): Rename from
	neon_quad_vec_pack_trunc_<mode>.
	* config/arm/vec-common.md (vec_unpack<US>_hi_<mode>): Delete.
	(vec_unpack<US>_lo_<mode>): Delete.
	(vec_pack_trunc_<mode>): Delete.

	PR target/104882
	gcc/testsuite/
	* gcc.target/arm/simd/mve-vclz.c: Update expected results.
	* gcc.target/arm/simd/mve-vshl.c: Likewise.
	* gcc.target/arm/simd/mve-vec-pack.c: Delete.
	* gcc.target/arm/simd/mve-vec-unpack.c: Delete.
	* gcc.target/arm/simd/pr104882.c: New test.
2022-03-25 17:26:33 +00:00
Vladimir N. Makarov
25725506b8 [PR104971] LRA: check live hard regs to remove a dead insn
LRA removes insn modifying sp for given PR test set.  We should also have
checked living hard regs to prevent this.  The patch fixes this.

gcc/ChangeLog:

	PR middle-end/104971
	* lra-lives.cc (process_bb_lives): Check hard_regs_live for hard
	regs to clear remove_p flag.
2022-03-25 12:30:54 -04:00
Richard Biener
fe705dce2e tree-optimization/105053 - fix reduction chain epilogue generation
When we optimize permutations in a reduction chain we have to
be careful to select the correct live-out stmt, otherwise the
reduction result will be unused and the retained scalar code will
execute only the number of vector iterations.

2022-03-25  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/105053
	* tree-vect-loop.cc (vect_create_epilog_for_reduction): Pick
	the correct live-out stmt for a reduction chain.

	* g++.dg/vect/pr105053.cc: New testcase.
2022-03-25 15:26:29 +01:00
Marek Polacek
d0b938a761 c++: alignas and alignof void [PR104944]
I started looking into this PR because in GCC 4.9 we were able to
detect the invalid

  struct alignas(void) S{};

but I broke it in r210262.

It's ill-formed code in C++:
[dcl.align]/3: "An alignment-specifier of the form alignas(type-id) has
the same effect as alignas(alignof(type-id))", and [expr.align]/1:
"The operand shall be a type-id representing a complete object type,
or an array thereof, or a reference to one of those types." and void
is not a complete type.

It's also invalid in C:
6.7.5: _Alignas(type-name) is equivalent to _Alignas(_Alignof(type-name))
6.5.3.4: "The _Alignof operator shall not be applied to a function type
or an incomplete type."

We have a GNU extension whereby we treat sizeof(void) as 1, but I assume
it doesn't apply to alignof, at least in C++.  However, __alignof__(void)
is still accepted with a -Wpedantic warning.

We still say "invalid application of 'alignof'" rather than 'alignas' in the
void diagnostic, but I felt that fixing that may not be suitable as part of
this patch.  The "incomplete type" diagnostic still always prints
'__alignof__'.

	PR c++/104944

gcc/cp/ChangeLog:

	* typeck.cc (cxx_sizeof_or_alignof_type): Diagnose alignof(void).
	(cxx_alignas_expr): Call cxx_sizeof_or_alignof_type with
	complain == true.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/alignas20.C: New test.
2022-03-25 10:13:52 -04:00
Tom de Vries
8570cce7c7 [libgomp, testsuite] Scale down some OpenACC test-cases
When a display manager is running on an nvidia card, all CUDA kernel launches
get a 5 seconds watchdog timer.

Consequently, when running the libgomp testsuite with nvptx accelerator and
GOMP_NVPTX_JIT=-O0 we run into a few FAILs like this:
...
libgomp: cuStreamSynchronize error: the launch timed out and was terminated
FAIL: libgomp.oacc-c/../libgomp.oacc-c-c++-common/parallel-dims.c \
  -DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 -foffload=nvptx-none -O0 \
  execution test
...

Fix this by scaling down the failing test-cases by default, and reverting to
the original behaviour for GCC_TEST_RUN_EXPENSIVE=1.

Tested on x86_64-linux with nvptx accelerator.

libgomp/ChangeLog:

2022-03-25  Tom de Vries  <tdevries@suse.de>

	PR libgomp/105042
	* testsuite/libgomp.oacc-c-c++-common/parallel-dims.c: Reduce
	execution time.
	* testsuite/libgomp.oacc-c-c++-common/vred2d-128.c: Same.
	* testsuite/libgomp.oacc-fortran/parallel-dims.f90: Same.
2022-03-25 13:51:48 +01:00
Richard Biener
0b0fc52b04 middle-end/105049 - fix uniform_vector_p and vector CTOR gimplification
We have

  return VIEW_CONVERT_EXPR<U>( VEC_PERM_EXPR < {<<< Unknown tree: compound_literal_expr
        V D.1984 = { 0 }; >>>, { 0 }} , {<<< Unknown tree: compound_literal_expr
        V D.1985 = { 0 }; >>>, { 0 }} , { 0, 0 } >  & {(short int) SAVE_EXPR <c>, (short int) SAVE_EXPR <c>});

where we gimplify the init CTORs to

  _1 = {{ 0 }, { 0 }};
  _2 = {{ 0 }, { 0 }};

instead of to vector constants.  That later runs into a bug in
uniform_vector_p which doesn't handle CTORs of vector elements
correctly.

The following adjusts uniform_vector_p to handle CTORs of vector
elements.

2022-03-25  Richard Biener  <rguenther@suse.de>

	PR middle-end/105049
	* tree.cc (uniform_vector_p): Recurse for VECTOR_CST or
	CONSTRUCTOR first elements.

	* gcc.dg/pr105049.c: New testcase.
2022-03-25 13:15:37 +01:00
Eric Botcazou
711c7f079b Fix issue for pointers to anonymous types with -fdump-ada-spec
This used to work long ago but broke at some point.

gcc/c-family/
	* c-ada-spec.cc (dump_ada_import): Deal with the "section" attribute
	(dump_ada_node) <POINTER_TYPE>: Do not modify and pass the name, but
	the referenced type instead.  Deal with the anonymous original type
	of a typedef'ed type.  In the actual access case, follow the chain
	of external subtypes.
	<TYPE_DECL>: Tidy up control flow.
2022-03-25 12:37:01 +01:00
Jakub Jelinek
45e955b0a9 fortran: Fix up initializers of param(0) PARAMETERs [PR103691]
On the gfortran.dg/pr103691.f90 testcase the Fortran ICE emits
  static real(kind=4) a[0] = {[0 ... -1]=2.0e+0};
That is an invalid RANGE_EXPR where the maximum is smaller than the minimum.

The following patch fixes that.  If TYPE_MAX_VALUE is smaller than
TYPE_MIN_VALUE, the array is empty and so doesn't need any initializer,
if the two are equal, we don't need to bother with a RANGE_EXPR and
can just use that INTEGER_CST as the index and finally for the 2+ values
in the range it uses a RANGE_EXPR as before.

2022-03-25  Jakub Jelinek  <jakub@redhat.com>

	PR fortran/103691
	* trans-array.cc (gfc_conv_array_initializer): If TYPE_MAX_VALUE is
	smaller than TYPE_MIN_VALUE (i.e. empty array), ignore the
	initializer; if TYPE_MIN_VALUE is equal to TYPE_MAX_VALUE, use just
	the TYPE_MIN_VALUE as index instead of RANGE_EXPR.
2022-03-25 11:22:15 +01:00
Tobias Burnus
748f36a48b doc/invoke.texi: Move @ignore block out of @gccoptlist [PR103533]
With TeX output ("make pdf"), @gccoptlist's content end up in a single
line such that TeX does not find the matching '@end ignore' for the
'@ignore' block – failing with a runaway error. Solution is to move
the @ignore block after the closing '}'.
(Follow up to r12-7808-g319ba7e241e7e21f9eb481f075310796f13d2035 )

gcc/
	PR analyzer/103533
	* doc/invoke.texi (Static Analyzer Options): Move
	@ignore block after @gccoptlist's '}' for 'make pdf'.
2022-03-25 10:47:49 +01:00
David Malcolm
5f6197d7c1 analyzer: add region::tracked_p to optimize state objects [PR104954]
PR analyzer/104954 tracks that -fanalyzer was taking a very long time
on a particular source file in the Linux kernel:
  drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c

One issue occurs with the repeated use of dynamic debug lines e.g. via
the DC_LOG_BANDWIDTH_CALCS macro, such as in print_bw_calcs_dceip in
drivers/gpu/drm/amd/display/dc/calcs/calcs_logger.h:

  DC_LOG_BANDWIDTH_CALCS("#####################################################################");
  DC_LOG_BANDWIDTH_CALCS("struct bw_calcs_dceip");
  DC_LOG_BANDWIDTH_CALCS("#####################################################################");

  [...snip dozens of lines...]

  DC_LOG_BANDWIDTH_CALCS("[bw_fixed] dmif_request_buffer_size: %d",
                         bw_fixed_to_int(dceip->dmif_request_buffer_size));

When this is configured to use __dynamic_pr_debug, each of these becomes
code like:

  do {
    static struct _ddebug __attribute__((__aligned__(8)))
    __attribute__((__section__("__dyndbg"))) __UNIQUE_ID_ddebug277 = {
      [...snip...]
    };
    if (arch_static_branch(&__UNIQUE_ID_ddebug277.key, false))
      __dynamic_pr_debug(&__UNIQUE_ID_ddebug277, [...the message...]);
  } while (0);

The analyzer was naively seeing each call to __dynamic_pr_debug, noting
that the __UNIQUE_ID_nnnn object escapes.  At each call, as successive
__UNIQUE_ID_nnnn object escapes, there are N escaped objects, and thus N
need clobbering, and so we have O(N^2) clobbering of escaped objects overall,
leading to huge amounts of pointless work: print_bw_calcs_data has 225
uses of DC_LOG_BANDWIDTH_CALCS, many of which are in loops.

This patch adds a way to identify declarations that aren't interesting
to the analyzer, so that we don't attempt to create binding_clusters
for them (i.e. we don't store any state for them in our state objects).
This is implemented by adding a new region::tracked_p, implemented for
declarations by walking the existing IPA data the first time the
analyzer sees a declaration, setting it to false for global vars that
have no loads/stores/aliases, and "sufficiently safe" address-of
ipa-refs.

The patch gives a large speedup of -fanalyzer on the above kernel
source file:
                           Before  After
Total cc1 wallclock time:    180s    36s
analyzer wallclock time:     162s    17s
% spent in analyzer:          90%    47%

gcc/analyzer/ChangeLog:
	PR analyzer/104954
	* analyzer.opt (-fdump-analyzer-untracked): New option.
	* engine.cc (impl_run_checkers): Handle it.
	* region-model-asm.cc (region_model::on_asm_stmt): Don't attempt
	to clobber regions with !tracked_p ().
	* region-model-manager.cc (dump_untracked_region): New.
	(region_model_manager::dump_untracked_regions): New.
	(frame_region::dump_untracked_regions): New.
	* region-model.h (region_model_manager::dump_untracked_regions):
	New decl.
	* region.cc (ipa_ref_requires_tracking): New.
	(symnode_requires_tracking_p): New.
	(decl_region::calc_tracked_p): New.
	* region.h (region::tracked_p): New vfunc.
	(frame_region::dump_untracked_regions): New decl.
	(class decl_region): Note that this is also used fo SSA names.
	(decl_region::decl_region): Initialize m_tracked.
	(decl_region::tracked_p): New.
	(decl_region::calc_tracked_p): New decl.
	(decl_region::m_tracked): New.
	* store.cc (store::get_or_create_cluster): Assert that we
	don't try to create clusters for base regions that aren't
	trackable.
	(store::mark_as_escaped): Don't mark base regions that we're not
	tracking.

gcc/ChangeLog:
	PR analyzer/104954
	* doc/invoke.texi (Static Analyzer Options): Add
	-fdump-analyzer-untracked.

gcc/testsuite/ChangeLog:
	PR analyzer/104954
	* gcc.dg/analyzer/asm-x86-dyndbg-1.c: New test.
	* gcc.dg/analyzer/asm-x86-dyndbg-2.c: New test.
	* gcc.dg/analyzer/many-unused-locals.c: New test.
	* gcc.dg/analyzer/untracked-1.c: New test.
	* gcc.dg/analyzer/unused-local-1.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-03-24 20:58:10 -04:00
Avinash Sonawane
319ba7e241 Docs: Document that taint analyzer checker disables some warnings [PR103533]
gcc/ChangeLog:
	PR analyzer/103533
	* doc/invoke.texi: Document that enabling taint analyzer
	checker disables some warnings from `-fanalyzer`.

Signed-off-by: Avinash Sonawane <rootkea@gmail.com>
2022-03-24 20:57:10 -04:00
GCC Administrator
6fc4a993ce Daily bump. 2022-03-25 00:17:18 +00:00
Bill Schmidt
21079cb82b Change my MAINTAINERS information
I have changed employers and need to withdraw as SLSR maintainer for now.
Adding myself under a new email address under the DCO session.  Thanks!

2021-03-24  Bill Schmidt  <bill.schmidt@gmail.com>

	* MAINTAINERS: Change my information.
2022-03-24 23:51:39 +00:00
Marek Polacek
9fdac7e16c c++: ICE with template code in constexpr [PR104284]
Since r9-6073 cxx_eval_store_expression preevaluates the value to
be stored, and that revealed a crash where a template code (here,
code=IMPLICIT_CONV_EXPR) leaks into cxx_eval*.

It happens because we're performing build_vec_init while processing
a template, which calls get_temp_regvar which creates an INIT_EXPR.
This INIT_EXPR's RHS contains an rvalue conversion so we create an
IMPLICIT_CONV_EXPR.  Its operand is not type-dependent and the whole
INIT_EXPR is not type-dependent.  So we call build_non_dependent_expr
which, with -fchecking=2, calls fold_non_dependent_expr.  At this
point the expression still has an IMPLICIT_CONV_EXPR, which ought to
be handled in instantiate_non_dependent_expr_internal.  However,
tsubst_copy_and_build doesn't handle INIT_EXPR; it will just call
tsubst_copy which does nothing when args is null.  So we fail to
replace the IMPLICIT_CONV_EXPR and ICE.

The problem is that we call build_vec_init in a template in the
first place.  We can avoid doing so by checking p_t_d before
calling build_aggr_init in check_initializer.

	PR c++/104284

gcc/cp/ChangeLog:

	* decl.cc (check_initializer): Don't call build_aggr_init in
	a template.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp1y/constexpr-104284-1.C: New test.
	* g++.dg/cpp1y/constexpr-104284-2.C: New test.
	* g++.dg/cpp1y/constexpr-104284-3.C: New test.
	* g++.dg/cpp1y/constexpr-104284-4.C: New test.
2022-03-24 16:59:57 -04:00
Jason Merrill
346ab5a54a c++: delayed parse DMI [PR96645]
With the changes for PR81359 and PR88368 to make get_nsdmi errors be treated
as substitution failure, we have the problem that if we check
std::is_default_constructible for a complete class that still has unparsed
default member initializers, we get an answer (false) that will be wrong
once the DMIs have been parsed.  The traits avoid this problem for regular
incomplete classes by giving an error if the operand is incomplete; we
should do the same if get_nsdmi is going to fail due to unparsed DMI.

	PR c++/96645

gcc/cp/ChangeLog:

	* cp-tree.h (type_has_default_ctor_to_be_synthesized): Declare.
	* class.cc (type_has_default_ctor_to_be_synthesized): New.
	(type_has_non_user_provided_default_constructor_1): Support it.
	(type_has_non_user_provided_default_constructor): Now a wrapper.
	* method.cc (complain_about_unparsed_dmi): New.
	(constructible_expr): Call it.

gcc/testsuite/ChangeLog:

	* g++.dg/ext/is_constructible3.C: Expect error.
	* g++.dg/ext/is_constructible7.C: New test.
2022-03-24 14:31:16 -04:00
Marek Polacek
f0530882d9 c++: FIX_TRUNC_EXPR in tsubst [PR102990]
This is a crash where a FIX_TRUNC_EXPR gets into tsubst_copy_and_build
where it hits gcc_unreachable ().

The history of tsubst_copy_and_build/FIX_TRUNC_EXPR is such that it
was introduced in r181478, but it did the wrong thing, whereupon it
was turned into gcc_unreachable () in r258821 (see this thread:
<https://gcc.gnu.org/pipermail/gcc-patches/2018-March/495853.html>).

In a template, we should never create a FIX_TRUNC_EXPR (that's what
conv_unsafe_in_template_p is for).  But in this test we are NOT in
a template when we call digest_nsdmi_init which ends up calling
convert_like, converting 1.0e+0 to int, so convert_to_integer_1
gives us a FIX_TRUNC_EXPR.

But then when we get to parsing f's parameters, we are in a template
when processing decltype(Helpers{}), and since r268321, when the
compound literal isn't instantiation-dependent and the type isn't
type-dependent, finish_compound_literal falls back to the normal
processing, so it calls digest_init, which does fold_non_dependent_init
and since the FIX_TRUNC_EXPR isn't dependent, we instantiate and
therefore crash in tsubst_copy_and_build.

The fateful call to fold_non_dependent_init comes from massage_init_elt,
We shouldn't be calling f_n_d_i on the result of get_nsdmi.  This we can
avoid by eschewing calling f_n_d_i on CONSTRUCTORs; their elements have
already been folded.

	PR c++/102990

gcc/cp/ChangeLog:

	* typeck2.cc (massage_init_elt): Avoid folding CONSTRUCTORs.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/nsdmi-template22.C: New test.
	* g++.dg/cpp0x/nsdmi-template23.C: New test.
2022-03-24 13:12:15 -04:00
Patrick Palka
647537adef c++: missing SFINAE for non-constant consteval calls [PR104620]
Here we weren't respecting SFINAE when evaluating a call to a consteval
function, which caused us to reject the new testcase below.  This patch
fixes this by making build_over_call use the SFINAE-friendly version of
cxx_constant_value.

This change causes us to no longer diagnose ahead of time a couple of
non-constant non-dependent consteval calls in consteval-if2.C with
-fchecking=2.  These errors were apparently coming from the call to
fold_non_dependent_expr in build_non_dependent_expr (for the RHS of the +=)
despite complain=tf_none being passed.  Now that build_over_call respects
the value of complain during constant evaluation of a consteval call,
the errors are gone.

That the errors are also gone without -fchecking=2 is a regression caused
by r12-7264-gc19f317a78c0e4 and is the subject of PR104620.  As described
in comment #5, I think it's basically an accident that we were diagnosing
these two calls correctly before r12-7264, so perhaps we can live without
these errors for GCC 12.  Thus this patch just XFAILs the two tests.

	PR c++/104620

gcc/cp/ChangeLog:

	* call.cc (build_over_call): Use cxx_constant_value_sfinae
	instead of cxx_constant_value to evaluate a consteval call.
	* constexpr.cc (cxx_constant_value_sfinae): Add decl parameter
	and pass it to cxx_eval_outermost_constant_expr.
	* cp-tree.h (cxx_constant_value_sfinae): Add decl parameter.
	* pt.cc (fold_targs_r): Pass NULL_TREE as decl parameter to
	cxx_constant_value_sfinae.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp23/consteval-if2.C: XFAIL two dg-error tests where
	the argument to the non-constant non-dependent consteval call is
	wrapped by NON_DEPENDENT_EXPR.
	* g++.dg/cpp2a/consteval30.C: New test.
2022-03-24 11:42:31 -04:00
Alexandre Oliva
fb488cba57 hardened conditionals: drop copied identifiers
The copies of identifiers, indended to associate hardening SSA
temporaries to the original variables they refer to, end up causing
-fcompare-debug to fail, because DECL_UIDs are not identical, and the
nouid flag used in compare-debug dumps doesn't affect the uids in
naked identifiers, so the divergence becomes apparent.

This patch drops the naked identifiers.  Though somewhat desirable,
they're not necessary.


for  gcc/ChangeLog

	PR debug/104564
	* gimple-harden-conditionals.cc (detach_value): Keep temps
	anonymous.

for  gcc/testsuite/ChangeLog

	PR debug/104564
	* c-c++-common/torture/harden-comp.c: Adjust.
	* c-c++-common/torture/harden-cond.c: Adjust.
2022-03-24 10:02:29 -03:00