From be246ac2d26e1cb072f205bf97d5eac150220f3f Mon Sep 17 00:00:00 2001 From: Anthony Sharp Date: Wed, 10 Mar 2021 20:36:03 +0000 Subject: c++: Private parent access check for using decls [PR19377] This bug was already mostly fixed by the patch for PR17314. This patch continues that by ensuring that where a using decl is used, causing an access failure to a child class because the using decl is private, the compiler correctly points to the using decl as the source of the problem. gcc/cp/ChangeLog: 2021-03-10 Anthony Sharp * semantics.c (get_class_access_diagnostic_decl): New function that examines special cases when a parent class causes a private access failure. (enforce_access): Slightly modified to call function above. gcc/testsuite/ChangeLog: 2021-03-10 Anthony Sharp * g++.dg/cpp1z/using9.C: New using decl test. Co-authored-by: Jason Merrill --- gcc/testsuite/g++.dg/cpp1z/using9.C | 49 +++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1z/using9.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp1z/using9.C b/gcc/testsuite/g++.dg/cpp1z/using9.C new file mode 100644 index 0000000..98e36ba --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/using9.C @@ -0,0 +1,49 @@ +/* { dg-do compile { target c++17 } } */ +// Created for c++ PR19377 + +class A2 +{ + protected: + int separate(int a); + int separate(int a, int b); + int separate(int a, int b, int c); + int comma(int a); + int alone; +}; + +class A1 +{ + protected: + int separate(); + int comma(); +}; + +class A3 +{ + protected: + int comma(int a, int b); +}; + +class B:private A3, private A1, private A2 +{ + // Using decls in a comma-separated list. + using A2::comma, A3::comma, A1::comma; // { dg-message "declared" } + // Separate using statements. + using A2::separate; // { dg-message "declared" } + using A1::separate; // { dg-message "declared" } + // No ambiguity, just for the sake of it. + using A2::alone; // { dg-message "declared" } +}; + +class C:public B +{ + void f() + { + comma(); // { dg-error "private" } + separate(); // { dg-error "private" } + separate(1); // { dg-error "private" } + separate(1, 2); // { dg-error "private" } + separate(1, 2, 3); // { dg-error "private" } + alone = 5; // { dg-error "private" } + } +}; -- cgit v1.1 From 40465293cd780aa82dcae75dfcfb1449d8c0561e Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Wed, 3 Mar 2021 18:37:49 -0500 Subject: c++: ICE with real-to-int conversion in template [PR97973] In this test we are building a call in a template, but since neither the function nor any of its arguments are dependent, we go down the normal path in finish_call_expr. convert_arguments sees that we're binding a reference to int to double and therein convert_to_integer creates a FIX_TRUNC_EXPR. Later, we call check_function_arguments which folds the arguments, and, in a template, fold_for_warn calls fold_non_dependent_expr. But tsubst_copy_and_build should not see a FIX_TRUNC_EXPR (see the patch discussed in ) or we crash. So let's not create a FIX_TRUNC_EXPR in a template in the first place and instead use IMPLICIT_CONV_EXPR. gcc/cp/ChangeLog: PR c++/97973 * call.c (conv_unsafe_in_template_p): New. (convert_like): Use it. gcc/testsuite/ChangeLog: PR c++/97973 * g++.dg/conversion/real-to-int1.C: New test. --- gcc/testsuite/g++.dg/conversion/real-to-int1.C | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 gcc/testsuite/g++.dg/conversion/real-to-int1.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/conversion/real-to-int1.C b/gcc/testsuite/g++.dg/conversion/real-to-int1.C new file mode 100644 index 0000000..f7b990b --- /dev/null +++ b/gcc/testsuite/g++.dg/conversion/real-to-int1.C @@ -0,0 +1,17 @@ +// PR c++/97973 + +void (*foo[1])(const int &); +void (*foo2[1])(const double &); + +template +void f () +{ + (foo[0])(1.1); + (foo2[0])(1); +} + +void +g () +{ + f (); +} -- cgit v1.1 From 19ac7c94b2ff9e6e289b30989a9339cb7f76a86a Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 18 Mar 2021 00:16:24 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5e6b536..55b41de 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,39 @@ +2021-03-17 Marek Polacek + + PR c++/97973 + * g++.dg/conversion/real-to-int1.C: New test. + +2021-03-17 Anthony Sharp + Jason Merrill + + * g++.dg/cpp1z/using9.C: New using decl test. + +2021-03-17 Iain Sandoe + + * c-c++-common/asan/strncpy-overflow-1.c: Add _FORTIFY_SOURCE=0 and + -gdwarf-3 to the command line options. Adjust the expected line + numbers for the revised options header. + +2021-03-17 Iain Sandoe + + * c-c++-common/asan/memcmp-1.c: Add _FORTIFY_SOURCE=0 and + -gdwarf-3 to the command line options. Provide Darwin- + specific match lines for the expected output. + +2021-03-17 Kyrylo Tkachov + + * gcc.target/aarch64/acle/rng_2.c: New test. + +2021-03-17 H.J. Lu + + PR target/99504 + * gcc.target/i386/pr99530-1.c: New test. + * gcc.target/i386/pr99530-2.c: Likewise. + * gcc.target/i386/pr99530-3.c: Likewise. + * gcc.target/i386/pr99530-4.c: Likewise. + * gcc.target/i386/pr99530-5.c: Likewise. + * gcc.target/i386/pr99530-6.c: Likewise. + 2021-03-16 Christophe Lyon PR target/99542 -- cgit v1.1 From 57e274408c237c08d2f78722e3767651ef931170 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 18 Mar 2021 09:53:24 +0100 Subject: testsuite: Fix up pr98099.c testcase for big endian [PR98099] The testcase fails on big-endian without int128 support, because due to -fsso-struct=big-endian no swapping is needed for big endian. This patch restricts the testcase to big or little endian (but not pdp) and uses -fsso-struct=little-endian for big endian, so that it is swapping everywhere. 2021-03-18 Jakub Jelinek PR middle-end/98099 * gcc.dg/pr98099.c: Don't compile the test on pdp endian. For big endian use -fsso-struct=little-endian dg-options. --- gcc/testsuite/gcc.dg/pr98099.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/pr98099.c b/gcc/testsuite/gcc.dg/pr98099.c index 12e52f2..c78d43e 100644 --- a/gcc/testsuite/gcc.dg/pr98099.c +++ b/gcc/testsuite/gcc.dg/pr98099.c @@ -1,8 +1,9 @@ /* PR middle-end/98099 */ /* Reported by G. Steinmetz */ -/* { dg-do compile { target dfp } } */ -/* { dg-options "-fsso-struct=big-endian" } */ +/* { dg-do compile { target { dfp && { be || le } } } } */ +/* { dg-options "-fsso-struct=big-endian" { target le } } */ +/* { dg-options "-fsso-struct=little-endian" { target be } } */ struct S { _Decimal128 a; }; -- cgit v1.1 From 8f0c9d53ef3a9b8ba2579b53596cc2b7f5d8bf69 Mon Sep 17 00:00:00 2001 From: Kyrylo Tkachov Date: Thu, 18 Mar 2021 08:57:01 +0000 Subject: aarch64: Improve generic SVE tuning defaults This patch adds the recently-added tweak to split some SVE VL-based scalar operations [1] to the generic tuning used for SVE, as enabled by adding +sve to the -march flag, for example -march=armv8.2-a+sve. The recommendation for best performance on a particular CPU remains unchanged: use the -mcpu option for that CPU, where possible. -mcpu=native makes this straightforward for native compilation. The tweak to split out SVE VL-based scalar operations is a consistent win for the Neoverse V1 CPU and should be neutral for the Fujitsu A64FX. A run of SPEC2017 on A64FX with this tweak on didn't show any non-noise differences. It is also expected to be neutral on SVE2 implementations. Therefore, the patch enables the tweak for generic +sve tuning e.g. -march=armv8.2-a+sve. No SVE2 CPUs are expected to benefit from it, therefore the tweak is disabled for generic tuning when +sve2 is in -march e.g. -march=armv8.2-a+sve2. The implementation of this approach requires a bit of custom logic in aarch64_override_options_internal to handle these kinds of architecture-dependent decisions, but we do believe the user-facing principle here is important to implement. In general, for the generic target we're using a decision framework that looks like: * If all cores that are known to benefit from an optimization are of architecture X, and all other cores that implement X or above are not impacted, or have a very slight impact, we will consider it for generic tuning for architecture X. * We will not enable that optimisation for generic tuning for architecture X+1 if no known cores of architecture X+1 or above will benefit. This framework allows us to improve generic tuning for CPUs of generation X while avoiding accumulating tweaks for future CPUs of generation X+1, X+2... that do not need them, and thus avoid even the slight negative effects of these optimisations if the user is willing to tell us the desired architecture accurately. X above can mean either annual architecture updates (Armv8.2-a, Armv8.3-a etc) or optional architecture extensions (like SVE, SVE2). [1] http://gcc.gnu.org/g:a65b9ad863c5fc0aea12db58557f4d286a1974d7 gcc/ChangeLog: * config/aarch64/aarch64.c (aarch64_adjust_generic_arch_tuning): Define. (aarch64_override_options_internal): Use it. (generic_tunings): Add AARCH64_EXTRA_TUNE_CSE_SVE_VL_CONSTANTS to tune_flags. gcc/testsuite/ChangeLog: * g++.target/aarch64/sve/aarch64-sve.exp: Add -moverride=tune=none to sve_flags. * g++.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp: Likewise. * g++.target/aarch64/sve/acle/aarch64-sve-acle.exp: Likewise. * gcc.target/aarch64/sve/aarch64-sve.exp: Likewise. * gcc.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp: Likewise. * gcc.target/aarch64/sve/acle/aarch64-sve-acle.exp: Likewise. --- gcc/testsuite/g++.target/aarch64/sve/aarch64-sve.exp | 4 ++++ gcc/testsuite/g++.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp | 4 ++++ gcc/testsuite/g++.target/aarch64/sve/acle/aarch64-sve-acle.exp | 4 ++++ gcc/testsuite/gcc.target/aarch64/sve/aarch64-sve.exp | 4 ++++ gcc/testsuite/gcc.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp | 4 ++++ gcc/testsuite/gcc.target/aarch64/sve/acle/aarch64-sve-acle.exp | 4 ++++ 6 files changed, 24 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.target/aarch64/sve/aarch64-sve.exp b/gcc/testsuite/g++.target/aarch64/sve/aarch64-sve.exp index 4bbe2f5..d4761f2 100644 --- a/gcc/testsuite/g++.target/aarch64/sve/aarch64-sve.exp +++ b/gcc/testsuite/g++.target/aarch64/sve/aarch64-sve.exp @@ -38,6 +38,10 @@ if { [check_effective_target_aarch64_sve] } { set sve_flags "-march=armv8.2-a+sve" } +# Turn off any codegen tweaks by default that may affect expected assembly. +# Tests relying on those should turn them on explicitly. +set sve_flags "$sve_flags -moverride=tune=none" + # Main loop. dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.C]] $sve_flags "" diff --git a/gcc/testsuite/g++.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp b/gcc/testsuite/g++.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp index 0734268..84ae95e 100644 --- a/gcc/testsuite/g++.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp +++ b/gcc/testsuite/g++.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp @@ -37,6 +37,10 @@ if { [check_effective_target_aarch64_sve] } { set sve_flags "-march=armv8.2-a+sve" } +# Turn off any codegen tweaks by default that may affect expected assembly. +# Tests relying on those should turn them on explicitly. +set sve_flags "$sve_flags -moverride=tune=none" + global gcc_runtest_parallelize_limit_minor if { [info exists gcc_runtest_parallelize_limit_minor] } { set old_limit_minor $gcc_runtest_parallelize_limit_minor diff --git a/gcc/testsuite/g++.target/aarch64/sve/acle/aarch64-sve-acle.exp b/gcc/testsuite/g++.target/aarch64/sve/acle/aarch64-sve-acle.exp index cb9de75..8d3d8b4 100644 --- a/gcc/testsuite/g++.target/aarch64/sve/acle/aarch64-sve-acle.exp +++ b/gcc/testsuite/g++.target/aarch64/sve/acle/aarch64-sve-acle.exp @@ -44,6 +44,10 @@ if { [check_effective_target_aarch64_sve] } { set sve_flags "-march=armv8.2-a+sve" } +# Turn off any codegen tweaks by default that may affect expected assembly. +# Tests relying on those should turn them on explicitly. +set sve_flags "$sve_flags -moverride=tune=none" + # Main loop. set gcc_subdir [string replace $subdir 0 2 gcc] set files [glob -nocomplain \ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/aarch64-sve.exp b/gcc/testsuite/gcc.target/aarch64/sve/aarch64-sve.exp index 622fc92..1d3f566 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/aarch64-sve.exp +++ b/gcc/testsuite/gcc.target/aarch64/sve/aarch64-sve.exp @@ -44,6 +44,10 @@ if { [check_effective_target_aarch64_sve] } { set sve_flags "-march=armv8.2-a+sve" } +# Turn off any codegen tweaks by default that may affect expected assembly. +# Tests relying on those should turn them on explicitly. +set sve_flags "$sve_flags -moverride=tune=none" + # Most of the code-quality tests are written for LP64. Just do the # correctness tests for ILP32. if { [check_effective_target_ilp32] } { diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp b/gcc/testsuite/gcc.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp index 6146e65..fcd07aa 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp @@ -37,6 +37,10 @@ if { [check_effective_target_aarch64_sve] } { set sve_flags "-march=armv8.2-a+sve" } +# Turn off any codegen tweaks by default that may affect expected assembly. +# Tests relying on those should turn them on explicitly. +set sve_flags "$sve_flags -moverride=tune=none" + global gcc_runtest_parallelize_limit_minor if { [info exists gcc_runtest_parallelize_limit_minor] } { set old_limit_minor $gcc_runtest_parallelize_limit_minor diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/aarch64-sve-acle.exp b/gcc/testsuite/gcc.target/aarch64/sve/acle/aarch64-sve-acle.exp index a33b65a..2f36f1c 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/aarch64-sve-acle.exp +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/aarch64-sve-acle.exp @@ -44,6 +44,10 @@ if { [check_effective_target_aarch64_sve] } { set sve_flags "-march=armv8.2-a+sve" } +# Turn off any codegen tweaks by default that may affect expected assembly. +# Tests relying on those should turn them on explicitly. +set sve_flags "$sve_flags -moverride=tune=none" + # Main loop. set files [glob -nocomplain \ "$srcdir/$subdir/general/*.c" \ -- cgit v1.1 From 0cc218d42c241ed286cc5af9fb7d2e45386f7a24 Mon Sep 17 00:00:00 2001 From: Iain Sandoe Date: Fri, 26 Feb 2021 10:21:02 +0000 Subject: Objective-C++ : Fix handling of unnamed message parms [PR49070]. When we are parsing an Objective-C++ message, a colon is a valid terminator for a assignment-expression. That is: [receiver meth:x:x:x:x]; Is a valid, if somewhat unreadable, construction; corresponding to a method declaration like: - (id) meth:(id)arg0 :(id)arg1 :(id)arg2 :(id)arg3; Where three of the message params have no selector name. If fact, although it might be unintentional, Objective-C/C++ can accept message selectors with all the parms unnamed (this applies to the clang implementation too, which is taken as the reference for the language). For regular C++, the pattern x:x is not valid in that position an an error is emitted with a fixit for the expected scope token. If we simply made that error conditional on !c_dialect_objc() that would regress Objective-C++ diagnostics for cases outside a message selector, so we add a state flag for this. gcc/cp/ChangeLog: PR objc++/49070 * parser.c (cp_debug_parser): Add Objective-C++ message state flag. (cp_parser_nested_name_specifier_opt): Allow colon to terminate an assignment-expression when parsing Objective- C++ messages. (cp_parser_objc_message_expression): Set and clear message parsing state on entry and exit. * parser.h (struct cp_parser): Add a context flag for Objective-C++ message state. gcc/testsuite/ChangeLog: PR objc++/49070 * obj-c++.dg/pr49070.mm: New test. * objc.dg/unnamed-parms.m: New test. --- gcc/testsuite/obj-c++.dg/pr49070.mm | 52 +++++++++++++++++++++++++++++++++++ gcc/testsuite/objc.dg/unnamed-parms.m | 28 +++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 gcc/testsuite/obj-c++.dg/pr49070.mm create mode 100644 gcc/testsuite/objc.dg/unnamed-parms.m (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/obj-c++.dg/pr49070.mm b/gcc/testsuite/obj-c++.dg/pr49070.mm new file mode 100644 index 0000000..d67c721 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/pr49070.mm @@ -0,0 +1,52 @@ +/* Only needs to compile. */ +/* { dg-additional-options "-std=c++11" } */ + +#ifdef __cplusplus +enum X { + x = 5, + y +}; +#endif + +__attribute__((__objc_root_class__)) +@interface A +- (id) :(id)arg0 :(id)arg1; +- (id) m:(id)arg0 :(id)arg1 :(id)arg2 :(id)arg3; +#ifdef __cplusplus +- (id) n:(X)arg0 :(X)arg1 :(id)arg2 :(id)arg3; +#endif +@end + +@implementation A +- (id) :(id)arg0 :(id)arg1 +{ + return arg1; +} +- (id) m:(id)arg0 :(id)arg1 :(id)arg2 :(id)arg3 +{ + return arg2; +} +#ifdef __cplusplus +- (id) n:(X)arg0 :(X)arg1 :(id)arg2 :(id)arg3 +{ + return arg2; +} +#endif +@end + +id f1 (A *x) +{ + return [x:x:x]; +} + +id f2 (A *x) +{ + return [x m:x:x:x:x]; +} + +#ifdef __cplusplus +id f3 (A *x) +{ + return [x n:X::x:X::y:x:x]; +} +#endif diff --git a/gcc/testsuite/objc.dg/unnamed-parms.m b/gcc/testsuite/objc.dg/unnamed-parms.m new file mode 100644 index 0000000..22426cf --- /dev/null +++ b/gcc/testsuite/objc.dg/unnamed-parms.m @@ -0,0 +1,28 @@ +/* Only needs to compile [see PR 49070 for C++ issue]. */ + +__attribute__((__objc_root_class__)) +@interface A +- (id) :(id)arg0 :(id)arg1; +- (id) m:(id)arg0 :(id)arg1 :(id)arg2 :(id)arg3; +@end + +@implementation A +- (id) :(id)arg0 :(id)arg1 +{ + return arg1; +} +- (id) m:(id)arg0 :(id)arg1 :(id)arg2 :(id)arg3 +{ + return arg2; +} +@end + +id f1 (A *x) +{ + return [x:x:x]; +} + +id f2 (A *x) +{ + return [x m:x:x:x:x]; +} -- cgit v1.1 From 0211fbb610c19d728c68a0c6c603826059ea9af9 Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Thu, 18 Mar 2021 09:58:52 +0000 Subject: testsuite: Skip c-c++-common/zero-scratch-regs-10.c on arm As discussed in PR 97680, -fzero-call-used-regs is not supported on arm. Skip this test to avoid failure reports. 2021-03-18 Christophe Lyon gcc/testsuite/ PR testsuite/97680 * c-c++-common/zero-scratch-regs-10.c: Skip on arm --- gcc/testsuite/c-c++-common/zero-scratch-regs-10.c | 1 + 1 file changed, 1 insertion(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/c-c++-common/zero-scratch-regs-10.c b/gcc/testsuite/c-c++-common/zero-scratch-regs-10.c index 193db8c..f393a3b 100644 --- a/gcc/testsuite/c-c++-common/zero-scratch-regs-10.c +++ b/gcc/testsuite/c-c++-common/zero-scratch-regs-10.c @@ -1,5 +1,6 @@ /* { dg-do run } */ /* { dg-skip-if "not implemented" { powerpc*-*-* } } */ +/* { dg-skip-if "not implemented" { arm*-*-* } } */ /* { dg-options "-O2" } */ #include -- cgit v1.1 From fff9faa79043aa53d361e7f6e31b2680007a97e2 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 18 Mar 2021 16:11:46 +0100 Subject: testsuite: Fix up strlenopt-73.c on powerpc [PR99626] As mentioned in the testcase as well as in the PR, this testcase relies on MOVE_MAX being sufficiently large that the memcpy call is folded early into load + store. Some popular targets define MOVE_MAX to 8 or even 16 (e.g. x86_64 or some options on s390x), but many other targets define it to just 4 (e.g. powerpc 32-bit), or even 2. The testcase has already one test routine guarded on one particular target with MOVE_MAX 16 (but does it incorrectly, __i386__ is only defined on 32-bit x86 and __SIZEOF_INT128__ is only defined on 64-bit targets), this patch fixes that, and guards another test that relies on memcpy (, , 8) being folded that way (which therefore needs MOVE_MAX >= 8) on a couple of common targets that are known to have such MOVE_MAX. 2021-03-18 Jakub Jelinek PR testsuite/99626 * gcc.dg/strlenopt-73.c: Ifdef out test_copy_cond_unequal_length_i64 on targets other than x86, aarch64, s390 and 64-bit powerpc. Use test_copy_cond_unequal_length_i128 for __x86_64__ with int128 support rather than __i386__. --- gcc/testsuite/gcc.dg/strlenopt-73.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/strlenopt-73.c b/gcc/testsuite/gcc.dg/strlenopt-73.c index 6523949..170b66a 100644 --- a/gcc/testsuite/gcc.dg/strlenopt-73.c +++ b/gcc/testsuite/gcc.dg/strlenopt-73.c @@ -69,6 +69,13 @@ void test_copy_cond_equal_length (void) T ( 0 ==, 33, 1, (i0 ? a32 : b32) + 32); } +#if defined(__i386__) || defined(__x86_64__) || defined(__aarch64__) \ + || defined(__s390__) || defined(__powerpc64__) + +/* The following tests assume GCC transforms the memcpy calls into + long long assignments which it does only on targets that define + the MOVE_MAX macro to 8 or higher. Enable on a set of targets + known to do that. */ const char a4[16] = "0123"; const char b4[16] = "3210"; @@ -84,12 +91,14 @@ void test_copy_cond_unequal_length_i64 (void) T (0 <, 16, 8, i0 ? a4 + 2 : b4 + 3); } +#endif + -#if __i386__ && __SIZEOF_INT128__ == 16 +#if defined(__x86_64__) && __SIZEOF_INT128__ == 16 /* The following tests assume GCC transforms the memcpy calls into int128_t assignments which it does only on targets that define - the MOVE_MAX macro to 16. That's only s390 and i386 with + the MOVE_MAX macro to 16. That's only s390 and x86_64 with int128_t support. */ const char a8[32] = "01234567"; -- cgit v1.1 From 89d44a9f3b9ab97634b7ef894e2c83ebd83582a8 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 18 Mar 2021 16:14:47 +0100 Subject: testsuite: Fix up strlenopt-80.c on powerpc [PR99636] Similar issue as in strlenopt-73.c, various spots in this test rely on MOVE_MAX >= 8, this time it uses a target selector to pick up a couple of targets, and all of them but powerpc 32-bit satisfy it, but powerpc 32-bit have MOVE_MAX just 4. 2021-03-18 Jakub Jelinek PR testsuite/99636 * gcc.dg/strlenopt-80.c: For powerpc*-*-*, only enable for lp64. --- gcc/testsuite/gcc.dg/strlenopt-80.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/strlenopt-80.c b/gcc/testsuite/gcc.dg/strlenopt-80.c index 9124fe4..a853402 100644 --- a/gcc/testsuite/gcc.dg/strlenopt-80.c +++ b/gcc/testsuite/gcc.dg/strlenopt-80.c @@ -3,7 +3,7 @@ The optimization is only implemented for MEM_REF stores and other targets than those below may not transform the memcpy call into such a store. - { dg-do compile { target aarch64*-*-* i?86-*-* powerpc*-*-* x86_64-*-* } } + { dg-do compile { target { { aarch64*-*-* i?86-*-* x86_64-*-* } || { { powerpc*-*-* } && lp64 } } } } { dg-options "-O2 -Wall -fdump-tree-optimized" } */ -- cgit v1.1 From 30b10dacd0a8c926c22eab7d4aeb52ff86534acf Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Thu, 18 Mar 2021 13:36:09 -0600 Subject: PR middle-end/99502 - missing -Warray-bounds on partial out of bounds gcc/ChangeLog: PR middle-end/99502 * gimple-array-bounds.cc (inbounds_vbase_memaccess_p): Rename... (inbounds_memaccess_p): ...to this. Check the ending offset of the accessed member. gcc/testsuite/ChangeLog: PR middle-end/99502 * g++.dg/warn/Warray-bounds-22.C: New test. * g++.dg/warn/Warray-bounds-23.C: New test. * g++.dg/warn/Warray-bounds-24.C: New test. --- gcc/testsuite/g++.dg/warn/Warray-bounds-22.C | 105 ++++++++ gcc/testsuite/g++.dg/warn/Warray-bounds-23.C | 345 +++++++++++++++++++++++++++ gcc/testsuite/g++.dg/warn/Warray-bounds-24.C | 289 ++++++++++++++++++++++ 3 files changed, 739 insertions(+) create mode 100644 gcc/testsuite/g++.dg/warn/Warray-bounds-22.C create mode 100644 gcc/testsuite/g++.dg/warn/Warray-bounds-23.C create mode 100644 gcc/testsuite/g++.dg/warn/Warray-bounds-24.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/warn/Warray-bounds-22.C b/gcc/testsuite/g++.dg/warn/Warray-bounds-22.C new file mode 100644 index 0000000..77cdb5e --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Warray-bounds-22.C @@ -0,0 +1,105 @@ +/* PR middle-end/99502 - missing -Warray-bounds on partial out of bounds + access in C++ + { dg-do compile } + { dg-options "-O2 -Wall" } */ + +typedef __INT8_TYPE__ int8_t; +typedef __INT16_TYPE__ int16_t; +typedef __INT32_TYPE__ int32_t; + +struct POD32 +{ + int32_t i32; +}; + +int8_t a16[2]; +int8_t apod32[sizeof (POD32)]; + +void nowarn_pod32_assign () +{ + POD32 *p = (POD32*)apod32; + *p = POD32 (); +} + +void nowarn_pod32_assign_member () +{ + POD32 *p = (POD32*)apod32; + p->i32 = __LINE__; +} + + +void warn_pod32_assign () +{ + POD32 *p = (POD32*)a16; + *p = POD32 (); // { dg-warning "-Warray-bounds" } +} + +void warn_pod32_assign_member () +{ + POD32 *p = (POD32*)a16; + p->i32 = __LINE__; // { dg-warning "-Warray-bounds" } +} + + +struct BV32 // { dg-warning "-Warray-bounds" "due to pr99525" } +{ + int32_t i32; + + virtual ~BV32 (); +}; + +int8_t abv32[sizeof (BV32)]; + +void nowarn_bv32_assign () +{ + BV32 *p = (BV32*)abv32; + *p = BV32 (); +} + +void nowarn_bv32_assign_member () +{ + BV32 *p = (BV32*)abv32; + p->i32 = __LINE__; +} + +void warn_bv32_assign () +{ + BV32 *p = (BV32*)a16; + *p = BV32 (); // { dg-warning "-Warray-bounds" "pr99525" { xfail *-*-* } } +} + +void warn_bv32_assign_member () +{ + BV32 *p = (BV32*)a16; + p->i32 = __LINE__; // { dg-warning "-Warray-bounds" } +} + + +struct DV32: virtual BV32 { }; + +int8_t adv32[sizeof (DV32)]; +int8_t adv32_m1[sizeof adv32 - 1]; + +void nowarn_dv32_assign () +{ + DV32 *p = (DV32*)adv32; + *p = DV32 (); +} + +void nowarn_dv32_assign_member () +{ + DV32 *p = (DV32*)adv32; + p->i32 = __LINE__; +} + +void warn_dv32_assign () +{ + DV32 *p = (DV32*)adv32_m1; + *p = DV32 (); // { dg-warning "-Warray-bounds" "pr?????" { xfail *-*-* } } +} + +void warn_dv32_assign_member () +{ + DV32 *p = (DV32*)adv32_m1; + p->i32 = __LINE__; // { dg-warning "-Warray-bounds" "pr?????" { xfail *-*-* } } +} diff --git a/gcc/testsuite/g++.dg/warn/Warray-bounds-23.C b/gcc/testsuite/g++.dg/warn/Warray-bounds-23.C new file mode 100644 index 0000000..c43a7de --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Warray-bounds-23.C @@ -0,0 +1,345 @@ +/* PR middle-end/99502 - missing -Warray-bounds on partial out of bounds + access in C++ + { dg-do compile } + { dg-options "-O2 -Wall" } */ + +inline void* operator new (__SIZE_TYPE__, void *p) { return p; } + +struct B0 { int b0i; }; +struct B1: virtual B0 { int b1i; }; +struct B2: virtual B0 { int b2i; }; +struct D1: B1, B2 { int d1i; }; +struct D2: D1 { int d2i; }; +struct D3: D2 { long d3i, d3ax[]; }; + +void sink (void*); + + +void test_D1 () +{ + { + char *p = new char[sizeof (D1)]; + new (p) D1 (); + sink (p); + } + + { + char *p = new char[sizeof (D1) - 1]; + new (p) D1 (); // { dg-warning "-Warray-bounds" } + sink (p); + } +} + +void test_D1_b0i () +{ + { + D1 *p = (D1*)new char[sizeof (D1)]; + p->b0i = __LINE__; + sink (p); + } + + { + D1 *p = (D1*)new char[3]; + p->b0i = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } +} + +void test_D1_b1i () +{ + { + D1 *p = (D1*)new char[sizeof (D1)]; + p->b1i = __LINE__; + sink (p); + } + + { + D1 *p = (D1*)new char[3]; + p->b1i = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } +} + +void test_D1_b2i () +{ + { + D1 *p = (D1*)new char[sizeof (D1)]; + p->b2i = __LINE__; + sink (p); + } + + { + D1 *p = (D1*)new char[3]; + p->b2i = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } +} + +void test_D1_d1i () +{ + { + D1 *p = (D1*)new char[sizeof (D1)]; + p->d1i = __LINE__; + sink (p); + } + + { + D1 *p = (D1*)new char[3]; + p->d1i = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } +} + + +void test_D2 () +{ + { + char *p = new char[sizeof (D2)]; + new (p) D2 (); + sink (p); + } + + { + char *p = new char[sizeof (D2) - 1]; + new (p) D2 (); // { dg-warning "-Warray-bounds" } + sink (p); + } +} + +void test_D2_b0i () +{ + { + D2 *p = (D2*)new char[sizeof (D2)]; + p->b0i = __LINE__; + sink (p); + } + + { + D2 *p = (D2*)new char[3]; + p->b0i = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } +} + +void test_D2_b1i () +{ + { + D2 *p = (D2*)new char[sizeof (D2)]; + p->b1i = __LINE__; + sink (p); + } + + { + D2 *p = (D2*)new char[3]; + p->b1i = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } +} + +void test_D2_b2i () +{ + { + D2 *p = (D2*)new char[sizeof (D2)]; + p->b2i = __LINE__; + sink (p); + } + + { + D2 *p = (D2*)new char[3]; + p->b2i = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } +} + +void test_D2_d1i () +{ + { + D2 *p = (D2*)new char[sizeof (D2)]; + p->d1i = __LINE__; + sink (p); + } + + { + D2 *p = (D2*)new char[3]; + p->d1i = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } +} + +void test_D2_d2i () +{ + { + D2 *p = (D2*)new char[sizeof (D2)]; + p->d2i = __LINE__; + sink (p); + } + + { + D2 *p = (D2*)new char[3]; + p->d2i = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } +} + + +void test_D3 () +{ + { + char *p = new char[sizeof (D3)]; + new (p) D3 (); + sink (p); + } + + { + char *p = new char[sizeof (D3) - 1]; + new (p) D3 (); // { dg-warning "-Warray-bounds" } + sink (p); + } +} + +void test_D3_b0i () +{ + { + D3 *p = (D3*)new char[sizeof (D3)]; + p->b0i = __LINE__; + sink (p); + } + + { + D3 *p = (D3*)new char[3]; + p->b0i = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } +} + +void test_D3_b1i () +{ + { + D3 *p = (D3*)new char[sizeof (D3)]; + p->b1i = __LINE__; + sink (p); + } + + { + D3 *p = (D3*)new char[3]; + p->b1i = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } +} + +void test_D3_b2i () +{ + { + D3 *p = (D3*)new char[sizeof (D3)]; + p->b2i = __LINE__; + sink (p); + } + + { + D3 *p = (D3*)new char[3]; + p->b2i = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } +} + +void test_D3_d1i () +{ + { + D3 *p = (D3*)new char[sizeof (D3)]; + p->d1i = __LINE__; + sink (p); + } + + { + D3 *p = (D3*)new char[3]; + p->d1i = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } +} + +void test_D3_d2i () +{ + { + D3 *p = (D3*)new char[sizeof (D3)]; + p->d2i = __LINE__; + sink (p); + } + + { + D3 *p = (D3*)new char[3]; + p->d2i = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } +} + +void test_D3_d3i () +{ + { + D3 *p = (D3*)new char[sizeof (D3)]; + p->d3i = __LINE__; + sink (p); + } + + { + D3 *p = (D3*)new char[3]; + p->d3i = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } +} + +void test_D3_d3ax () +{ + { + D3 *p = (D3*)new char[sizeof (D3)]; + *p->d3ax = __LINE__; // { dg-warning "-Warray-bounds" "pr?????" { xfail *-*-* } } + p->d3ax[9] = __LINE__; // { dg-warning "-Warray-bounds" "pr?????" { xfail *-*-* } } + sink (p); + } + + { + D3 *p = (D3*)new char[sizeof (D3) + sizeof (D3::d3ax[0])]; + p->d3ax[0] = __LINE__; + p->d3ax[1] = __LINE__; // { dg-warning "-Warray-bounds" "pr?????" { xfail *-*-* } } + sink (p); + } + + { + D3 *p = (D3*)new char[3]; + *p->d3ax = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } +} + +struct D4: D2 +{ + // D4:d4a0 overlaps with B0:b0i! + long d4i, d4a0[0]; +}; + +void test_D4_d3a0 () +{ + { + D4 *p = (D4*)new char[sizeof (D4)]; + *p->d4a0 = __LINE__; // { dg-warning "-Warray-bounds" } + p->d4a0[1] = __LINE__; // { dg-warning "-Warray-bounds" } + p->d4a0[9] = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } + + { + D4 *p = (D4*)new char[sizeof (D4) + sizeof (D4::d4a0[0])]; + /* The access to d4a0[0] should get a -Wzero-length-bounds because + it's in bounds but overlaps p->b0i. */ + p->d4a0[0] = __LINE__; // { dg-warning "-Wzero-length-bounds" "pr99635" { xfail *-*-* } } + // { dg-warning "-Warray-bounds" "actual" { target *-*-* } .-1 } + p->d4a0[1] = __LINE__; // { dg-warning "-Warray-bounds" } + p->d4a0[9] = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } + + { + D4 *p = (D4*)new char[3]; + *p->d4a0 = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } +} diff --git a/gcc/testsuite/g++.dg/warn/Warray-bounds-24.C b/gcc/testsuite/g++.dg/warn/Warray-bounds-24.C new file mode 100644 index 0000000..071453a --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Warray-bounds-24.C @@ -0,0 +1,289 @@ +/* PR middle-end/99502 - missing -Warray-bounds on partial out of bounds + access in C++ + { dg-do compile } + { dg-options "-O2 -Wall" } */ + +inline void* operator new (__SIZE_TYPE__, void *p) { return p; } + +struct B0 { int b0i, b0a[0]; }; +struct B1: virtual B0 { int b1i, b1a[0]; }; +struct B2: virtual B0 { int b2i, b2a[0]; }; +struct D1: B1, B2 { int d1i, d1a[0]; }; +struct D2: D1 { int d2i, d2a[0]; }; +struct D3: D2 { int d3i, d3a[0]; }; + +void sink (void*); + + +void test_D1 () +{ + { + char *p = new char[sizeof (D1)]; + new (p) D1 (); + sink (p); + } + + { + char *p = new char[sizeof (D1) - 1]; + new (p) D1 (); // { dg-warning "-Warray-bounds" } + sink (p); + } +} + +void test_D1_b0a () +{ + { + D1 *p = (D1*)new char[sizeof (D1)]; + *p->b0a = __LINE__; // { dg-warning "-Warray-bounds" "pr99630" { xfail *-*-* } } + sink (p); + } + + { + D1 *p = (D1*)new char[3]; + *p->b0a = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } +} + +void test_D1_b1a () +{ + { + D1 *p = (D1*)new char[sizeof (D1)]; + *p->b1a = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } + + { + D1 *p = (D1*)new char[3]; + *p->b1a = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } +} + +void test_D1_b2a () +{ + { + D1 *p = (D1*)new char[sizeof (D1)]; + *p->b2a = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } + + { + D1 *p = (D1*)new char[3]; + *p->b2a = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } +} + +void test_D1_d1a () +{ + { + D1 *p = (D1*)new char[sizeof (D1)]; + *p->d1a = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } + + { + D1 *p = (D1*)new char[3]; + *p->d1a = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } +} + + +void test_D2 () +{ + { + char *p = new char[sizeof (D2)]; + new (p) D2 (); + sink (p); + } + + { + char *p = new char[sizeof (D2) - 1]; + new (p) D2 (); // { dg-warning "-Warray-bounds" } + sink (p); + } +} + +void test_D2_b0a () +{ + { + D2 *p = (D2*)new char[sizeof (D2)]; + *p->b0a = __LINE__; // { dg-warning "-Warray-bounds" "pr99630" { xfail *-*-* } } + sink (p); + } + + { + D2 *p = (D2*)new char[3]; + *p->b0a = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } +} + +void test_D2_b1a () +{ + { + D2 *p = (D2*)new char[sizeof (D2)]; + *p->b1a = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } + + { + D2 *p = (D2*)new char[3]; + *p->b1a = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } +} + +void test_D2_b2a () +{ + { + D2 *p = (D2*)new char[sizeof (D2)]; + *p->b2a = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } + + { + D2 *p = (D2*)new char[3]; + *p->b2a = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } +} + +void test_D2_d1a () +{ + { + D2 *p = (D2*)new char[sizeof (D2)]; + *p->d1a = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } + + { + D2 *p = (D2*)new char[3]; + *p->d1a = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } +} + +void test_D2_d2a () +{ + { + D2 *p = (D2*)new char[sizeof (D2)]; + *p->d2a = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } + + { + D2 *p = (D2*)new char[3]; + *p->d2a = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } +} + + +void test_D3 () +{ + { + char *p = new char[sizeof (D3)]; + new (p) D3 (); + sink (p); + } + + { + char *p = new char[sizeof (D3) - 1]; + new (p) D3 (); // { dg-warning "-Warray-bounds" } + sink (p); + } +} + +void test_D3_b0a () +{ + { + D3 *p = (D3*)new char[sizeof (D3)]; + *p->b0a = __LINE__; // { dg-warning "-Warray-bounds" "pr99630" { xfail *-*-* } } + sink (p); + } + + { + D3 *p = (D3*)new char[3]; + *p->b0a = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } +} + +void test_D3_b1a () +{ + { + D3 *p = (D3*)new char[sizeof (D3)]; + *p->b1a = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } + + { + D3 *p = (D3*)new char[3]; + *p->b1a = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } +} + +void test_D3_b2a () +{ + { + D3 *p = (D3*)new char[sizeof (D3)]; + *p->b2a = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } + + { + D3 *p = (D3*)new char[3]; + *p->b2a = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } +} + +void test_D3_d1a () +{ + { + D3 *p = (D3*)new char[sizeof (D3)]; + *p->d1a = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } + + { + D3 *p = (D3*)new char[3]; + *p->d1a = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } +} + +void test_D3_d2a () +{ + { + D3 *p = (D3*)new char[sizeof (D3)]; + *p->d2a = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } + + { + D3 *p = (D3*)new char[3]; + *p->d2a = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } +} + +void test_D3_d3a () +{ + { + D3 *p = (D3*)new char[sizeof (D3)]; + *p->d3a = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } + + { + D3 *p = (D3*)new char[3]; + *p->d3a = __LINE__; // { dg-warning "-Warray-bounds" } + sink (p); + } +} + -- cgit v1.1 From bd9b262fa9243e08fefa4973f08d1f09f6694ba0 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Tue, 9 Mar 2021 20:55:14 -0500 Subject: c++: Fix error-recovery with requires expression [PR99500] This fixes an ICE on invalid code where one of the parameters was error_mark_node and thus resetting its DECL_CONTEXT crashed. gcc/cp/ChangeLog: PR c++/99500 * parser.c (cp_parser_requirement_parameter_list): Handle error_mark_node. gcc/testsuite/ChangeLog: PR c++/99500 * g++.dg/cpp2a/concepts-err3.C: New test. --- gcc/testsuite/g++.dg/cpp2a/concepts-err3.C | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp2a/concepts-err3.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-err3.C b/gcc/testsuite/g++.dg/cpp2a/concepts-err3.C new file mode 100644 index 0000000..9427fd5c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/concepts-err3.C @@ -0,0 +1,4 @@ +// PR c++/99500 +// { dg-do compile { target c++20 } } + +bool b = requires (bool a, int a) { requires true; }; // { dg-error "conflicting declaration" } -- cgit v1.1 From 287e3e8466f44f9d395a2e4dcfcda56cc34ceb1c Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 19 Mar 2021 00:16:26 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 52 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 55b41de..488c0cb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,55 @@ +2021-03-19 Marek Polacek + + PR c++/99500 + * g++.dg/cpp2a/concepts-err3.C: New test. + +2021-03-18 Martin Sebor + + PR middle-end/99502 + * g++.dg/warn/Warray-bounds-22.C: New test. + * g++.dg/warn/Warray-bounds-23.C: New test. + * g++.dg/warn/Warray-bounds-24.C: New test. + +2021-03-18 Jakub Jelinek + + PR testsuite/99636 + * gcc.dg/strlenopt-80.c: For powerpc*-*-*, only enable for lp64. + +2021-03-18 Jakub Jelinek + + PR testsuite/99626 + * gcc.dg/strlenopt-73.c: Ifdef out test_copy_cond_unequal_length_i64 + on targets other than x86, aarch64, s390 and 64-bit powerpc. Use + test_copy_cond_unequal_length_i128 for __x86_64__ with int128 support + rather than __i386__. + +2021-03-18 Christophe Lyon + + PR testsuite/97680 + * c-c++-common/zero-scratch-regs-10.c: Skip on arm + +2021-03-18 Iain Sandoe + + PR objc++/49070 + * obj-c++.dg/pr49070.mm: New test. + * objc.dg/unnamed-parms.m: New test. + +2021-03-18 Kyrylo Tkachov + + * g++.target/aarch64/sve/aarch64-sve.exp: Add -moverride=tune=none to + sve_flags. + * g++.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp: Likewise. + * g++.target/aarch64/sve/acle/aarch64-sve-acle.exp: Likewise. + * gcc.target/aarch64/sve/aarch64-sve.exp: Likewise. + * gcc.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp: Likewise. + * gcc.target/aarch64/sve/acle/aarch64-sve-acle.exp: Likewise. + +2021-03-18 Jakub Jelinek + + PR middle-end/98099 + * gcc.dg/pr98099.c: Don't compile the test on pdp endian. + For big endian use -fsso-struct=little-endian dg-options. + 2021-03-17 Marek Polacek PR c++/97973 -- cgit v1.1 From af73a8b2027d9ab64944d7dbbb48e207d7790ce6 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Fri, 19 Mar 2021 09:23:28 +0100 Subject: Require linker plugin for another LTO test If it is not present, fat LTO is generated with an additional warning. gcc/testsuite/ * g++.dg/lto/pr89335_0.C: Require the linker plugin. --- gcc/testsuite/g++.dg/lto/pr89335_0.C | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/lto/pr89335_0.C b/gcc/testsuite/g++.dg/lto/pr89335_0.C index df2d2ba..95bf4b3 100644 --- a/gcc/testsuite/g++.dg/lto/pr89335_0.C +++ b/gcc/testsuite/g++.dg/lto/pr89335_0.C @@ -1,15 +1,20 @@ // { dg-lto-do link } -// { dg-lto-options {{-O2 -flto -Wsuggest-final-methods}} } +// { dg-lto-options { {-O2 -flto -Wsuggest-final-methods}} } // { dg-extra-ld-options "-r -nostdlib -flinker-output=nolto-rel" } +// { dg-require-linker-plugin "" } + class Container { public: virtual ~Container (); }; + class List : public Container // { dg-lto-message "final would enable devirtualization" } { }; + static List cache[256]; + int main (void) { return 0; -- cgit v1.1 From 009528d61c796608affd1eaa18ae31a3679eb46d Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 19 Mar 2021 13:48:44 +0100 Subject: arm: Fix mve_vshlq* [PR99593] As mentioned in the PR, before the r11-6708-gbfab355012ca0f5219da8beb04f2fdaf757d34b7 change v[al]shr3 expanders were expanding the shifts by register to gen_ashl3_{,un}signed which don't support immediate CONST_VECTOR shift amounts, but now expand to mve_vshlq_ which does. The testcase ICEs, because the constraint doesn't match the predicate and because LRA works solely with the constraints, so it can e.g. from REG_EQUAL propagate there a CONST_VECTOR which matches the constraint but fails the predicate and only later on other passes will notice the predicate fails and ICE. Fixed by adding a constraint that matches the immediate part of the predicate. PR target/99593 * config/arm/constraints.md (Ds): New constraint. * config/arm/vec-common.md (mve_vshlq_): Use w,Ds constraint instead of w,Dm. * g++.target/arm/pr99593.C: New test. --- gcc/testsuite/g++.target/arm/pr99593.C | 129 +++++++++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 gcc/testsuite/g++.target/arm/pr99593.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.target/arm/pr99593.C b/gcc/testsuite/g++.target/arm/pr99593.C new file mode 100644 index 0000000..ba2bb98 --- /dev/null +++ b/gcc/testsuite/g++.target/arm/pr99593.C @@ -0,0 +1,129 @@ +/* { dg-do compile } */ +/* { dg-options "-std=c++17 -O2 -mfloat-abi=hard -mcpu=generic-armv7-a" } */ +// { dg-require-effective-target arm_hard_ok } +// { dg-require-effective-target arm_neon_ok } +// { dg-add-options arm_neon } + +#include + +typedef uint16x4_t e; +typedef int16x4_t f; +typedef int32x4_t g; +typedef float32x4_t h; +typedef uint32x4_t i; +g j, p; +g k(int l) { return vdupq_n_s32(l); } +i n(f l) { return (i)vmovl_u16((e)l); } +template struct q; +template q operator<(aa s, q t) { + return q(s) < t; +} +template q ad(const q &); +typedef q<4, int> ae; +template <> class q<4, float> { + public: + q(h af) : ag(af) {} + q(float) {} + static q ah(void *ai) { + float *l = (float *)ai; + return vld1q_f32(l); + } + q operator+(q o) { + h l = ag, m = o.ag; + return vaddq_f32(l, m); + } + q operator*(q) { + h l = ag, m; + return vmulq_f32(l, m); + } + h ag; +}; +template <> class q<4, unsigned short> { + public: + q(f af) : ag(af) {} + static q ah(void *ai) { + unsigned short *l = (unsigned short *)ai; + return (f)vld1_s16((int16_t *)l); + } + void aj() { + f m = ag; + vst1_u16(0, (e)m); + } + f ag; +}; +template <> class q<4, int> { + public: + q(g af) : ag(af) {} + q(int u) { ag = k(u); } + static q ah(void *ai) { + int32_t *l = (int32_t *)ai; + return vld1q_s32(l); + } + q operator&(q o) { + g v = ag & o.ag; + return v; + } + q operator|(q o) { + g w = ag | o.ag; + return w; + } + q operator^(q) { + g x = ag ^ p; + return x; + } + q operator>>(int ak) { return ag >> q(ak).ag; } + q operator<(q) { + g y, z = j < ag; + y = (g)z; + return y; + } + g ag; +}; +template <> ae ad(const q<4, unsigned short> &al) { return g(n(al.ag)); } +template <> q<4, unsigned short> ad(const ae &al) { + i l(i(al.ag)); + return (f)vmovn_s32((g)l); +} +q<4, float> am(long long an) { + q ao = q<4, unsigned short>::ah(&an); + ae ak = ad(ao), ap = ak & 8000, aq = ak ^ ap, ar = 55 < aq, as(aq); + q at = as & ar; + ae au = ap | at; + return q<4, float>::ah(&au); +} +q<4, unsigned short> av(q<4, float> aw) { + ae ak = ae::ah(&aw), ap = ak & 80000000, aq = ap, ax = 5, as = aq >> 3, + ay = 6; + q az = ax & as; + ae au = ay | az; + return ad(au); +} +struct ba { + typedef int bb; + static q<4, float> bc(int s) { return am(s); } +}; +q<4, float> bd(q<4, float> s) { return s * 0; } +template void bf(void *bg, void *al, int bh, int bi) { + int bj; + auto bk(static_cast(al) + bh), + d = static_cast(bg), + bl = be::bc(static_cast(al)[0]), bm = be::bc(0), + c = bm; + for (; bi;) { + auto a = c, bn = be::bc(static_cast(al)[1]), + bo = be::bc(1); + q bp = bn; + q bq = bp; + auto b = bq + bo; + bl = be::bc(static_cast(al)[2]); + bm = be::bc(bk[2]); + c = bl + bm; + q br = a + b; + auto bs = br; + q bt = bd(bs); + av(bt).aj(); + d[0] = bj; + } +} +int bu; +void bv() { bf(0, 0, 0, bu); } -- cgit v1.1 From 5e2eabe1eed1e53d39923517122d3c7de2013ad4 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Thu, 18 Mar 2021 11:47:46 -0700 Subject: x86: Issue error for return/argument only with function body If we never generate function body, we shouldn't issue errors for return nor argument. Add silent_p to i386 machine_function to avoid issuing errors for return and argument without function body. gcc/ PR target/99652 * config/i386/i386-options.c (ix86_init_machine_status): Set silent_p to true. * config/i386/i386.c (init_cumulative_args): Set silent_p to false. (construct_container): Return early for return and argument errors if silent_p is true. * config/i386/i386.h (machine_function): Add silent_p. gcc/testsuite/ PR target/99652 * gcc.dg/torture/pr99652-1.c: New test. * gcc.dg/torture/pr99652-2.c: Likewise. * gcc.target/i386/pr57655.c: Adjusted. * gcc.target/i386/pr59794-6.c: Likewise. * gcc.target/i386/pr70738-1.c: Likewise. * gcc.target/i386/pr96744-1.c: Likewise. --- gcc/testsuite/gcc.dg/torture/pr99652-1.c | 8 ++++++++ gcc/testsuite/gcc.dg/torture/pr99652-2.c | 8 ++++++++ gcc/testsuite/gcc.target/i386/pr57655.c | 4 ++-- gcc/testsuite/gcc.target/i386/pr59794-6.c | 4 ++-- gcc/testsuite/gcc.target/i386/pr70738-1.c | 4 ++-- gcc/testsuite/gcc.target/i386/pr96744-1.c | 4 ++-- 6 files changed, 24 insertions(+), 8 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr99652-1.c create mode 100644 gcc/testsuite/gcc.dg/torture/pr99652-2.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/torture/pr99652-1.c b/gcc/testsuite/gcc.dg/torture/pr99652-1.c new file mode 100644 index 0000000..c2395ff --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr99652-1.c @@ -0,0 +1,8 @@ +/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-mgeneral-regs-only" } */ + +inline double +foo (void) +{ + return 1.0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr99652-2.c b/gcc/testsuite/gcc.dg/torture/pr99652-2.c new file mode 100644 index 0000000..beefad8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr99652-2.c @@ -0,0 +1,8 @@ +/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-mno-80387" } */ + +inline double +foo (void) +{ + return 1.0; +} diff --git a/gcc/testsuite/gcc.target/i386/pr57655.c b/gcc/testsuite/gcc.target/i386/pr57655.c index 33a59d3..649cdef 100644 --- a/gcc/testsuite/gcc.target/i386/pr57655.c +++ b/gcc/testsuite/gcc.target/i386/pr57655.c @@ -2,7 +2,7 @@ /* { dg-options "-mavx -mvzeroupper -mno-fp-ret-in-387" } */ long double -foo (long double x) -{ /* { dg-error "x87 register return with x87 disabled" "" { target { ! ia32 } } } */ +foo (long double x) /* { dg-error "x87 register return with x87 disabled" "" { target { ! ia32 } } } */ +{ return __builtin_ilogbl (x); } diff --git a/gcc/testsuite/gcc.target/i386/pr59794-6.c b/gcc/testsuite/gcc.target/i386/pr59794-6.c index c809f95..babcf76 100644 --- a/gcc/testsuite/gcc.target/i386/pr59794-6.c +++ b/gcc/testsuite/gcc.target/i386/pr59794-6.c @@ -8,7 +8,7 @@ typedef int __v4si __attribute__ ((__vector_size__ (16))); extern __v4si x; __v4si -foo (void) -{ /* { dg-error "SSE register return with SSE disabled" } */ +foo (void) /* { dg-error "SSE register return with SSE disabled" } */ +{ return x; } diff --git a/gcc/testsuite/gcc.target/i386/pr70738-1.c b/gcc/testsuite/gcc.target/i386/pr70738-1.c index 19381c2..62d609c 100644 --- a/gcc/testsuite/gcc.target/i386/pr70738-1.c +++ b/gcc/testsuite/gcc.target/i386/pr70738-1.c @@ -3,7 +3,7 @@ typedef int int32x2_t __attribute__ ((__vector_size__ ((8)))); -int32x2_t test (int32x2_t a, int32x2_t b) -{ /* { dg-error "SSE register return with SSE disabled" } */ +int32x2_t test (int32x2_t a, int32x2_t b) /* { dg-error "SSE register return with SSE disabled" } */ +{ return a + b; } diff --git a/gcc/testsuite/gcc.target/i386/pr96744-1.c b/gcc/testsuite/gcc.target/i386/pr96744-1.c index 46f3ce6..da5557d 100644 --- a/gcc/testsuite/gcc.target/i386/pr96744-1.c +++ b/gcc/testsuite/gcc.target/i386/pr96744-1.c @@ -4,7 +4,7 @@ typedef int int32x2_t __attribute__ ((__vector_size__ ((8)))); __attribute__((__target__("general-regs-only"))) -int32x2_t test (int32x2_t a, int32x2_t b) -{ /* { dg-error "SSE register return with SSE disabled" } */ +int32x2_t test (int32x2_t a, int32x2_t b) /* { dg-error "SSE register return with SSE disabled" } */ +{ return a + b; } -- cgit v1.1 From c3a2bc6daaa2d278cb5f323e2df4b8c2af4198ac Mon Sep 17 00:00:00 2001 From: Tamar Christina Date: Fri, 19 Mar 2021 14:29:36 +0000 Subject: slp: remove unneeded permute calculation (PR99656) The attach testcase ICEs because as you showed on the PR we have one child which is an internal with a PERM of EVENEVEN and one with TOP. The problem is while we can conceptually merge the permute itself into EVENEVEN, merging the lanes don't really make sense. That said, we no longer even require the merged lanes as we create the permutes based on the KIND directly. This patch just removes all of that code. Unfortunately it still won't vectorize with the cost model enabled due to the blend that's created combining the load and the external note: node 0x51f2ce8 (max_nunits=1, refcnt=1) note: op: VEC_PERM_EXPR note: { } note: lane permutation { 0[0] 1[1] } note: children 0x51f23e0 0x51f2578 note: node 0x51f23e0 (max_nunits=2, refcnt=1) note: op template: _16 = REALPART_EXPR <*t1_9(D)>; note: stmt 0 _16 = REALPART_EXPR <*t1_9(D)>; note: stmt 1 _16 = REALPART_EXPR <*t1_9(D)>; note: load permutation { 0 0 } note: node (external) 0x51f2578 (max_nunits=1, refcnt=1) note: { _18, _18 } which costs the cost for the load-and-split and the cost of the external splat, and the one for blending them while in reality it's just a scalar load and insert. The compiler (with the cost model disabled) generates ldr q1, [x19] dup v1.2d, v1.d[0] ldr d0, [x19, 8] fneg d0, d0 ins v1.d[1], v0.d[0] while really it should be ldp d1, d0, [x19] fneg d0, d0 ins v1.d[1], v0.d[0] but that's for another time. gcc/ChangeLog: PR tree-optimization/99656 * tree-vect-slp-patterns.c (linear_loads_p, complex_add_pattern::matches, is_eq_or_top, vect_validate_multiplication, complex_mul_pattern::matches, complex_fms_pattern::matches): Remove complex_perm_kinds_t. * tree-vectorizer.h: (complex_load_perm_t): Removed. (slp_tree_to_load_perm_map_t): Use complex_perm_kinds_t instead of complex_load_perm_t. gcc/testsuite/ChangeLog: PR tree-optimization/99656 * gfortran.dg/vect/pr99656.f90: New test. --- gcc/testsuite/gfortran.dg/vect/pr99656.f90 | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/vect/pr99656.f90 (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gfortran.dg/vect/pr99656.f90 b/gcc/testsuite/gfortran.dg/vect/pr99656.f90 new file mode 100644 index 0000000..59a28ee --- /dev/null +++ b/gcc/testsuite/gfortran.dg/vect/pr99656.f90 @@ -0,0 +1,24 @@ +! { dg-do compile { target { aarch64*-*-* } } } +! { dg-require-effective-target le } +! { dg-additional-options "-march=armv8.3-a -O1 -ftree-slp-vectorize" } + +SUBROUTINE ZLAHQR2(H, LDH, H22, T1) + + INTEGER LDH + COMPLEX*16 H(LDH, *) + + INTEGER NR + COMPLEX*16 H22, SUM, T1, V2 + + COMPLEX*16 V( 3 ) + + EXTERNAL ZLARFG + INTRINSIC DCONJG + + V2 = H22 + CALL ZLARFG(T1) + SUM = DCONJG(T1) * H(1, 1) + H(1, 1) = SUM * V2 + + RETURN +END -- cgit v1.1 From 82bb66730bc42b8694fdebef607ea6e49e8496bf Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 19 Mar 2021 18:36:56 +0100 Subject: c++: Only reject reinterpret casts from pointers to integers for manifestly_const_eval evaluation [PR99456] My PR82304/PR95307 fix moved reinterpret cast from pointer to integer diagnostics from cxx_eval_outermost_constant_expr where it caught invalid code only at the outermost level down into cxx_eval_constant_expression. Unfortunately, it regressed following testcase, we emit worse code including dynamic initialization of some vars. While the initializers are not constant expressions due to the reinterpret_cast in there, there is no reason not to fold them as an optimization. I've tried to make this dependent on !ctx->quiet, but that regressed two further tests, and on ctx->strict, which regressed other tests, so this patch bases that on manifestly_const_eval. The new testcase is now optimized as much as it used to be in GCC 10 and the only regression it causes is an extra -Wnarrowing warning on vla22.C test on invalid code (which the patch adjusts). 2021-03-19 Jakub Jelinek PR c++/99456 * constexpr.c (cxx_eval_constant_expression): For CONVERT_EXPR from INDIRECT_TYPE_P to ARITHMETIC_TYPE_P, when !ctx->manifestly_const_eval don't diagnose it, set *non_constant_p nor return t. * g++.dg/opt/pr99456.C: New test. * g++.dg/ext/vla22.C: Expect a -Wnarrowing warning for c++11 and later. --- gcc/testsuite/g++.dg/ext/vla22.C | 2 +- gcc/testsuite/g++.dg/opt/pr99456.C | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/opt/pr99456.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/ext/vla22.C b/gcc/testsuite/g++.dg/ext/vla22.C index 2308ee7..967adb9 100644 --- a/gcc/testsuite/g++.dg/ext/vla22.C +++ b/gcc/testsuite/g++.dg/ext/vla22.C @@ -6,4 +6,4 @@ void f () { const int tbl[(long) "h"] = { 12 }; // { dg-error "size of array .tbl. is not an integral constant-expression" } -} +} // { dg-warning "narrowing conversion" "" { target c++11 } .-1 } diff --git a/gcc/testsuite/g++.dg/opt/pr99456.C b/gcc/testsuite/g++.dg/opt/pr99456.C new file mode 100644 index 0000000..66f19c8 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr99456.C @@ -0,0 +1,33 @@ +// PR c++/99456 +// { dg-do compile { target c++17 } } +// { dg-options "-g0" } +// { dg-final { scan-assembler-not "PR99456Var0\[1234]" } } +// { dg-final { scan-assembler-not "__static_initialization_and_destruction" } } +// { dg-final { scan-assembler-not "_GLOBAL__sub_I" } } +// { dg-final { scan-assembler-not "_ZGV12PR99456Var1\[1234]" } } + +typedef __UINTPTR_TYPE__ uintptr_t; + +class Container +{ +public: + uintptr_t m; +}; + +extern unsigned desc; +static constexpr unsigned &descRef = desc; + +inline Container PR99456Var01 {reinterpret_cast (&descRef)}; +inline Container PR99456Var02 {reinterpret_cast (&desc)}; +inline uintptr_t PR99456Var03 {reinterpret_cast (&descRef)}; +inline uintptr_t PR99456Var04 {reinterpret_cast (&desc)}; + +inline Container PR99456Var11 {reinterpret_cast (&descRef)}; +inline Container PR99456Var12 {reinterpret_cast (&desc)}; +inline uintptr_t PR99456Var13 {reinterpret_cast (&descRef)}; +inline uintptr_t PR99456Var14 {reinterpret_cast (&desc)}; + +auto *PR99456Ref11 = &PR99456Var11; +auto *PR99456Ref12 = &PR99456Var12; +auto *PR99456Ref13 = &PR99456Var13; +auto *PR99456Ref14 = &PR99456Var14; -- cgit v1.1 From d81019db099ad95febbb2d4b4afd8cbe95762062 Mon Sep 17 00:00:00 2001 From: "Vladimir N. Makarov" Date: Fri, 19 Mar 2021 15:34:48 -0400 Subject: [PR99663] Don't use unknown constraint for address constraint in process_address_1. s390x has insns using several alternatives with address constraints. Even if we don't know at this stage what alternative will be used, we still can say that is an address constraint. So don't use unknown constraint in this case when there are multiple constraints or/and alternative. gcc/ChangeLog: PR target/99663 * lra-constraints.c (process_address_1): Don't use unknown constraint for address constraint. gcc/testsuite/ChangeLog: PR target/99663 * gcc.target/s390/pr99663.c: New. --- gcc/testsuite/gcc.target/s390/pr99663.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 gcc/testsuite/gcc.target/s390/pr99663.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/s390/pr99663.c b/gcc/testsuite/gcc.target/s390/pr99663.c new file mode 100644 index 0000000..f4f0f94 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/pr99663.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-mtune=z15 -march=z13 -mzarch -O2 -fno-stack-protector -fPIC" } */ + +typedef struct { + int exponent; + unsigned short lsu[]; +} decNumber; +decNumber decDivideOp_lhs; +short decDivideOp_varbuff; +void decDivideOp(decNumber *rhs) { + short *msu1; + int exponent; + unsigned short *source; + for (; source >= decDivideOp_lhs.lsu; source--, msu1--) + *msu1 = *source; + for (;;) + if (exponent) + if (decDivideOp_varbuff) + exponent = rhs->exponent; +} -- cgit v1.1 From 83855386c41b78c92f4445e4d0e6397372136c90 Mon Sep 17 00:00:00 2001 From: Thomas Koenig Date: Fri, 19 Mar 2021 20:49:38 +0100 Subject: Add size check to vector-matrix matmul. It turns out the library version is much faster for vector-matrix multiplications for large sizes than what inlining can produce. Use size checks for switching between this and inlining for that case to. gcc/fortran/ChangeLog: * frontend-passes.c (inline_limit_check): Add rank_a argument. If a is rank 1, set the second dimension to 1. (inline_matmul_assign): Pass rank_a argument to inline_limit_check. (call_external_blas): Likewise. gcc/testsuite/ChangeLog: * gfortran.dg/inline_matmul_6.f90: Adjust count for _gfortran_matmul. --- gcc/testsuite/gfortran.dg/inline_matmul_6.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gfortran.dg/inline_matmul_6.f90 b/gcc/testsuite/gfortran.dg/inline_matmul_6.f90 index 491a721..da717bd 100644 --- a/gcc/testsuite/gfortran.dg/inline_matmul_6.f90 +++ b/gcc/testsuite/gfortran.dg/inline_matmul_6.f90 @@ -45,4 +45,4 @@ program main if (any(abs(c2 - (/39., -61., 75./)) > 1e-3)) STOP 2 end program main -! { dg-final { scan-tree-dump-times "_gfortran_matmul" 0 "original" } } +! { dg-final { scan-tree-dump-times "_gfortran_matmul" 1 "original" } } -- cgit v1.1 From 3279a9a5a9a2e4e17175678cb7b15613495e306e Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 19 Mar 2021 22:54:31 +0100 Subject: c: Fix up -Wunused-but-set-* warnings for _Atomics [PR99588] As the following testcases show, compared to -D_Atomic= case we have many -Wunused-but-set-* warning false positives. When an _Atomic variable/parameter is read, we call mark_exp_read on it in convert_lvalue_to_rvalue, but build_atomic_assign does not. For consistency with the non-_Atomic case where we mark_exp_read the lhs for lhs op= ... but not for lhs = ..., this patch does that too. But furthermore we need to pattern match the trees emitted by _Atomic store, so that _Atomic store itself is not marked as being a variable read, but when the result of the store is used, we mark it. 2021-03-19 Jakub Jelinek PR c/99588 * c-typeck.c (mark_exp_read): Recognize what build_atomic_assign with modifycode NOP_EXPR produces and mark the _Atomic var as read if found. (build_atomic_assign): For modifycode of NOP_EXPR, use COMPOUND_EXPRs rather than STATEMENT_LIST. Otherwise call mark_exp_read on lhs. Set TREE_SIDE_EFFECTS on the TARGET_EXPR. * gcc.dg/Wunused-var-5.c: New test. * gcc.dg/Wunused-var-6.c: New test. --- gcc/testsuite/gcc.dg/Wunused-var-5.c | 23 +++++++++++++++++++++++ gcc/testsuite/gcc.dg/Wunused-var-6.c | 14 ++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/Wunused-var-5.c create mode 100644 gcc/testsuite/gcc.dg/Wunused-var-6.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/Wunused-var-5.c b/gcc/testsuite/gcc.dg/Wunused-var-5.c new file mode 100644 index 0000000..cc5bbf5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/Wunused-var-5.c @@ -0,0 +1,23 @@ +/* PR c/99588 */ +/* { dg-do compile } */ +/* { dg-options "-std=c11 -Wunused-but-set-variable" } */ + +void bar (int, ...); +void f1 (void) { static _Atomic int x = 0; bar (0, x); } +void f2 (void) { static _Atomic int x = 0; bar (0, x += 1); } +void f3 (void) { static _Atomic int x = 0; bar (x); } +void f4 (void) { static _Atomic int x = 0; bar (x += 1); } +void f5 (void) { static _Atomic int x = 0; bar (x = 1); } +void f6 (void) { static _Atomic int x = 0; x = 1; } /* { dg-warning "variable 'x' set but not used" } */ +void f7 (void) { static _Atomic int x = 0; x += 3; } +void f8 (void) { _Atomic int x = 0; bar (0, x); } +void f9 (void) { _Atomic int x = 0; bar (0, x += 1); } +void f10 (void) { _Atomic int x = 0; bar (x); } +void f11 (void) { _Atomic int x = 0; bar (x += 1); } +void f12 (void) { _Atomic int x = 0; bar (x = 1); } +void f13 (void) { _Atomic int x = 0; x = 1; } /* { dg-warning "variable 'x' set but not used" } */ +void f14 (void) { _Atomic int x = 0; x += 3; } +void f15 (void) { _Atomic int x = 0; int y = 3; x += y; } +void f16 (void) { _Atomic int x = 0; int y = 3; bar (x += y); } +void f17 (void) { _Atomic int x = 0; int y = 3; x = y; } /* { dg-warning "variable 'x' set but not used" } */ +void f18 (void) { _Atomic int x = 0; int y = 3; bar (x = y); } diff --git a/gcc/testsuite/gcc.dg/Wunused-var-6.c b/gcc/testsuite/gcc.dg/Wunused-var-6.c new file mode 100644 index 0000000..f48a455 --- /dev/null +++ b/gcc/testsuite/gcc.dg/Wunused-var-6.c @@ -0,0 +1,14 @@ +/* PR c/99588 */ +/* { dg-do compile } */ +/* { dg-options "-std=c11 -Wunused-but-set-variable" } */ + +void bar (int, ...); +struct S { int a, b, c; }; +typedef _Atomic struct S T; + +void +foo (void) +{ + static T x = (struct S) { 0, 0, 0 }; /* { dg-bogus "set but not used" } */ + bar (0, x = (struct S) { 1, 1, 1 }); +} -- cgit v1.1 From 5f256a70a05fcfc5a1caf56678ceb12b4f87f781 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 20 Mar 2021 00:16:24 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 488c0cb..ddc15ba 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,50 @@ +2021-03-19 Jakub Jelinek + + PR c/99588 + * gcc.dg/Wunused-var-5.c: New test. + * gcc.dg/Wunused-var-6.c: New test. + +2021-03-19 Thomas Koenig + + * gfortran.dg/inline_matmul_6.f90: Adjust count for + _gfortran_matmul. + +2021-03-19 Vladimir N. Makarov + + PR target/99663 + * gcc.target/s390/pr99663.c: New. + +2021-03-19 Jakub Jelinek + + PR c++/99456 + * g++.dg/opt/pr99456.C: New test. + * g++.dg/ext/vla22.C: Expect a -Wnarrowing warning for c++11 and + later. + +2021-03-19 Tamar Christina + + PR tree-optimization/99656 + * gfortran.dg/vect/pr99656.f90: New test. + +2021-03-19 H.J. Lu + + PR target/99652 + * gcc.dg/torture/pr99652-1.c: New test. + * gcc.dg/torture/pr99652-2.c: Likewise. + * gcc.target/i386/pr57655.c: Adjusted. + * gcc.target/i386/pr59794-6.c: Likewise. + * gcc.target/i386/pr70738-1.c: Likewise. + * gcc.target/i386/pr96744-1.c: Likewise. + +2021-03-19 Jakub Jelinek + + PR target/99593 + * g++.target/arm/pr99593.C: New test. + +2021-03-19 Eric Botcazou + + * g++.dg/lto/pr89335_0.C: Require the linker plugin. + 2021-03-19 Marek Polacek PR c++/99500 -- cgit v1.1 From 9f59cb7cac009f3c6eba81eb09714699b9ac9f8d Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Sat, 20 Mar 2021 17:02:06 +0100 Subject: c-family: Fix PR94272 -fcompare-debug issue even for C [PR99230] The following testcase results in -fcompare-debug failure. The problem is the similar like in PR94272 https://gcc.gnu.org/pipermail/gcc-patches/2020-March/542562.html When genericizing, with -g0 we have just a TREE_SIDE_EFFECTS DO_STMT in a branch of if, while with -g we have that wrapped into TREE_SIDE_EFFECTS STATEMENT_LIST containing DEBUG_BEGIN_STMT and that DO_STMT. The do loop is empty with 0 condition, so c_genericize_control_stmt turns it into an empty statement (without TREE_SIDE_EFFECTS). For -g0 that means that suddenly the if branch doesn't have side effects and is expanded differently. But with -g we still have TREE_SIDE_EFFECTS STATEMENT_LIST containing DEBUG_BEGIN_STMT and non-TREE_SIDE_EFFECTS stmt. The following patch fixes that by detecting this case and removing TREE_SIDE_EFFECTS. And, so that we don't duplicate the same code, changes the C++ FE to just call the c_genericize_control_stmt function that can now handle it. 2021-03-20 Jakub Jelinek PR debug/99230 * c-gimplify.c (c_genericize_control_stmt): Handle STATEMENT_LIST. * cp-gimplify.c (cp_genericize_r) : Remove special code, instead call c_genericize_control_stmt. * gcc.dg/pr99230.c: New test. --- gcc/testsuite/gcc.dg/pr99230.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr99230.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/pr99230.c b/gcc/testsuite/gcc.dg/pr99230.c new file mode 100644 index 0000000..eb3f982 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr99230.c @@ -0,0 +1,40 @@ +/* PR debug/99230 */ +/* { dg-do compile } */ +/* { dg-options "-O2 --param logical-op-non-short-circuit=0 -fcompare-debug --param=jump-table-max-growth-ratio-for-speed=5000" } */ + +extern void fn2 (void); +extern void fn3 (int); +int a, b; +void +fn1 (void) +{ + int c; + short d; + switch (a) { + case 22000: + fn2 (); + case 22300: + b = 0; + case 22600: + case 22601: + case 22900: + fn3 (1); + case 20100: + fn3 (2); + case 20200: + fn3 (3); + case 20300: + fn3 (4); + case 20400: + fn3 (5); + case 20310: + fn3 (4); + case 20410: + fn3 (5); + } + if (d || c) { + do + ; + while (0); + } +} -- cgit v1.1 From 19ff0b0d816e6e7d7657a8559e9957d79dc1d77f Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Sat, 20 Mar 2021 05:17:36 -0700 Subject: x86: Check cfun != NULL before accessing silent_p Since construct_container may be called with cfun == NULL, check cfun != NULL before accessing silent_p. gcc/ PR target/99679 * config/i386/i386.c (construct_container): Check cfun != NULL before accessing silent_p. gcc/testsuite/ PR target/99679 * g++.target/i386/pr99679-1.C: New test. * g++.target/i386/pr99679-2.C: Likewise. --- gcc/testsuite/g++.target/i386/pr99679-1.C | 17 +++++++++++++++++ gcc/testsuite/g++.target/i386/pr99679-2.C | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 gcc/testsuite/g++.target/i386/pr99679-1.C create mode 100644 gcc/testsuite/g++.target/i386/pr99679-2.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.target/i386/pr99679-1.C b/gcc/testsuite/g++.target/i386/pr99679-1.C new file mode 100644 index 0000000..36640a4 --- /dev/null +++ b/gcc/testsuite/g++.target/i386/pr99679-1.C @@ -0,0 +1,17 @@ +// { dg-do compile } +// { dg-options "-Ofast -fipa-pta -mno-80387" } + +#include + +extern "C" void abort (void); + +void +foo (int x, ...) +{ + long double ld; + va_list ap; + va_start (ap, x); + ld = va_arg (ap, long double); + if (ld) + abort (); +} // { dg-error "x87 register return with x87 disabled" "" { target { ! ia32 } } } diff --git a/gcc/testsuite/g++.target/i386/pr99679-2.C b/gcc/testsuite/g++.target/i386/pr99679-2.C new file mode 100644 index 0000000..cbd3c49 --- /dev/null +++ b/gcc/testsuite/g++.target/i386/pr99679-2.C @@ -0,0 +1,17 @@ +// { dg-do compile } +// { dg-options "-Ofast -fipa-pta -mgeneral-regs-only" } + +#include + +extern "C" void abort (void); + +void +foo (int x, ...) +{ + double ld; + va_list ap; + va_start (ap, x); + ld = va_arg (ap, double); // { dg-error "SSE register argument with SSE disabled" "" { target { ! ia32 } } } + if (ld) + abort (); +} // { dg-error "SSE register return with SSE disabled" "" { target { ! ia32 } } } -- cgit v1.1 From 6af7b307f659a4f1845a9efd36ca37899515e234 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sun, 21 Mar 2021 00:16:22 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ddc15ba..af812bf 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2021-03-20 H.J. Lu + + PR target/99679 + * g++.target/i386/pr99679-1.C: New test. + * g++.target/i386/pr99679-2.C: Likewise. + +2021-03-20 Jakub Jelinek + + PR debug/99230 + * gcc.dg/pr99230.c: New test. + 2021-03-19 Jakub Jelinek PR c/99588 -- cgit v1.1 From d0a5e8e1a84bdd6ce915c3be65da8af2552cd49e Mon Sep 17 00:00:00 2001 From: Xionghu Luo Date: Sun, 21 Mar 2021 21:14:02 -0500 Subject: rs6000: Convert the vector set variable idx to DImode [PR98914] vec_insert defines the element argument type to be signed int by ELFv2 ABI. When expanding a vector with a variable rtx, convert the rtx type to DImode to support both intrinsic usage and other callers from rs6000_expand_vector_init produced by v[k] = val when k is long type. gcc/ChangeLog: 2021-03-21 Xionghu Luo PR target/98914 * config/rs6000/rs6000.c (rs6000_expand_vector_set_var_p9): Convert idx to DImode. (rs6000_expand_vector_set_var_p8): Likewise. gcc/testsuite/ChangeLog: 2021-03-21 Xionghu Luo PR target/98914 * gcc.target/powerpc/pr98914.c: New test. --- gcc/testsuite/gcc.target/powerpc/pr98914.c | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 gcc/testsuite/gcc.target/powerpc/pr98914.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/powerpc/pr98914.c b/gcc/testsuite/gcc.target/powerpc/pr98914.c new file mode 100644 index 0000000..e4d78e3 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr98914.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target powerpc_p8vector_ok } */ +/* { dg-options "-Og -mvsx" } */ + +vector int +foo (vector int v) +{ + for (long k = 0; k < 1; ++k) + v[k] = 0; + return v; +} -- cgit v1.1 From 540dace2ed3949571f2ce6cb007354e69bda0cb2 Mon Sep 17 00:00:00 2001 From: Kito Cheng Date: Mon, 22 Mar 2021 16:32:45 +0800 Subject: PR target/99702: Check RTL type before get value gcc/ChangeLog: PR target/99702 * config/riscv/riscv.c (riscv_expand_block_move): Get RTL value after type checking. gcc/testsuite/ChangeLog: PR target/99702 * gcc.target/riscv/pr99702.c: New. --- gcc/testsuite/gcc.target/riscv/pr99702.c | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 gcc/testsuite/gcc.target/riscv/pr99702.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/riscv/pr99702.c b/gcc/testsuite/gcc.target/riscv/pr99702.c new file mode 100644 index 0000000..a28724c --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/pr99702.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-options "-O" } */ +char n; +void *i, *j; +void foo(void) { + __builtin_memcpy(i, j, n); +} -- cgit v1.1 From b931e4792b8696f3da69f70988720c4d1ec6142a Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 22 Mar 2021 11:09:46 +0100 Subject: tree-optimization/99694 - fix value-numbering PHIs This avoids endless cycling when a PHI node with unchanged backedge value (the PHI result appearing there) is subject to CSE since doing that effectively alters the hash entry. The way to avoid this is to ignore such edges when processing the PHI node. 2021-03-22 Richard Biener PR tree-optimization/99694 * tree-ssa-sccvn.c (visit_phi): Ignore edges with the PHI result. * gcc.dg/torture/pr99694.c: New testcase. --- gcc/testsuite/gcc.dg/torture/pr99694.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/torture/pr99694.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/torture/pr99694.c b/gcc/testsuite/gcc.dg/torture/pr99694.c new file mode 100644 index 0000000..df31696 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr99694.c @@ -0,0 +1,27 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-w" } */ + +#include + +int a, b, c; +void d() { + uint16_t e; + int32_t *f; + int32_t *g; + if (a) { + int32_t *k; + for (;; *k += 1) { + int32_t **i = &f; + int32_t **l = &g; + for (e = 6; e; e++) { + g = k = f; + j: + **l = 0; + } + *i = c; + } + } + uint16_t i = &e; + b = i / 0; + goto j; +} -- cgit v1.1 From 87e3c2ef682e2ba7692ee56142a4eb5b6441c4d3 Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Thu, 18 Mar 2021 05:12:59 -0700 Subject: c++: duplicate alias templates with decltype [PR 99425] This failure was ultimately from incorrect handling of alias templates, but required a specific set of occurrences to happen in the specialization hash table. This cleans up the specialization streaming to add alias instantiations at the same point as other instantiations. I also removed some unneeded global variables dealing with mapping of duplicate decl contexts. PR c++/99425 gcc/cp/ * cp-tree.h (map_context_from, map_context_to): Delete. (add_mergeable_specialization): Add is_alias parm. * pt.c (add_mergeable_specialization): Add is_alias parm, add them. * module.cc (map_context_from, map_context_to): Delete. (trees_in::decl_value): Add specializations later, adjust call. Drop useless alias lookup. Set duplicate fn parm context. (check_mergeable_decl): Drop context mapping. (trees_in::is_matching_decl): Likewise. (trees_in::read_function_def): Drop parameter context adjustment here. gcc/testsuite/ * g++.dg/modules/pr99425-1.h: New. * g++.dg/modules/pr99425-1_a.H: New. * g++.dg/modules/pr99425-1_b.H: New. * g++.dg/modules/pr99425-1_c.C: New. * g++.dg/modules/pr99425-2_a.X: New. * g++.dg/modules/pr99425-2_b.X: New. * g++.dg/template/pr99425.C: New. --- gcc/testsuite/g++.dg/modules/pr99425-1.h | 11 ++++++++ gcc/testsuite/g++.dg/modules/pr99425-1_a.H | 4 +++ gcc/testsuite/g++.dg/modules/pr99425-1_b.H | 19 +++++++++++++ gcc/testsuite/g++.dg/modules/pr99425-1_c.C | 11 ++++++++ gcc/testsuite/g++.dg/modules/pr99425-2_a.X | 7 +++++ gcc/testsuite/g++.dg/modules/pr99425-2_b.X | 4 +++ gcc/testsuite/g++.dg/template/pr99425.C | 45 ++++++++++++++++++++++++++++++ 7 files changed, 101 insertions(+) create mode 100644 gcc/testsuite/g++.dg/modules/pr99425-1.h create mode 100644 gcc/testsuite/g++.dg/modules/pr99425-1_a.H create mode 100644 gcc/testsuite/g++.dg/modules/pr99425-1_b.H create mode 100644 gcc/testsuite/g++.dg/modules/pr99425-1_c.C create mode 100644 gcc/testsuite/g++.dg/modules/pr99425-2_a.X create mode 100644 gcc/testsuite/g++.dg/modules/pr99425-2_b.X create mode 100644 gcc/testsuite/g++.dg/template/pr99425.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/modules/pr99425-1.h b/gcc/testsuite/g++.dg/modules/pr99425-1.h new file mode 100644 index 0000000..de167a6 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr99425-1.h @@ -0,0 +1,11 @@ +template +struct make_signed +{ + using type = int; +}; + +template +using make_signed_t = typename make_signed::type; + +template +auto ssize (U &parm) -> make_signed_t; diff --git a/gcc/testsuite/g++.dg/modules/pr99425-1_a.H b/gcc/testsuite/g++.dg/modules/pr99425-1_a.H new file mode 100644 index 0000000..6117d4a --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr99425-1_a.H @@ -0,0 +1,4 @@ +// PR 99425 alias dependent specializations +// { dg-additional-options {-fmodule-header} } +// { dg-module-cmi {} } +#include "pr99425-1.h" diff --git a/gcc/testsuite/g++.dg/modules/pr99425-1_b.H b/gcc/testsuite/g++.dg/modules/pr99425-1_b.H new file mode 100644 index 0000000..98303a0 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr99425-1_b.H @@ -0,0 +1,19 @@ +// { dg-additional-options {-fmodule-header -fdump-lang-module-alias} } +// { dg-module-cmi {} } + +#include "pr99425-1.h" + +import "pr99425-1_a.H"; + +struct Cont +{ + int call (); +}; + +inline void widget (Cont parm) +{ + ssize (parm); +} + +// { dg-final { scan-lang-dump {Read:-[0-9]*'s alias spec merge key \(new\) type_decl:'::make_signed_t'\n ... Read:-[0-9]*'s type spec merge key \(new\) type_decl:'::make_signed'\n Read:-1's named merge key \(matched\) template_decl:'::template ssize'} module } } + diff --git a/gcc/testsuite/g++.dg/modules/pr99425-1_c.C b/gcc/testsuite/g++.dg/modules/pr99425-1_c.C new file mode 100644 index 0000000..28ef3a1 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr99425-1_c.C @@ -0,0 +1,11 @@ +// { dg-additional-options {-fmodules-ts -fdump-lang-module-alias} } +import "pr99425-1_a.H"; +import "pr99425-1_b.H"; + +void frob (Cont parm) +{ + ssize (parm); +} + +// { dg-final { scan-lang-dump {Read:-1's named merge key \(new\) template_decl:'::template ssize'} module } } +// { dg-final { scan-lang-dump {Read:-1's named merge key \(matched\) template_decl:'::template ssize'} module } } diff --git a/gcc/testsuite/g++.dg/modules/pr99425-2_a.X b/gcc/testsuite/g++.dg/modules/pr99425-2_a.X new file mode 100644 index 0000000..9a44dc3 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr99425-2_a.X @@ -0,0 +1,7 @@ +// PR 99425 template aliases can cause equivalences in the hash +// tables, and for extra excitement be reordered on rehash. + +// { dg-additional-options {-x c++-system-header stdexcept -fmodules-ts} } +// { dg-prune-output {linker input file unused} } + +No! DO NOT COMPILE; diff --git a/gcc/testsuite/g++.dg/modules/pr99425-2_b.X b/gcc/testsuite/g++.dg/modules/pr99425-2_b.X new file mode 100644 index 0000000..5e45354 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr99425-2_b.X @@ -0,0 +1,4 @@ +// { dg-additional-options {-x c++-system-header mutex -fmodules-ts} } +// { dg-prune-output {linker input file unused} } + +No! DO NOT COMPILE; diff --git a/gcc/testsuite/g++.dg/template/pr99425.C b/gcc/testsuite/g++.dg/template/pr99425.C new file mode 100644 index 0000000..fd49c86 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/pr99425.C @@ -0,0 +1,45 @@ +// { dg-do compile { target c++20 } } +// a potential fix for 99425 generated an ICE here. + +template +struct is_nothrow_destructible; + +template +struct common_reference; + +template +concept same_as + = true; + +template +concept sentinel_for + = same_as> + && is_nothrow_destructible<_Iter>::value; + +template +concept __member_end + = requires (_Tp& __t) + { + { true } + -> sentinel_for; + }; + +template +concept __adl_end + = requires (_Tp& __t) + { + { true } + -> sentinel_for; + }; + +template +requires __member_end<_Tp> || __adl_end<_Tp> + void + Bar (_Tp&& __t) +{ +} + +void test03 () +{ + Bar (1); // { dg-error "no matching function" } +} -- cgit v1.1 From 02f2dc441b1954736cc61e3f97687cd23d5586c5 Mon Sep 17 00:00:00 2001 From: "Vladimir N. Makarov" Date: Mon, 22 Mar 2021 13:34:50 -0400 Subject: [PR99581] Define relaxed memory and use it for aarch64 aarch64 needs to skip memory address validation for LD1R insns. Skipping the address validation may result in LRA crash for some targets when usual memory constraint is used. This patch introduces define_relaxed_memory_constraint, skipping address validation for it, and defining relaxed memory for aarch64 LD1r insn memory operand. gcc/ChangeLog: PR target/99581 * config/aarch64/constraints.md (UtQ): Use define_relaxed_memory_constraint for it. * doc/md.texi (define_relaxed_memory_constraint): Describe it. * genoutput.c (main): Process DEFINE_RELAXED_MEMORY_CONSTRAINT. * genpreds.c (constraint_data): Add bitfield is_relaxed_memory. (have_relaxed_memory_constraints): New static var. (relaxed_memory_start, relaxed_memory_end): Ditto. (add_constraint): Add arg is_relaxed_memory. Check name for relaxed memory. Set up is_relaxed_memory in constraint_data and have_relaxed_memory_constraints. Adjust calls. (choose_enum_order): Process relaxed memory. (write_tm_preds_h): Ditto. (main): Process DEFINE_RELAXED_MEMORY_CONSTRAINT. * gensupport.c (process_rtx): Process DEFINE_RELAXED_MEMORY_CONSTRAINT. * ira-costs.c (record_reg_classes): Process CT_RELAXED_MEMORY. * ira-lives.c (single_reg_class): Use insn_extra_relaxed_memory_constraint. * ira.c (ira_setup_alts): CT_RELAXED_MEMORY. * lra-constraints.c (valid_address_p): Use insn_extra_relaxed_memory_constraint instead of other memory constraints. (process_alt_operands): Process CT_RELAXED_MEMORY. (curr_insn_transform): Use insn_extra_relaxed_memory_constraint. * recog.c (asm_operand_ok, preprocess_constraints): Process CT_RELAXED_MEMORY. * reload.c (find_reloads): Ditto. * rtl.def (DEFINE_RELAXED_MEMORY_CONSTRAINT): New. * stmt.c (parse_input_constraint): Use insn_extra_relaxed_memory_constraint. gcc/testsuite/ChangeLog: PR target/99581 * gcc.target/powerpc/pr99581.c: New. --- gcc/testsuite/gcc.target/powerpc/pr99581.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 gcc/testsuite/gcc.target/powerpc/pr99581.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/powerpc/pr99581.c b/gcc/testsuite/gcc.target/powerpc/pr99581.c new file mode 100644 index 0000000..525f276 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr99581.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +char e[37540]; +struct A { int c; } d; + +void +bar (int n) +{ + __asm__("" : : "r" (e)); +} + +void +foo (void) +{ + __asm__("stw %1, %0" : "=o" (d.c) : "r" (0)); +} -- cgit v1.1 From 2bfd081f1bce3fb7f791591e741723dce4e884ed Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Mon, 22 Mar 2021 12:35:35 -0700 Subject: c++: Cross-module partial specialiations [PR 99480] We were not correctly handling cross-module redeclarations of partial-specializations. They have their own TEMPLATE_DECL, which we need to locate. I had a FIXME there about this case. Guess it's fixed now. PR c++/99480 gcc/cp/ * module.cc (depset::hash::make_dependency): Propagate flags for partial specialization. (module_may_redeclare): Handle partial specialization. gcc/testsuite/ * g++.dg/modules/pr99480_a.H: New. * g++.dg/modules/pr99480_b.H: New. --- gcc/testsuite/g++.dg/modules/pr99480_a.H | 10 ++++++++++ gcc/testsuite/g++.dg/modules/pr99480_b.H | 9 +++++++++ 2 files changed, 19 insertions(+) create mode 100644 gcc/testsuite/g++.dg/modules/pr99480_a.H create mode 100644 gcc/testsuite/g++.dg/modules/pr99480_b.H (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/modules/pr99480_a.H b/gcc/testsuite/g++.dg/modules/pr99480_a.H new file mode 100644 index 0000000..8f48493 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr99480_a.H @@ -0,0 +1,10 @@ +// PR 99480 ICE on instantiation definition +// { dg-additional-options -fmodule-header } +// { dg-module-cmi {} } +template +struct atomic; + +template +struct atomic<_Tp*>; + + diff --git a/gcc/testsuite/g++.dg/modules/pr99480_b.H b/gcc/testsuite/g++.dg/modules/pr99480_b.H new file mode 100644 index 0000000..ea8800d --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr99480_b.H @@ -0,0 +1,9 @@ +// { dg-additional-options -fmodule-header } +// { dg-module-cmi {} } + +import "pr99480_a.H"; + +template +struct atomic<_Tp*> +{ +}; -- cgit v1.1 From 8b744f46a2426b6656e52ace697a569795c9153a Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 23 Mar 2021 00:16:25 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index af812bf..809fc2f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,40 @@ +2021-03-22 Nathan Sidwell + + PR c++/99480 + * g++.dg/modules/pr99480_a.H: New. + * g++.dg/modules/pr99480_b.H: New. + +2021-03-22 Vladimir N. Makarov + + PR target/99581 + * gcc.target/powerpc/pr99581.c: New. + +2021-03-22 Nathan Sidwell + + PR c++/99425 + * g++.dg/modules/pr99425-1.h: New. + * g++.dg/modules/pr99425-1_a.H: New. + * g++.dg/modules/pr99425-1_b.H: New. + * g++.dg/modules/pr99425-1_c.C: New. + * g++.dg/modules/pr99425-2_a.X: New. + * g++.dg/modules/pr99425-2_b.X: New. + * g++.dg/template/pr99425.C: New. + +2021-03-22 Richard Biener + + PR tree-optimization/99694 + * gcc.dg/torture/pr99694.c: New testcase. + +2021-03-22 Kito Cheng + + PR target/99702 + * gcc.target/riscv/pr99702.c: New. + +2021-03-22 Xionghu Luo + + PR target/98914 + * gcc.target/powerpc/pr98914.c: New test. + 2021-03-20 H.J. Lu PR target/99679 -- cgit v1.1 From 88081d38bd82562b6e2d6a4a275e7f6f2aac3422 Mon Sep 17 00:00:00 2001 From: Aldy Hernandez Date: Thu, 18 Mar 2021 16:05:27 +0100 Subject: Handle setting of 1-bit anti-ranges uniformly. PR tree-optimization/99296 * value-range.cc (irange::irange_set_1bit_anti_range): New. (irange::irange_set_anti_range): Call irange_set_1bit_anti_range * value-range.h (irange::irange_set_1bit_anti_range): New. --- gcc/testsuite/gcc.dg/pr99296.c | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr99296.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/pr99296.c b/gcc/testsuite/gcc.dg/pr99296.c new file mode 100644 index 0000000..4a0b3f0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr99296.c @@ -0,0 +1,7 @@ +// { dg-do compile } +// { dg-options "-O2 -fno-tree-bit-ccp" } + +struct { + signed a : 1; +} b, c; +void d() { b.a |= c.a |= 0 != 2; } -- cgit v1.1 From 3e07e7a6a7f34f0ec2f1a3e50ebc52b77de11a30 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 23 Mar 2021 10:23:42 +0100 Subject: c++: Diagnose references to void in structured bindings [PR99650] We ICE on the following testcase, because std::tuple_element<...,...>::type is void and for structured bindings we therefore need to create void & or void && which is invalid. We created such REFERENCE_TYPE and later ICEd in the middle-end. The following patch fixes it by diagnosing that. 2021-03-23 Jakub Jelinek PR c++/99650 * decl.c (cp_finish_decomp): Diagnose void initializers when using tuple_element and get. * g++.dg/cpp1z/decomp55.C: New test. --- gcc/testsuite/g++.dg/cpp1z/decomp55.C | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1z/decomp55.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp55.C b/gcc/testsuite/g++.dg/cpp1z/decomp55.C new file mode 100644 index 0000000..bb4bf75 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/decomp55.C @@ -0,0 +1,19 @@ +// PR c++/99650 +// { dg-do compile { target c++17 } } + +namespace std { + template struct tuple_size; + template struct tuple_element; +} + +struct A { + int i; + template void get() { } +}; + +template<> struct std::tuple_size { static const int value = 2; }; +template struct std::tuple_element { using type = void; }; + +A a = { 42 }; +auto [ x, y ] = a; // { dg-error ".std::tuple_element<0, A>::type. is .void." } +// { dg-message "in initialization of structured binding variable 'x'" "" { target *-*-* } .-1 } -- cgit v1.1 From 4eb3a801a5ed947a50f941b63e30a0359fccf138 Mon Sep 17 00:00:00 2001 From: Marcus Comstedt Date: Fri, 19 Mar 2021 20:49:07 +0100 Subject: RISC-V: Update shift-shift-5.c testcase for big endian gcc/testsuite/ * gcc.target/riscv/shift-shift-5.c (sub): Change order of struct fields depending on byteorder. --- gcc/testsuite/gcc.target/riscv/shift-shift-5.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/riscv/shift-shift-5.c b/gcc/testsuite/gcc.target/riscv/shift-shift-5.c index 5b2ae89..0ecab97 100644 --- a/gcc/testsuite/gcc.target/riscv/shift-shift-5.c +++ b/gcc/testsuite/gcc.target/riscv/shift-shift-5.c @@ -7,7 +7,11 @@ unsigned long sub (long l) { union u { +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ struct s { int a : 19; unsigned int b : 13; int x; } s; +#else + struct s { int x; unsigned int b : 13; int a : 19; } s; +#endif long l; } u; u.l = l; -- cgit v1.1 From ffa6a7fba1f87b6b47763882be411a339061492d Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 23 Mar 2021 09:10:17 +0100 Subject: tree-optimization/99721 - avoid SLP nodes we cannot schedule This makes sure we'll not run into SLP scheduling issues later by rejecting all-constant children nodes without any scalar stmts early. 2021-03-23 Richard Biener PR tree-optimization/99721 * tree-vect-slp.c (vect_slp_analyze_node_operations): Make sure we can schedule the node. * gfortran.dg/vect/pr99721.f90: New testcase. --- gcc/testsuite/gfortran.dg/vect/pr99721.f90 | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/vect/pr99721.f90 (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gfortran.dg/vect/pr99721.f90 b/gcc/testsuite/gfortran.dg/vect/pr99721.f90 new file mode 100644 index 0000000..651e86a --- /dev/null +++ b/gcc/testsuite/gfortran.dg/vect/pr99721.f90 @@ -0,0 +1,11 @@ +! { dg-do compile } +! { dg-additional-options "-O3" } +! { dg-additional-options "-march=armv8.3-a" { target aarch64-*-* } } +subroutine sub_c + complex, dimension(2,3) :: at + complex, dimension(2,4) :: b + complex, dimension(3,4) :: c + data b / (41., 43.), 0, 0, 0, 0, 0, 0, 0/ + c = matmul(transpose(at), b) + if (any (c /= cres)) stop +end subroutine sub_c -- cgit v1.1 From 6acd6692f1ac3c2ece3da36178df73e3b12c4f65 Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Tue, 23 Mar 2021 05:18:04 -0700 Subject: c++: Over-zealous assert [PR 99239] This was simply an overzealous assert. Possibly correct thinking at the time that code was written, but not true now. Of course we can have imported artificial decls. PR c++/99239 gcc/cp/ * decl.c (duplicate_decls): Remove assert about maybe-imported artificial decls. gcc/testsuite/ * g++.dg/modules/pr99239_a.H: New. * g++.dg/modules/pr99239_b.H: New. --- gcc/testsuite/g++.dg/modules/pr99239_a.H | 13 +++++++++++++ gcc/testsuite/g++.dg/modules/pr99239_b.H | 12 ++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 gcc/testsuite/g++.dg/modules/pr99239_a.H create mode 100644 gcc/testsuite/g++.dg/modules/pr99239_b.H (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/modules/pr99239_a.H b/gcc/testsuite/g++.dg/modules/pr99239_a.H new file mode 100644 index 0000000..35f006f --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr99239_a.H @@ -0,0 +1,13 @@ +// PR 99239 ICE on catch clause +// { dg-additional-options -fmodule-header } +// { dg-module-cmi {} } + +inline void Foo () +{ + try + {} + catch(...) + { + } +} + diff --git a/gcc/testsuite/g++.dg/modules/pr99239_b.H b/gcc/testsuite/g++.dg/modules/pr99239_b.H new file mode 100644 index 0000000..92638d6 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr99239_b.H @@ -0,0 +1,12 @@ +// { dg-additional-options {-fmodule-header -fno-module-lazy} } +// { dg-module-cmi {} } +import "pr99239_a.H"; + +inline void + _M_remove_reference() throw() +{ + try + { } + catch(...) + { } +} -- cgit v1.1 From d7cea7ceff9a2be7436108030c598628c51fba0f Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Tue, 23 Mar 2021 14:02:03 +0000 Subject: aarch64: Make aarch64_add_offset work with -ftrapv [PR99540] aarch64_add_offset uses expand_mult to multiply the SVE VL by an out-of-range constant. expand_mult takes an argument to indicate whether the multiplication is signed or unsigned, but in this context the multiplication is effectively signless and so the choice seemed arbitrary. However, one of the things that the signedness input does is indicate whether signed overflow should be trapped for -ftrapv. We don't want that here, so we must treat the multiplication as unsigned. gcc/ 2021-03-23 Jakub Jelinek PR target/99540 * config/aarch64/aarch64.c (aarch64_add_offset): Tell expand_mult to perform an unsigned rather than a signed multiplication. gcc/testsuite/ 2021-03-23 Richard Sandiford PR target/99540 * gcc.dg/vect/pr99540.c: New test. --- gcc/testsuite/gcc.dg/vect/pr99540.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/vect/pr99540.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/vect/pr99540.c b/gcc/testsuite/gcc.dg/vect/pr99540.c new file mode 100644 index 0000000..9136b09 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr99540.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-ftrapv -ffloat-store -march=armv8.2-a+sve" { target aarch64*-*-* } } */ + +float *MSalign2m2m_rec_initverticalw, *MSalign2m2m_rec_currentw; + +void +match_ribosum (int MSalign2m2m_rec_i, int MSalign2m2m_rec_lgth1, + int MSalign2m2m_rec_lgth2) +{ + float **WMMTX; + + while (MSalign2m2m_rec_i < 1) + WMMTX[MSalign2m2m_rec_i++][0] = MSalign2m2m_rec_initverticalw[0]; + + while (MSalign2m2m_rec_i < MSalign2m2m_rec_lgth1) + MSalign2m2m_rec_initverticalw[MSalign2m2m_rec_i++] += 0.1; + + while (MSalign2m2m_rec_i < MSalign2m2m_rec_lgth2) + MSalign2m2m_rec_currentw[MSalign2m2m_rec_i++] += 0.1; +} -- cgit v1.1 From 212f4988f37ccf788c8c72b1dc952980bc9be3b7 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Tue, 23 Mar 2021 15:45:36 +0100 Subject: Fortran: Fix func decl mismatch [PR93660] gcc/fortran/ChangeLog: PR fortran/93660 * trans-decl.c (build_function_decl): Add comment; increment hidden_typelist for caf_token/caf_offset. * trans-types.c (gfc_get_function_type): Add comment; add missing caf_token/caf_offset args. gcc/testsuite/ChangeLog: PR fortran/93660 * gfortran.dg/gomp/declare-simd-coarray-lib.f90: New test. --- gcc/testsuite/gfortran.dg/gomp/declare-simd-coarray-lib.f90 | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/gomp/declare-simd-coarray-lib.f90 (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gfortran.dg/gomp/declare-simd-coarray-lib.f90 b/gcc/testsuite/gfortran.dg/gomp/declare-simd-coarray-lib.f90 new file mode 100644 index 0000000..1f74da7 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/declare-simd-coarray-lib.f90 @@ -0,0 +1,12 @@ +! { dg-additional-options "-fcoarray=lib" } +! +! PR fortran/93660 +! +! Failed as TREE_TYPE(fndecl) did not include the +! hidden caf_token/caf_offset arguments. +! +integer function f(x) + integer :: x[*] + !$omp declare simd + f = x[1] +end -- cgit v1.1 From 831f9f768eb1fbf9a31d9a89591188b1487b6376 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Tue, 9 Mar 2021 19:23:48 -0500 Subject: c++: Fix bogus warning in deprecated namespace [PR99318] In GCC 10, I introduced cp_warn_deprecated_use_scopes so that we can handle attribute deprecated on a namespace declaration. This function walks the decl's contexts so that we warn for code like namespace [[deprecated]] N { struct S { }; } N::S s; We call cp_warn_deprecated_use_scopes when we encounter a TYPE_DECL. But in the following testcase we have a TYPE_DECL whose context is a deprecated function; that itself is not a reason to warn. This patch limits for which entities we call cp_warn_deprecated_use; essentially it's what can follow ::. I noticed that we didn't test that struct [[deprecated]] S { static void fn(); }; S::fn(); produces the expected warning, so I've added gen-attrs-73.C. gcc/cp/ChangeLog: PR c++/99318 * decl2.c (cp_warn_deprecated_use_scopes): Only call cp_warn_deprecated_use when decl is a namespace, class, or enum. gcc/testsuite/ChangeLog: PR c++/99318 * g++.dg/cpp0x/attributes-namespace6.C: New test. * g++.dg/cpp0x/gen-attrs-73.C: New test. --- gcc/testsuite/g++.dg/cpp0x/attributes-namespace6.C | 21 +++++++++++++++++++++ gcc/testsuite/g++.dg/cpp0x/gen-attrs-73.C | 20 ++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/attributes-namespace6.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/gen-attrs-73.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp0x/attributes-namespace6.C b/gcc/testsuite/g++.dg/cpp0x/attributes-namespace6.C new file mode 100644 index 0000000..2fbc8e1 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/attributes-namespace6.C @@ -0,0 +1,21 @@ +// PR c++/99318 +// { dg-do compile { target c++11 } } + +template +struct S { + [[deprecated("foo")]] unsigned m_fn (char const chr) + { + using index_t = unsigned; + return T::arr[static_cast(chr)]; // { dg-bogus "deprecated" } + } +}; + +extern unsigned int arr[]; + +struct R { + [[deprecated("foo")]] unsigned m_fn (char const chr) + { + using index_t = unsigned; + return arr[static_cast(chr)]; // { dg-bogus "deprecated" } + } +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-73.C b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-73.C new file mode 100644 index 0000000..75f4077 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-73.C @@ -0,0 +1,20 @@ +// { dg-do compile { target c++11 } } +// Test attribute deprecated on :: with class, enum, and namespace. + +struct [[deprecated]] S { static void fn(); static const int s = 0; }; +union [[deprecated]] U { static void fn(); static const int u = 0; }; +enum [[deprecated]] E { X }; +enum class [[deprecated]] SE { Y }; +namespace [[deprecated]] N { struct S { }; } + +void +g () +{ + S::fn(); // { dg-warning "deprecated" } + (void) S::s; // { dg-warning "deprecated" } + U::fn(); // { dg-warning "deprecated" } + (void) U::u; // { dg-warning "deprecated" } + (void) E::X; // { dg-warning "deprecated" } + (void) SE::Y; // { dg-warning "deprecated" } + N::S s; // { dg-warning "deprecated" } +} -- cgit v1.1 From 3c0351f287e1fdf9a085c499f4657a6501c6cf29 Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Thu, 18 Mar 2021 14:02:53 +0000 Subject: testsuite/arm: Add arm_v8_2a_fp16_neon and arm_v8_2a_bf16_neon options A few tests lack the dg-add-options directives associated with the dg-require-effective-target they are using. Adding them enables to pass the right float-abi option, and thus make the tests pass instead of emit an error. For instance, we now pass -mfloat-abi=softfp on arm-linux-gnueabi targets and the tests pass. 2021-03-19 Christophe Lyon gcc/testsuite/ * gcc.target/arm/bfloat16_scalar_typecheck.c: Add arm_v8_2a_fp16_neon and arm_v8_2a_bf16_neon. * gcc.target/arm/bfloat16_vector_typecheck_1.c: Likewise. * gcc.target/arm/bfloat16_vector_typecheck_2.c: Likewise. --- gcc/testsuite/gcc.target/arm/bfloat16_scalar_typecheck.c | 2 ++ gcc/testsuite/gcc.target/arm/bfloat16_vector_typecheck_1.c | 2 ++ gcc/testsuite/gcc.target/arm/bfloat16_vector_typecheck_2.c | 6 ++++-- 3 files changed, 8 insertions(+), 2 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/arm/bfloat16_scalar_typecheck.c b/gcc/testsuite/gcc.target/arm/bfloat16_scalar_typecheck.c index 672641e..8c80c55 100644 --- a/gcc/testsuite/gcc.target/arm/bfloat16_scalar_typecheck.c +++ b/gcc/testsuite/gcc.target/arm/bfloat16_scalar_typecheck.c @@ -2,6 +2,8 @@ /* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */ /* { dg-require-effective-target arm_v8_2a_fp16_neon_ok } */ /* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */ +/* { dg-add-options arm_v8_2a_fp16_neon } */ +/* { dg-add-options arm_v8_2a_bf16_neon } */ /* { dg-additional-options "-march=armv8.6-a+bf16+fp16 -Wno-pedantic -O3 --save-temps" } */ #include diff --git a/gcc/testsuite/gcc.target/arm/bfloat16_vector_typecheck_1.c b/gcc/testsuite/gcc.target/arm/bfloat16_vector_typecheck_1.c index ba39cb6..f3c350b 100644 --- a/gcc/testsuite/gcc.target/arm/bfloat16_vector_typecheck_1.c +++ b/gcc/testsuite/gcc.target/arm/bfloat16_vector_typecheck_1.c @@ -2,6 +2,8 @@ /* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */ /* { dg-require-effective-target arm_v8_2a_fp16_neon_ok } */ /* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */ +/* { dg-add-options arm_v8_2a_fp16_neon } */ +/* { dg-add-options arm_v8_2a_bf16_neon } */ /* { dg-additional-options "-march=armv8.6-a+bf16+fp16 -Wno-pedantic -O3 --save-temps" } */ #include diff --git a/gcc/testsuite/gcc.target/arm/bfloat16_vector_typecheck_2.c b/gcc/testsuite/gcc.target/arm/bfloat16_vector_typecheck_2.c index 16669dc..de0ade5 100644 --- a/gcc/testsuite/gcc.target/arm/bfloat16_vector_typecheck_2.c +++ b/gcc/testsuite/gcc.target/arm/bfloat16_vector_typecheck_2.c @@ -2,6 +2,8 @@ /* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */ /* { dg-require-effective-target arm_v8_2a_fp16_neon_ok } */ /* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */ +/* { dg-add-options arm_v8_2a_fp16_neon } */ +/* { dg-add-options arm_v8_2a_bf16_neon } */ /* { dg-additional-options "-march=armv8.6-a+bf16+fp16 -Wno-pedantic -O3 --save-temps" } */ #include @@ -25,8 +27,8 @@ float is_a_float16; double is_a_double; bfloat16x8_t foo3 (void) { return (bfloat16x8_t) 0x12345678123456781234567812345678; } - /* { dg-error {integer constant is too large for its type} "" {target *-*-*} 27 } */ - /* { dg-error {cannot convert a value of type 'long long int' to vector type '__simd128_bfloat16_t' which has different size} "" {target *-*-*} 27 } */ + /* { dg-error {integer constant is too large for its type} "" {target *-*-*} .-1 } */ + /* { dg-error {cannot convert a value of type 'long long int' to vector type '__simd128_bfloat16_t' which has different size} "" {target *-*-*} .-2 } */ bfloat16x8_t footest (bfloat16x8_t vector0) { -- cgit v1.1 From aa706c46366553081a618502e9d71530cfa74dfa Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Mon, 20 Apr 2020 22:36:09 +0000 Subject: testsuite/arm: Add arm_v8_2a_i8mm options in gcc.target/arm/simd/vmmla_1.c We need to add the options corresponding to the arm_v8_2a_i8mm_ok effective target in order to use the right float-abi option: -mfloat-abi=softfp makes the test pass for arm-linux-gnueabi, while no -mfloat-abi option is needed for arm-linux-gnueabihf. 2021-03-19 Christophe Lyon gcc/testsuite/ * gcc.target/arm/simd/vmmla_1.c: Add arm_v8_2a_i8mm options. --- gcc/testsuite/gcc.target/arm/simd/vmmla_1.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/arm/simd/vmmla_1.c b/gcc/testsuite/gcc.target/arm/simd/vmmla_1.c index d33ebf3..a88c4ea 100644 --- a/gcc/testsuite/gcc.target/arm/simd/vmmla_1.c +++ b/gcc/testsuite/gcc.target/arm/simd/vmmla_1.c @@ -1,6 +1,7 @@ /* { dg-do assemble } */ /* { dg-require-effective-target arm_v8_2a_i8mm_ok } */ -/* { dg-options "-save-temps -O2 -march=armv8.2-a+i8mm -mfpu=auto -mfloat-abi=hard" } */ +/* { dg-options "-save-temps -O2 -mfpu=auto" } */ +/* { dg-add-options arm_v8_2a_i8mm } */ #include "arm_neon.h" -- cgit v1.1 From 451c51e8ed385d06d80776168897a1b2a2e5d870 Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Tue, 21 Apr 2020 16:04:34 +0000 Subject: testsuite/arm: Remove useless -mfloat-abi option These tests pass with their current dg-add-options, no need to force -mfloat=abi. I've noticed no impact on armv8_1m-shift-imm-1.c and armv8_1m-shift-reg-1.c, bf16_reinterpret.c now passes on arm-linux-gnueabi and bf16_dup.c now passes on arm-linux-gnueabihf. This allows pr51534.c to pass when forcing -mfloat-abi=soft in runtestflags, otherwise we get an error '-mfloat-abi=soft and -mfloat-abi=hard may not be used together' because we try to compile with both flags. 2021-03-19 Christophe Lyon gcc/testsuite/ * gcc.target/arm/armv8_1m-shift-imm-1.c: Remove -mfloat=abi option. * gcc.target/arm/armv8_1m-shift-reg-1.c: Likewise. * gcc.target/arm/bf16_dup.c: Likewise. * gcc.target/arm/bf16_reinterpret.c: Likewise. * gcc.target/arm/pr51534.c: Remove -mfloat=abi option. --- gcc/testsuite/gcc.target/arm/armv8_1m-shift-imm-1.c | 2 +- gcc/testsuite/gcc.target/arm/armv8_1m-shift-reg-1.c | 2 +- gcc/testsuite/gcc.target/arm/bf16_dup.c | 2 +- gcc/testsuite/gcc.target/arm/bf16_reinterpret.c | 2 +- gcc/testsuite/gcc.target/arm/pr51534.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/arm/armv8_1m-shift-imm-1.c b/gcc/testsuite/gcc.target/arm/armv8_1m-shift-imm-1.c index 883fbb09..84f13e2 100644 --- a/gcc/testsuite/gcc.target/arm/armv8_1m-shift-imm-1.c +++ b/gcc/testsuite/gcc.target/arm/armv8_1m-shift-imm-1.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mfloat-abi=softfp -mlittle-endian" } */ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ +/* { dg-options "-O2 -mlittle-endian" } */ /* { dg-add-options arm_v8_1m_mve } */ long long longval1; diff --git a/gcc/testsuite/gcc.target/arm/armv8_1m-shift-reg-1.c b/gcc/testsuite/gcc.target/arm/armv8_1m-shift-reg-1.c index e125ff8..8668b6b 100644 --- a/gcc/testsuite/gcc.target/arm/armv8_1m-shift-reg-1.c +++ b/gcc/testsuite/gcc.target/arm/armv8_1m-shift-reg-1.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mfloat-abi=softfp -mlittle-endian" } */ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ +/* { dg-options "-O2 -mlittle-endian" } */ /* { dg-add-options arm_v8_1m_mve } */ long long longval2; diff --git a/gcc/testsuite/gcc.target/arm/bf16_dup.c b/gcc/testsuite/gcc.target/arm/bf16_dup.c index 94be99a..b62bce1 100644 --- a/gcc/testsuite/gcc.target/arm/bf16_dup.c +++ b/gcc/testsuite/gcc.target/arm/bf16_dup.c @@ -1,7 +1,7 @@ /* { dg-do assemble { target { arm*-*-* } } } */ /* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */ /* { dg-add-options arm_v8_2a_bf16_neon } */ -/* { dg-additional-options "-save-temps -march=armv8.2-a+bf16+fp16 -mfloat-abi=softfp" } */ +/* { dg-additional-options "-save-temps -march=armv8.2-a+bf16+fp16" } */ #include "arm_neon.h" diff --git a/gcc/testsuite/gcc.target/arm/bf16_reinterpret.c b/gcc/testsuite/gcc.target/arm/bf16_reinterpret.c index e7d30a9..9e36fc5 100644 --- a/gcc/testsuite/gcc.target/arm/bf16_reinterpret.c +++ b/gcc/testsuite/gcc.target/arm/bf16_reinterpret.c @@ -1,7 +1,7 @@ /* { dg-do assemble { target { arm*-*-* } } } */ /* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */ /* { dg-add-options arm_v8_2a_bf16_neon } */ -/* { dg-additional-options "-save-temps -march=armv8.2-a+fp16+bf16 -mfloat-abi=hard -mfpu=crypto-neon-fp-armv8" } */ +/* { dg-additional-options "-save-temps -march=armv8.2-a+fp16+bf16 -mfpu=crypto-neon-fp-armv8" } */ #include diff --git a/gcc/testsuite/gcc.target/arm/pr51534.c b/gcc/testsuite/gcc.target/arm/pr51534.c index f675a44..3711b45 100644 --- a/gcc/testsuite/gcc.target/arm/pr51534.c +++ b/gcc/testsuite/gcc.target/arm/pr51534.c @@ -3,7 +3,7 @@ /* { dg-do assemble } */ /* { dg-require-effective-target arm_neon_ok } */ -/* { dg-options "-save-temps -mfloat-abi=hard -O3" } */ +/* { dg-options "-save-temps -O3" } */ /* { dg-add-options arm_neon } */ #include -- cgit v1.1 From fcfad74515da38bf73d67e2eb76e81a3cd862340 Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Mon, 20 Apr 2020 22:37:23 +0000 Subject: testsuite/arm: Add arm_softfp_ok or arm_hard_ok as needed. Several tests override the -mfloat-abi option detected by their effective targets. Make sure it is supported, so that these tests are unsupported rather than failures (the inclusion of arm_neon.h otherwise fails for lack of gnu/stubs-*.h) This avoids failures with bfloat16_simd_2_1.c bfloat16_simd_3_1.c bf16_vldn_1.c bf16_vstn_1.c on arm-linux-gnueabi and pr51968.c bfloat16_simd_1_2.c bfloat16_simd_2_2.c bfloat16_simd_3_2.c on arm-linux-gnueabihf. On arm-eabi with default cpu/fpu/mode and a+rm multilibs, bfloat16_simd_2_1.c, bfloat16_simd_3_1.c, bf16_vstn_1.c and bf16_vldn_1.c become unsupported instead of pass because arm_hard_ok fails with "selected processor lacks an FPU". Since we also override the fpu in dg-additional-options, we'd need another effective target (say arm_hard_neon_ok) that would check -mfloat-abi=hard -mfpu=neon at the same time. But we have already so many arm effective targets, it doesn't seem like a good way forward. 2021-03-19 Christophe Lyon gcc/testsuite/ * gcc.target/arm/bfloat16_simd_1_2.c: Add arm_softfp_ok. * gcc.target/arm/bfloat16_simd_2_2.c: Likewise. * gcc.target/arm/bfloat16_simd_3_2.c: Likewise. * gcc.target/arm/pr51968.c: Likewise. * gcc.target/arm/bfloat16_simd_2_1.c: arm_hard_ok. * gcc.target/arm/bfloat16_simd_3_1.c: Likewise. * gcc.target/arm/simd/bf16_vldn_1.c: Likewise. * gcc.target/arm/simd/bf16_vstn_1.c: Likewise. --- gcc/testsuite/gcc.target/arm/bfloat16_simd_1_2.c | 1 + gcc/testsuite/gcc.target/arm/bfloat16_simd_2_1.c | 1 + gcc/testsuite/gcc.target/arm/bfloat16_simd_2_2.c | 1 + gcc/testsuite/gcc.target/arm/bfloat16_simd_3_1.c | 1 + gcc/testsuite/gcc.target/arm/bfloat16_simd_3_2.c | 1 + gcc/testsuite/gcc.target/arm/pr51968.c | 3 ++- gcc/testsuite/gcc.target/arm/simd/bf16_vldn_1.c | 1 + gcc/testsuite/gcc.target/arm/simd/bf16_vstn_1.c | 1 + 8 files changed, 9 insertions(+), 1 deletion(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/arm/bfloat16_simd_1_2.c b/gcc/testsuite/gcc.target/arm/bfloat16_simd_1_2.c index 4ffcc54..95eecec 100644 --- a/gcc/testsuite/gcc.target/arm/bfloat16_simd_1_2.c +++ b/gcc/testsuite/gcc.target/arm/bfloat16_simd_1_2.c @@ -1,4 +1,5 @@ /* { dg-do assemble { target { arm*-*-* } } } */ +/* { dg-require-effective-target arm_softfp_ok } */ /* { dg-require-effective-target arm_v8_neon_ok } */ /* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */ /* { dg-additional-options "-march=armv8.2-a+bf16 -mfloat-abi=softfp -mfpu=auto" } */ diff --git a/gcc/testsuite/gcc.target/arm/bfloat16_simd_2_1.c b/gcc/testsuite/gcc.target/arm/bfloat16_simd_2_1.c index 05ee4d8..02b4c41 100644 --- a/gcc/testsuite/gcc.target/arm/bfloat16_simd_2_1.c +++ b/gcc/testsuite/gcc.target/arm/bfloat16_simd_2_1.c @@ -1,4 +1,5 @@ /* { dg-do assemble { target { arm*-*-* } } } */ +/* { dg-require-effective-target arm_hard_ok } */ /* { dg-require-effective-target arm_v8_neon_ok } */ /* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */ /* { dg-additional-options "-march=armv8.2-a -mfloat-abi=hard -mfpu=neon-fp-armv8" } */ diff --git a/gcc/testsuite/gcc.target/arm/bfloat16_simd_2_2.c b/gcc/testsuite/gcc.target/arm/bfloat16_simd_2_2.c index 15fba31..175bfa5 100644 --- a/gcc/testsuite/gcc.target/arm/bfloat16_simd_2_2.c +++ b/gcc/testsuite/gcc.target/arm/bfloat16_simd_2_2.c @@ -1,4 +1,5 @@ /* { dg-do assemble { target { arm*-*-* } } } */ +/* { dg-require-effective-target arm_softfp_ok } */ /* { dg-require-effective-target arm_v8_neon_ok } */ /* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */ /* { dg-additional-options "-march=armv8.2-a -mfloat-abi=softfp -mfpu=neon-fp-armv8" } */ diff --git a/gcc/testsuite/gcc.target/arm/bfloat16_simd_3_1.c b/gcc/testsuite/gcc.target/arm/bfloat16_simd_3_1.c index b9b7606..d2326c2 100644 --- a/gcc/testsuite/gcc.target/arm/bfloat16_simd_3_1.c +++ b/gcc/testsuite/gcc.target/arm/bfloat16_simd_3_1.c @@ -1,4 +1,5 @@ /* { dg-do assemble { target { arm*-*-* } } } */ +/* { dg-require-effective-target arm_hard_ok } */ /* { dg-require-effective-target arm_v8_neon_ok } */ /* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */ /* { dg-additional-options "-march=armv8.2-a -mfloat-abi=hard -mfpu=neon-fp-armv8" } */ diff --git a/gcc/testsuite/gcc.target/arm/bfloat16_simd_3_2.c b/gcc/testsuite/gcc.target/arm/bfloat16_simd_3_2.c index ab1fe10..346253b 100644 --- a/gcc/testsuite/gcc.target/arm/bfloat16_simd_3_2.c +++ b/gcc/testsuite/gcc.target/arm/bfloat16_simd_3_2.c @@ -1,4 +1,5 @@ /* { dg-do assemble { target { arm*-*-* } } } */ +/* { dg-require-effective-target arm_softfp_ok } */ /* { dg-require-effective-target arm_v8_neon_ok } */ /* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */ /* { dg-additional-options "-march=armv8.2-a -mfloat-abi=softfp -mfpu=neon-fp-armv8" } */ diff --git a/gcc/testsuite/gcc.target/arm/pr51968.c b/gcc/testsuite/gcc.target/arm/pr51968.c index 7814702..c06da48 100644 --- a/gcc/testsuite/gcc.target/arm/pr51968.c +++ b/gcc/testsuite/gcc.target/arm/pr51968.c @@ -1,7 +1,8 @@ /* PR target/51968 */ /* { dg-do compile } */ -/* { dg-options "-O2 -march=armv7-a -mfloat-abi=softfp -mfpu=neon" } */ +/* { dg-require-effective-target arm_softfp_ok } */ /* { dg-require-effective-target arm_neon_ok } */ +/* { dg-options "-O2 -march=armv7-a -mfloat-abi=softfp -mfpu=neon" } */ #include struct T { int8x8x2_t val; }; diff --git a/gcc/testsuite/gcc.target/arm/simd/bf16_vldn_1.c b/gcc/testsuite/gcc.target/arm/simd/bf16_vldn_1.c index 663e769..4d91614 100644 --- a/gcc/testsuite/gcc.target/arm/simd/bf16_vldn_1.c +++ b/gcc/testsuite/gcc.target/arm/simd/bf16_vldn_1.c @@ -1,4 +1,5 @@ /* { dg-do assemble } */ +/* { dg-require-effective-target arm_hard_ok } */ /* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */ /* { dg-add-options arm_v8_2a_bf16_neon } */ /* { dg-additional-options "-save-temps -O2 -mfloat-abi=hard" } */ diff --git a/gcc/testsuite/gcc.target/arm/simd/bf16_vstn_1.c b/gcc/testsuite/gcc.target/arm/simd/bf16_vstn_1.c index 2657b6f..5c6cdd5 100644 --- a/gcc/testsuite/gcc.target/arm/simd/bf16_vstn_1.c +++ b/gcc/testsuite/gcc.target/arm/simd/bf16_vstn_1.c @@ -1,4 +1,5 @@ /* { dg-do assemble } */ +/* { dg-require-effective-target arm_hard_ok } */ /* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */ /* { dg-add-options arm_v8_2a_bf16_neon } */ /* { dg-additional-options "-save-temps -O2 -mfloat-abi=hard" } */ -- cgit v1.1 From 1843341b12933a86380cc201c845cb9d732a377f Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Sun, 26 Apr 2020 18:56:11 +0000 Subject: testsuite/arm: Add arm_hard_ok check in armv8_2-fp16-scalar-2.c This test relies on -mfloat-abi=hard to pass (otherwise test_mov_imm_[12] directly build the 1.0 fp16 representation via movw r0, #15360 rather than using vmov.f16 s0, #1.0e+0 as expected by scan-assembler-times) Adding the arm_hard_ok check makes the test unsupported eg. on arm-linux-gnueabi instead of reporting a failure. 2021-03-20 Christophe Lyon gcc/testsuite/ * gcc.target/arm/armv8_2-fp16-scalar-2.c: Add arm_hard_ok. --- gcc/testsuite/gcc.target/arm/armv8_2-fp16-scalar-2.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/arm/armv8_2-fp16-scalar-2.c b/gcc/testsuite/gcc.target/arm/armv8_2-fp16-scalar-2.c index fa4828d..de5adf3 100644 --- a/gcc/testsuite/gcc.target/arm/armv8_2-fp16-scalar-2.c +++ b/gcc/testsuite/gcc.target/arm/armv8_2-fp16-scalar-2.c @@ -1,7 +1,9 @@ /* { dg-do compile } */ +/* { dg-require-effective-target arm_hard_ok } */ /* { dg-require-effective-target arm_v8_2a_fp16_scalar_ok } */ /* { dg-options "-O2 -std=c11" } */ /* { dg-add-options arm_v8_2a_fp16_scalar } */ +/* { dg-additional-options "-mfloat-abi=hard" } */ /* Test compiler use of FP16 instructions. */ #include -- cgit v1.1 From bed1736f3aa3909649617dd402d13db1fa8ef5d4 Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Mon, 20 Apr 2020 15:40:54 +0000 Subject: testsuite/arm: Fix -mfloat-abi order in arm_v8_2a_bf16_neon_ok_nocache and arm_v8_2a_i8mm_ok_nocache Make the order in which we try -mfloat-abi options consistent with the other similar effective targets: try softfp first, then hard. This shows that a few tests implicitly rely on -mfloat-abi=hard, so we now check arm_hard_ok where needed. This makes these tests unsupported rather than fail on arm-linux-gnueabi. 2021-03-19 Christophe Lyon gcc/testsuite/ * lib/target-supports.exp (check_effective_target_arm_v8_2a_i8mm_ok_nocache): Fix -mfloat-abi= options order. (check_effective_target_arm_v8_2a_bf16_neon_ok_nocache): Likewise. * gcc.target/arm/bfloat16_scalar_1_1.c: Add arm_hard_ok effective target and -mfloat-abi=hard additional option. * gcc.target/arm/bfloat16_simd_1_1.c: Likewise. * gcc.target/arm/simd/bf16_ma_1.c: Likewise. * gcc.target/arm/simd/bf16_mmla_1.c: Likewise. * gcc.target/arm/simd/vdot-2-1.c: Likewise. * gcc.target/arm/simd/vdot-2-2.c: Likewise. --- gcc/testsuite/gcc.target/arm/bfloat16_scalar_1_1.c | 3 ++- gcc/testsuite/gcc.target/arm/bfloat16_simd_1_1.c | 3 ++- gcc/testsuite/gcc.target/arm/simd/bf16_ma_1.c | 3 ++- gcc/testsuite/gcc.target/arm/simd/bf16_mmla_1.c | 3 ++- gcc/testsuite/gcc.target/arm/simd/vdot-2-1.c | 3 ++- gcc/testsuite/gcc.target/arm/simd/vdot-2-2.c | 3 ++- gcc/testsuite/lib/target-supports.exp | 4 ++-- 7 files changed, 14 insertions(+), 8 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/arm/bfloat16_scalar_1_1.c b/gcc/testsuite/gcc.target/arm/bfloat16_scalar_1_1.c index efcc561..7a6c177 100644 --- a/gcc/testsuite/gcc.target/arm/bfloat16_scalar_1_1.c +++ b/gcc/testsuite/gcc.target/arm/bfloat16_scalar_1_1.c @@ -1,7 +1,8 @@ /* { dg-do assemble { target { arm*-*-* } } } */ +/* { dg-require-effective-target arm_hard_ok } */ /* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */ /* { dg-add-options arm_v8_2a_bf16_neon } */ -/* { dg-additional-options "-O3 --save-temps -std=gnu90" } */ +/* { dg-additional-options "-O3 --save-temps -std=gnu90 -mfloat-abi=hard" } */ /* { dg-final { check-function-bodies "**" "" } } */ #include diff --git a/gcc/testsuite/gcc.target/arm/bfloat16_simd_1_1.c b/gcc/testsuite/gcc.target/arm/bfloat16_simd_1_1.c index cad7d54..72b4a1b 100644 --- a/gcc/testsuite/gcc.target/arm/bfloat16_simd_1_1.c +++ b/gcc/testsuite/gcc.target/arm/bfloat16_simd_1_1.c @@ -1,7 +1,8 @@ /* { dg-do assemble { target { arm*-*-* } } } */ +/* { dg-require-effective-target arm_hard_ok } */ /* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */ /* { dg-add-options arm_v8_2a_bf16_neon } */ -/* { dg-additional-options "-O3 --save-temps -std=gnu90" } */ +/* { dg-additional-options "-O3 --save-temps -std=gnu90 -mfloat-abi=hard" } */ /* { dg-final { check-function-bodies "**" "" } } */ #include diff --git a/gcc/testsuite/gcc.target/arm/simd/bf16_ma_1.c b/gcc/testsuite/gcc.target/arm/simd/bf16_ma_1.c index 6729af7..c043049 100644 --- a/gcc/testsuite/gcc.target/arm/simd/bf16_ma_1.c +++ b/gcc/testsuite/gcc.target/arm/simd/bf16_ma_1.c @@ -1,7 +1,8 @@ /* { dg-do assemble } */ +/* { dg-require-effective-target arm_hard_ok } */ /* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */ /* { dg-add-options arm_v8_2a_bf16_neon } */ -/* { dg-additional-options "-save-temps -O2" } */ +/* { dg-additional-options "-save-temps -O2 -mfloat-abi=hard" } */ /* { dg-final { check-function-bodies "**" "" } } */ #include "arm_neon.h" diff --git a/gcc/testsuite/gcc.target/arm/simd/bf16_mmla_1.c b/gcc/testsuite/gcc.target/arm/simd/bf16_mmla_1.c index 5f9c85b..cc64e23 100644 --- a/gcc/testsuite/gcc.target/arm/simd/bf16_mmla_1.c +++ b/gcc/testsuite/gcc.target/arm/simd/bf16_mmla_1.c @@ -1,7 +1,8 @@ /* { dg-do assemble } */ +/* { dg-require-effective-target arm_hard_ok } */ /* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */ /* { dg-add-options arm_v8_2a_bf16_neon } */ -/* { dg-additional-options "-save-temps -O2" } */ +/* { dg-additional-options "-save-temps -O2 -mfloat-abi=hard" } */ /* { dg-final { check-function-bodies "**" "" } } */ #include diff --git a/gcc/testsuite/gcc.target/arm/simd/vdot-2-1.c b/gcc/testsuite/gcc.target/arm/simd/vdot-2-1.c index 4d5f07b..88b80cf 100644 --- a/gcc/testsuite/gcc.target/arm/simd/vdot-2-1.c +++ b/gcc/testsuite/gcc.target/arm/simd/vdot-2-1.c @@ -1,7 +1,8 @@ /* { dg-do assemble { target { arm*-*-* } } } */ +/* { dg-require-effective-target arm_hard_ok } */ /* { dg-require-effective-target arm_v8_2a_i8mm_ok } */ /* { dg-add-options arm_v8_2a_i8mm } */ -/* { dg-additional-options "-O -save-temps" } */ +/* { dg-additional-options "-O -save-temps -mfloat-abi=hard" } */ /* { dg-final { check-function-bodies "**" "" } } */ #include diff --git a/gcc/testsuite/gcc.target/arm/simd/vdot-2-2.c b/gcc/testsuite/gcc.target/arm/simd/vdot-2-2.c index b7b76e2..1c74718 100644 --- a/gcc/testsuite/gcc.target/arm/simd/vdot-2-2.c +++ b/gcc/testsuite/gcc.target/arm/simd/vdot-2-2.c @@ -1,7 +1,8 @@ /* { dg-do assemble { target { arm*-*-* } } } */ +/* { dg-require-effective-target arm_hard_ok } */ /* { dg-require-effective-target arm_v8_2a_i8mm_ok } */ /* { dg-add-options arm_v8_2a_i8mm } */ -/* { dg-additional-options "-O -save-temps -mbig-endian" } */ +/* { dg-additional-options "-O -save-temps -mbig-endian -mfloat-abi=hard" } */ /* { dg-final { check-function-bodies "**" "" } } */ #include diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index a90c375..e42d711 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -5267,7 +5267,7 @@ proc check_effective_target_arm_v8_2a_i8mm_ok_nocache { } { # Iterate through sets of options to find the compiler flags that # need to be added to the -march option. - foreach flags {"" "-mfloat-abi=hard -mfpu=neon-fp-armv8" "-mfloat-abi=softfp -mfpu=neon-fp-armv8" } { + foreach flags {"" "-mfloat-abi=softfp -mfpu=neon-fp-armv8" "-mfloat-abi=hard -mfpu=neon-fp-armv8" } { if { [check_no_compiler_messages_nocache \ arm_v8_2a_i8mm_ok object { #include @@ -5352,7 +5352,7 @@ proc check_effective_target_arm_v8_2a_bf16_neon_ok_nocache { } { return 0; } - foreach flags {"" "-mfloat-abi=hard -mfpu=neon-fp-armv8" "-mfloat-abi=softfp -mfpu=neon-fp-armv8" } { + foreach flags {"" "-mfloat-abi=softfp -mfpu=neon-fp-armv8" "-mfloat-abi=hard -mfpu=neon-fp-armv8" } { if { [check_no_compiler_messages_nocache arm_v8_2a_bf16_neon_ok object { #include #if !defined (__ARM_FEATURE_BF16_VECTOR_ARITHMETIC) -- cgit v1.1 From 165bc67beb45f0f7e0d4f41347dab1649436f08a Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Tue, 21 Apr 2020 17:45:02 +0000 Subject: testsuite/arm: Fix -mfloat-abi order in arm_v8_1m_mve_ok_nocache and arm_v8_1m_mve_fp_ok_nocache Make the order in which we try -mfloat-abi options consistent with the other similar effective targets: try softfp first, then hard. This shows that a few tests implicitly rely on -mfloat-abi=hard, so we add this option via dg-additional-options so that it comes after any potential -mfloat-abi option that the preceding effective-targets might have added. armv8_1m-fpXX-move-1.c tests don't need arm_hard_ok because they don't include arm_mve.h: adding -mfloat-abi=hard when using a soft/softfp toolchain does not lead to the missing include gnu/stubs-*.h error. This patch makes armv8_1m-fpXX-move-1.c pass on arm-linux-gnueabi, and the other tests become unsupported (instead of fail) on this target. On arm-eabi with default cpu/fpu/mode and a+rm multilibs, the same mve/intrinsics/* tests become unsupported instead of pass because arm_hard_ok fails with "selected processor lacks an FPU". Since we also override the fpu via dg-options, we'd need another effective target (say arm_hard_mve_ok) that would check -mfloat-abi=hard -mfpu=auto -march=armv8.1-m.main+mve.fp at the same time. But we have already so many arm effective targets, it doesn't seem like a good way forward. 2021-03-19 Christophe Lyon gcc/testsuite/ * lib/target-supports.exp (check_effective_target_arm_v8_1m_mve_fp_ok_nocache): Fix -mfloat-abi= options order. (check_effective_target_arm_v8_1m_mve_ok_nocache): Likewise * gcc.target/arm/mve/intrinsics/mve_vector_float2.c: Add arm_hard_ok effective target and -mfloat-abi=hard additional option. * gcc.target/arm/mve/intrinsics/mve_vector_int.c: Likewise. * gcc.target/arm/mve/intrinsics/mve_vector_uint.c: Likewise. * gcc.target/arm/mve/intrinsics/mve_vector_uint1.c: Likewise. * gcc.target/arm/mve/intrinsics/mve_vector_uint2.c: Likewise. * gcc.target/arm/mve/intrinsics/vgetq_lane_s64.c: Likewise. * gcc.target/arm/mve/intrinsics/vgetq_lane_u64.c: Likewise. * gcc.target/arm/mve/intrinsics/vsetq_lane_s64.c: Likewise. * gcc.target/arm/mve/intrinsics/vsetq_lane_u64.c: Likewise. * gcc.target/arm/armv8_1m-fp16-move-1.c: Add -mfloat-abi=hard additional option. * gcc.target/arm/armv8_1m-fp32-move-1.c: Likewise. * gcc.target/arm/armv8_1m-fp64-move-1.c: Likewise. --- gcc/testsuite/gcc.target/arm/armv8_1m-fp16-move-1.c | 3 ++- gcc/testsuite/gcc.target/arm/armv8_1m-fp32-move-1.c | 3 ++- gcc/testsuite/gcc.target/arm/armv8_1m-fp64-move-1.c | 3 ++- gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_float2.c | 2 ++ gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_int.c | 2 ++ gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_uint.c | 2 ++ gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_uint1.c | 2 ++ gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_uint2.c | 2 ++ gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_s64.c | 3 ++- gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_u64.c | 3 ++- gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_s64.c | 3 ++- gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_u64.c | 3 ++- gcc/testsuite/lib/target-supports.exp | 4 ++-- 13 files changed, 26 insertions(+), 9 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/arm/armv8_1m-fp16-move-1.c b/gcc/testsuite/gcc.target/arm/armv8_1m-fp16-move-1.c index 67a9f41..f5ab6e7 100644 --- a/gcc/testsuite/gcc.target/arm/armv8_1m-fp16-move-1.c +++ b/gcc/testsuite/gcc.target/arm/armv8_1m-fp16-move-1.c @@ -1,7 +1,8 @@ /* { dg-do compile } */ -/* { dg-options "-O -mfloat-abi=hard -mfp16-format=ieee" } */ +/* { dg-options "-O -mfp16-format=ieee" } */ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ +/* { dg-additional-options "-mfloat-abi=hard" } * /* { dg-final { check-function-bodies "**" "" } } */ /* diff --git a/gcc/testsuite/gcc.target/arm/armv8_1m-fp32-move-1.c b/gcc/testsuite/gcc.target/arm/armv8_1m-fp32-move-1.c index 1ecb839..2f62e839 100644 --- a/gcc/testsuite/gcc.target/arm/armv8_1m-fp32-move-1.c +++ b/gcc/testsuite/gcc.target/arm/armv8_1m-fp32-move-1.c @@ -1,7 +1,8 @@ /* { dg-do compile } */ -/* { dg-options "-O -mfloat-abi=hard" } */ +/* { dg-options "-O" } */ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ +/* { dg-additional-options "-mfloat-abi=hard" } * /* { dg-final { check-function-bodies "**" "" } } */ /* diff --git a/gcc/testsuite/gcc.target/arm/armv8_1m-fp64-move-1.c b/gcc/testsuite/gcc.target/arm/armv8_1m-fp64-move-1.c index 3f81350..d236f08 100644 --- a/gcc/testsuite/gcc.target/arm/armv8_1m-fp64-move-1.c +++ b/gcc/testsuite/gcc.target/arm/armv8_1m-fp64-move-1.c @@ -1,7 +1,8 @@ /* { dg-do compile } */ -/* { dg-options "-O -mfloat-abi=hard" } */ +/* { dg-options "-O" } */ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ +/* { dg-additional-options "-mfloat-abi=hard" } * /* { dg-final { check-function-bodies "**" "" } } */ /* diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_float2.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_float2.c index 35f83c6..6728776 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_float2.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_float2.c @@ -1,5 +1,7 @@ +/* { dg-require-effective-target arm_hard_ok } */ /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ /* { dg-add-options arm_v8_1m_mve_fp } */ +/* { dg-additional-options "-mfloat-abi=hard" } */ /* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=soft" } {""} } */ #include "arm_mve.h" diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_int.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_int.c index e70cbc1..029e02f 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_int.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_int.c @@ -1,5 +1,7 @@ +/* { dg-require-effective-target arm_hard_ok } */ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ +/* { dg-additional-options "-mfloat-abi=hard" } */ /* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=soft" } {""} } */ #include "arm_mve.h" diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_uint.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_uint.c index 0c4e763..c158100 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_uint.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_uint.c @@ -1,5 +1,7 @@ +/* { dg-require-effective-target arm_hard_ok } */ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ +/* { dg-additional-options "-mfloat-abi=hard" } */ /* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=soft" } {""} } */ #include "arm_mve.h" diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_uint1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_uint1.c index fce69eb..d30fce0 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_uint1.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_uint1.c @@ -1,5 +1,7 @@ +/* { dg-require-effective-target arm_hard_ok } */ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ +/* { dg-additional-options "-mfloat-abi=hard" } */ /* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=soft" } {""} } */ #include "arm_mve.h" diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_uint2.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_uint2.c index e0d6dcb..ae68914 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_uint2.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vector_uint2.c @@ -1,5 +1,7 @@ +/* { dg-require-effective-target arm_hard_ok } */ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ +/* { dg-additional-options "-mfloat-abi=hard" } */ /* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=soft" } {""} } */ #include "arm_mve.h" diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_s64.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_s64.c index a7457f8..63b2508 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_s64.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_s64.c @@ -1,7 +1,8 @@ /* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=soft" } {""} } */ +/* { dg-require-effective-target arm_hard_ok } */ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ -/* { dg-additional-options "-O2" } */ +/* { dg-additional-options "-mfloat-abi=hard -O2" } */ #include "arm_mve.h" diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_u64.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_u64.c index 3cbbef5..a4b900f 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_u64.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vgetq_lane_u64.c @@ -1,7 +1,8 @@ /* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=soft" } {""} } */ +/* { dg-require-effective-target arm_hard_ok } */ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ -/* { dg-additional-options "-O2" } */ +/* { dg-additional-options "-mfloat-abi=hard -O2" } */ #include "arm_mve.h" diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_s64.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_s64.c index e487b73..430df66 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_s64.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_s64.c @@ -1,7 +1,8 @@ /* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=soft" } {""} } */ +/* { dg-require-effective-target arm_hard_ok } */ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ -/* { dg-additional-options "-O2" } */ +/* { dg-additional-options "-mfloat-abi=hard -O2" } */ #include "arm_mve.h" diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_u64.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_u64.c index ae57b9c..0e04012 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_u64.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_u64.c @@ -1,7 +1,8 @@ /* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=soft" } {""} } */ +/* { dg-require-effective-target arm_hard_ok } */ /* { dg-require-effective-target arm_v8_1m_mve_ok } */ /* { dg-add-options arm_v8_1m_mve } */ -/* { dg-additional-options "-O2" } */ +/* { dg-additional-options "-mfloat-abi=hard -O2" } */ #include "arm_mve.h" diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index e42d711..1af7619 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -5025,7 +5025,7 @@ proc check_effective_target_arm_v8_1m_mve_fp_ok_nocache { } { # Iterate through sets of options to find the compiler flags that # need to be added to the -march option. - foreach flags {"" "-mfloat-abi=hard -mfpu=auto -march=armv8.1-m.main+mve.fp" "-mfloat-abi=softfp -mfpu=auto -march=armv8.1-m.main+mve.fp"} { + foreach flags {"" "-mfloat-abi=softfp -mfpu=auto -march=armv8.1-m.main+mve.fp" "-mfloat-abi=hard -mfpu=auto -march=armv8.1-m.main+mve.fp"} { if { [check_no_compiler_messages_nocache \ arm_v8_1m_mve_fp_ok object { #include @@ -5208,7 +5208,7 @@ proc check_effective_target_arm_v8_1m_mve_ok_nocache { } { # Iterate through sets of options to find the compiler flags that # need to be added to the -march option. - foreach flags {"" "-mfloat-abi=hard -mfpu=auto -march=armv8.1-m.main+mve" "-mfloat-abi=softfp -mfpu=auto -march=armv8.1-m.main+mve"} { + foreach flags {"" "-mfloat-abi=softfp -mfpu=auto -march=armv8.1-m.main+mve" "-mfloat-abi=hard -mfpu=auto -march=armv8.1-m.main+mve"} { if { [check_no_compiler_messages_nocache \ arm_v8_1m_mve_ok object { #if !defined (__ARM_FEATURE_MVE) -- cgit v1.1 From 3c3c0042736846c469cddd70d56eca7239dbad01 Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Tue, 21 Apr 2020 07:31:59 +0000 Subject: testsuite/arm: Add arm_dsp_ok effective target and use it in arm/acle/dsp_arith.c gcc.target/arm/acle/dsp_arith.c uses DSP intrinsics, which arm_acle.h defines only with __ARM_FEATURE_DSP, so make the test check for that property rather than arm_qbit_ok. However, the existing arm_dsp effective target only checks if DSP features are supported with the current multilib rather than trying -march and -mfloat-abi options. Thus we introduce a similar effective target, arm_dsp_ok and associated dg-add-options. This makes dsp_arith.c unsupported rather than failed when no option combination is suitable, for instance when running the tests with -mcpu=cortex-m3. 2021-03-19 Christophe Lyon gcc/ * doc/sourcebuild.texi (arm_dsp_ok, arm_dsp): Document. gcc/testsuite/ * lib/target-supports.exp (check_effective_target_arm_dsp_ok_nocache) (check_effective_target_arm_dsp_ok, add_options_for_arm_dsp): New. * gcc.target/arm/acle/dsp_arith.c: Use arm_dsp_ok effective target and add arm_dsp options. --- gcc/testsuite/gcc.target/arm/acle/dsp_arith.c | 4 +-- gcc/testsuite/lib/target-supports.exp | 40 +++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 2 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/arm/acle/dsp_arith.c b/gcc/testsuite/gcc.target/arm/acle/dsp_arith.c index 9ebd55a..7bf458e 100644 --- a/gcc/testsuite/gcc.target/arm/acle/dsp_arith.c +++ b/gcc/testsuite/gcc.target/arm/acle/dsp_arith.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ -/* { dg-require-effective-target arm_qbit_ok } */ -/* { dg-add-options arm_qbit } */ +/* { dg-require-effective-target arm_dsp_ok } */ +/* { dg-add-options arm_dsp } */ #include diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 1af7619..733b6c8 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -4200,6 +4200,46 @@ proc add_options_for_arm_qbit { flags } { return "$flags $et_arm_qbit_flags" } +# Return 1 if this is an ARM target supporting the DSP intrinsics from +# arm_acle.h. Some multilibs may be incompatible with these options. +# Also set et_arm_dsp_flags to the best options to add. +# arm_acle.h includes stdint.h which can cause trouble with incompatible +# -mfloat-abi= options. +# check_effective_target_arm_dsp also exists, which checks the current +# multilib, without trying other options. + +proc check_effective_target_arm_dsp_ok_nocache { } { + global et_arm_dsp_flags + set et_arm_dsp_flags "" + foreach flags {"" "-march=armv5te" "-march=armv5te -mfloat-abi=softfp" "-march=armv5te -mfloat-abi=hard"} { + if { [check_no_compiler_messages_nocache et_arm_dsp_ok object { + #include + int dummy; + #ifndef __ARM_FEATURE_DSP + #error not DSP + #endif + } "$flags"] } { + set et_arm_dsp_flags $flags + return 1 + } + } + + return 0 +} + +proc check_effective_target_arm_dsp_ok { } { + return [check_cached_effective_target et_arm_dsp_flags \ + check_effective_target_arm_dsp_ok_nocache] +} + +proc add_options_for_arm_dsp { flags } { + if { ! [check_effective_target_arm_dsp_ok] } { + return "$flags" + } + global et_arm_dsp_flags + return "$flags $et_arm_dsp_flags" +} + # Return 1 if this is an ARM target supporting -mfpu=neon without any # -mfloat-abi= option. Useful in tests where add_options is not # supported (such as lto tests). -- cgit v1.1 From 6b1f841ce0ccf30eda7896ba5ab0aa94c72307b2 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 23 Mar 2021 16:29:47 +0100 Subject: Add forgotten attribution on PR target/99593 testcase. --- gcc/testsuite/ChangeLog | 1 + 1 file changed, 1 insertion(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 809fc2f..94da0fa 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -85,6 +85,7 @@ * gcc.target/i386/pr96744-1.c: Likewise. 2021-03-19 Jakub Jelinek + Christophe Lyon PR target/99593 * g++.target/arm/pr99593.C: New test. -- cgit v1.1 From b61461ac7f9bdd0e98145be79423d19b933afaa0 Mon Sep 17 00:00:00 2001 From: Ilya Leoshkevich Date: Tue, 2 Mar 2021 23:37:26 +0100 Subject: fwprop: Fix single_use_p calculation Commit efb6bc55a93a ("fwprop: Allow (subreg (mem)) simplifications") introduced a check that was supposed to look at the propagated def's number of uses. It uses insn_info::num_uses (), which in reality returns the number of uses def's insn has. The whole change therefore works only by accident. Fix by looking at set_info's uses instead of insn_info's uses. This requires passing around set_info instead of insn_info. gcc/ChangeLog: 2021-03-02 Ilya Leoshkevich * fwprop.c (fwprop_propagation::fwprop_propagation): Look at set_info's uses. (try_fwprop_subst_note): Use set_info instead of insn_info. (try_fwprop_subst_pattern): Likewise. (try_fwprop_subst_notes): Likewise. (try_fwprop_subst): Likewise. (forward_propagate_subreg): Likewise. (forward_propagate_and_simplify): Likewise. (forward_propagate_into): Likewise. * rtl-ssa/accesses.h (set_info::single_nondebug_use) New method. (set_info::single_nondebug_insn_use): Likewise. (set_info::single_phi_use): Likewise. * rtl-ssa/member-fns.inl (set_info::single_nondebug_use) New method. (set_info::single_nondebug_insn_use): Likewise. (set_info::single_phi_use): Likewise. gcc/testsuite/ChangeLog: * gcc.target/s390/vector/long-double-asm-abi.c: New test. --- .../gcc.target/s390/vector/long-double-asm-abi.c | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 gcc/testsuite/gcc.target/s390/vector/long-double-asm-abi.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-asm-abi.c b/gcc/testsuite/gcc.target/s390/vector/long-double-asm-abi.c new file mode 100644 index 0000000..f9f2d12 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/vector/long-double-asm-abi.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */ +/* { dg-do run { target { s390_z14_hw } } } */ +#include +#include + +__attribute__ ((noipa)) static long double +xsqrt (long double x) +{ + long double res; + asm("sqxbr\t%0,%1" : "=f"(res) : "f"(x)); + return res; +} + +/* Check that the generated code is very small and straightforward. In + particular, there must be no unnecessary copying and no stack frame. */ +/* { dg-final { scan-assembler {\n\tld\t[^\n]*\n\tld\t[^\n]*\n(#[^\n]*\n)*\tsqxbr\t.*\n(#[^\n]*\n)*\tstd\t[^\n]*\n\tstd\t[^\n]*\n\tbr\t%r14\n} } } */ + +int +main (void) +{ + long double res, x = 0x1.0000000000001p+0L, + exp = 1.00000000000000011102230246251564788e+0L; + res = xsqrt (x); + assert (res == exp); +} -- cgit v1.1 From bd71889b9017751e1a06970d20b28b9fe9479bdc Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Tue, 23 Mar 2021 12:23:30 -0700 Subject: c++: Note duplicates in symbol table [PR 99283] I ran into this reducing 99283, we were failing to mark binding vectors when the current TU declares a duplicate decl (as opposed to an import introduces a duplicate). PR c++/99283 gcc/cp/ * name-lookup.c (check_module_override): Set global or partition DUP on the binding vector. gcc/testsuite/ * g++.dg/modules/pr99283-1_a.H: New. * g++.dg/modules/pr99283-1_b.H: New. --- gcc/testsuite/g++.dg/modules/pr99283-1_a.H | 6 ++++++ gcc/testsuite/g++.dg/modules/pr99283-1_b.H | 10 ++++++++++ 2 files changed, 16 insertions(+) create mode 100644 gcc/testsuite/g++.dg/modules/pr99283-1_a.H create mode 100644 gcc/testsuite/g++.dg/modules/pr99283-1_b.H (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/modules/pr99283-1_a.H b/gcc/testsuite/g++.dg/modules/pr99283-1_a.H new file mode 100644 index 0000000..95c8c06 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr99283-1_a.H @@ -0,0 +1,6 @@ +// PR 99283 part 1 ICE on specialization +// { dg-additional-options -fmodule-header } +// { dg-module-cmi {} } + +template +_Facet &use_facet (); diff --git a/gcc/testsuite/g++.dg/modules/pr99283-1_b.H b/gcc/testsuite/g++.dg/modules/pr99283-1_b.H new file mode 100644 index 0000000..cd15a1b --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr99283-1_b.H @@ -0,0 +1,10 @@ +// { dg-additional-options -fmodule-header } +// { dg-module-cmi {} } + +import "pr99283-1_a.H"; + +template +_Facet &use_facet (); + +extern template +char &use_facet (); -- cgit v1.1 From bf1f3168f474734400e7a97660d1e7dec664bca9 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 24 Mar 2021 00:16:25 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 130 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 94da0fa..8ee6b10 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,133 @@ +2021-03-23 Nathan Sidwell + + PR c++/99283 + * g++.dg/modules/pr99283-1_a.H: New. + * g++.dg/modules/pr99283-1_b.H: New. + +2021-03-23 Ilya Leoshkevich + + * gcc.target/s390/vector/long-double-asm-abi.c: New test. + +2021-03-23 Christophe Lyon + + * lib/target-supports.exp + (check_effective_target_arm_dsp_ok_nocache) + (check_effective_target_arm_dsp_ok, add_options_for_arm_dsp): New. + * gcc.target/arm/acle/dsp_arith.c: Use arm_dsp_ok effective target + and add arm_dsp options. + +2021-03-23 Christophe Lyon + + * lib/target-supports.exp + (check_effective_target_arm_v8_1m_mve_fp_ok_nocache): Fix + -mfloat-abi= options order. + (check_effective_target_arm_v8_1m_mve_ok_nocache): Likewise + * gcc.target/arm/mve/intrinsics/mve_vector_float2.c: Add + arm_hard_ok effective target and -mfloat-abi=hard additional + option. + * gcc.target/arm/mve/intrinsics/mve_vector_int.c: Likewise. + * gcc.target/arm/mve/intrinsics/mve_vector_uint.c: Likewise. + * gcc.target/arm/mve/intrinsics/mve_vector_uint1.c: Likewise. + * gcc.target/arm/mve/intrinsics/mve_vector_uint2.c: Likewise. + * gcc.target/arm/mve/intrinsics/vgetq_lane_s64.c: Likewise. + * gcc.target/arm/mve/intrinsics/vgetq_lane_u64.c: Likewise. + * gcc.target/arm/mve/intrinsics/vsetq_lane_s64.c: Likewise. + * gcc.target/arm/mve/intrinsics/vsetq_lane_u64.c: Likewise. + * gcc.target/arm/armv8_1m-fp16-move-1.c: Add -mfloat-abi=hard + additional option. + * gcc.target/arm/armv8_1m-fp32-move-1.c: Likewise. + * gcc.target/arm/armv8_1m-fp64-move-1.c: Likewise. + +2021-03-23 Christophe Lyon + + * lib/target-supports.exp + (check_effective_target_arm_v8_2a_i8mm_ok_nocache): Fix + -mfloat-abi= options order. + (check_effective_target_arm_v8_2a_bf16_neon_ok_nocache): Likewise. + * gcc.target/arm/bfloat16_scalar_1_1.c: Add arm_hard_ok effective + target and -mfloat-abi=hard additional option. + * gcc.target/arm/bfloat16_simd_1_1.c: Likewise. + * gcc.target/arm/simd/bf16_ma_1.c: Likewise. + * gcc.target/arm/simd/bf16_mmla_1.c: Likewise. + * gcc.target/arm/simd/vdot-2-1.c: Likewise. + * gcc.target/arm/simd/vdot-2-2.c: Likewise. + +2021-03-23 Christophe Lyon + + * gcc.target/arm/armv8_2-fp16-scalar-2.c: Add arm_hard_ok. + +2021-03-23 Christophe Lyon + + * gcc.target/arm/bfloat16_simd_1_2.c: Add arm_softfp_ok. + * gcc.target/arm/bfloat16_simd_2_2.c: Likewise. + * gcc.target/arm/bfloat16_simd_3_2.c: Likewise. + * gcc.target/arm/pr51968.c: Likewise. + * gcc.target/arm/bfloat16_simd_2_1.c: arm_hard_ok. + * gcc.target/arm/bfloat16_simd_3_1.c: Likewise. + * gcc.target/arm/simd/bf16_vldn_1.c: Likewise. + * gcc.target/arm/simd/bf16_vstn_1.c: Likewise. + +2021-03-23 Christophe Lyon + + * gcc.target/arm/armv8_1m-shift-imm-1.c: Remove -mfloat=abi option. + * gcc.target/arm/armv8_1m-shift-reg-1.c: Likewise. + * gcc.target/arm/bf16_dup.c: Likewise. + * gcc.target/arm/bf16_reinterpret.c: Likewise. + * gcc.target/arm/pr51534.c: Remove -mfloat=abi option. + +2021-03-23 Christophe Lyon + + * gcc.target/arm/simd/vmmla_1.c: Add arm_v8_2a_i8mm options. + +2021-03-23 Christophe Lyon + + * gcc.target/arm/bfloat16_scalar_typecheck.c: Add + arm_v8_2a_fp16_neon and arm_v8_2a_bf16_neon. + * gcc.target/arm/bfloat16_vector_typecheck_1.c: Likewise. + * gcc.target/arm/bfloat16_vector_typecheck_2.c: Likewise. + +2021-03-23 Marek Polacek + + PR c++/99318 + * g++.dg/cpp0x/attributes-namespace6.C: New test. + * g++.dg/cpp0x/gen-attrs-73.C: New test. + +2021-03-23 Tobias Burnus + + PR fortran/93660 + * gfortran.dg/gomp/declare-simd-coarray-lib.f90: New test. + +2021-03-23 Richard Sandiford + + PR target/99540 + * gcc.dg/vect/pr99540.c: New test. + +2021-03-23 Nathan Sidwell + + PR c++/99239 + * g++.dg/modules/pr99239_a.H: New. + * g++.dg/modules/pr99239_b.H: New. + +2021-03-23 Richard Biener + + PR tree-optimization/99721 + * gfortran.dg/vect/pr99721.f90: New testcase. + +2021-03-23 Marcus Comstedt + + * gcc.target/riscv/shift-shift-5.c (sub): Change + order of struct fields depending on byteorder. + +2021-03-23 Jakub Jelinek + + PR c++/99650 + * g++.dg/cpp1z/decomp55.C: New test. + +2021-03-23 Aldy Hernandez + + PR tree-optimization/99296 + * gcc.dg/pr99296.c: New file. + 2021-03-22 Nathan Sidwell PR c++/99480 -- cgit v1.1 From b179026a5d9fcadadef6ca511933933672557495 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Wed, 24 Mar 2021 07:50:22 +0100 Subject: Fortran: Extend buffer, use snprintf to avoid overflows [PR99369] gcc/fortran/ChangeLog: PR fortran/99369 * resolve.c (resolve_operator): Make 'msg' buffer larger and use snprintf. gcc/testsuite/ChangeLog: PR fortran/99369 * gfortran.dg/longnames.f90: New test. --- gcc/testsuite/gfortran.dg/longnames.f90 | 92 +++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/longnames.f90 (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gfortran.dg/longnames.f90 b/gcc/testsuite/gfortran.dg/longnames.f90 new file mode 100644 index 0000000..046179e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/longnames.f90 @@ -0,0 +1,92 @@ +! { dg-do compile } +! +! PR fortran/99369 +! +! Contributed by G. Steinmetz +! + +module m1bcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabc + type tabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabc + end type + interface operator (.oabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabc.) + procedure fabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabc + end interface +contains + function fabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabc & + (uabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabc, & + vabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabc) + type (tabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabc), intent(in) :: & + uabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabc, & + vabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabc + end +end +subroutine p1 + use m1bcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabc + type (tabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabc) :: & + uabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabc, & + vabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabc + wabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabc = & + uabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabc & + .oabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabc. & + vabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabc +end + + +module m2bcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcd + type tabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcd + end type + interface operator (.oabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcd.) + procedure fabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcd + end interface +contains + function fabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcd & + (uabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcd, & + vabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcd) + type (tabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcd), intent(in) :: & + uabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcd, & + vabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcd + end +end +subroutine p2 + use m2bcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcd + type (tabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcd) :: & + uabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcd, & + vabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcd + wabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcd = & + uabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcd & + .oabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcd. & + vabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcd +end + + +module m3bcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzab + type tabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzab + end type + interface operator (.oabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzab.) + procedure fabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzab + end interface +contains + function fabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzab & + (uabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzab, & + vabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzab) + type (tabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzab), intent(in) :: & + uabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzab, & + vabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzab + end +end +subroutine p3 + use m3bcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzab + type (tabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzab) :: & + uabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzab, & + vabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzab + wabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzab = & + uabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzab & + .oabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzab. & + vabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzabcdefgxyzab +end + +program main + call p1 + call p2 + call p3 +end -- cgit v1.1 From 4be312862dec5c8e49c76249dd5aed220c72039e Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Wed, 24 Mar 2021 05:44:35 -0300 Subject: fix ssse3_pshufbv8qi3 post-reload const pool load The split in ssse3_pshufbv8qi3 forces a const vector into the constant pool, and loads from it. That runs after reload, so if the load requires any reloading, we're out of luck. Indeed, if the load address is not legitimate, e.g. -mcmodel=large, the insn is no longer recognized. This patch turns the constant into an input operand, introduces an expander to generate the constant unconditionally, and arranges for this input operand to be retained as an unused immediate in the alternatives that don't undergo splitting, and for it to be loaded into the scratch register for those that do. It is now the register allocator that arranges to load the const vector into a register, so it deals with whatever legitimizing steps needed for the target configuration. for gcc/ChangeLog * config/i386/predicates.md (reg_or_const_vec_operand): New. * config/i386/sse.md (ssse3_pshufbv8qi3): Add an expander for the now *-prefixed insn_and_split, turn the splitter const vec into an input for the insn, making it an ignored immediate for non-split cases, and loaded into the scratch register otherwise. for gcc/testsuite/ChangeLog * gcc.target/i386/pr94467-3.c: New. --- gcc/testsuite/gcc.target/i386/pr94467-3.c | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr94467-3.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/i386/pr94467-3.c b/gcc/testsuite/gcc.target/i386/pr94467-3.c new file mode 100644 index 0000000..b415847 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr94467-3.c @@ -0,0 +1,4 @@ +/* { dg-do compile { target { lp64 } } } */ +/* { dg-options "-O -mavx -mcmodel=large" } */ + +#include "pr94467-1.c" -- cgit v1.1 From d42ab6885a46d73903643c24a4f65fbf28dd0ec2 Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Wed, 24 Mar 2021 05:44:36 -0300 Subject: tighten funcspec regexps In -mcmodel=large, callee symbols are pulled ahead of the call insns. The patterns in funcspec-[12].c tests in gcc.target/i386 match even line breaks between 'call' and a function symbol expected to be called, however, so it ends up unexpectedly matching a previous, unrelated indirect call, up to the insn that loads the address of the intended callee to a register, for all but the first callee, that doesn't have a call insn before it. All of these apparent passes are false positives. We are NOT generating the expected call insns. This patch fixes only the patterns, so that they won't trigger false positives any more. There are several dozens of other tests that fail with -mcmodel=large for similar reasons, but I'm still not sure about how to deal with them. I see no point in holding up this small improvement over the lack of a larger solution of a different problem, though. for gcc/testsuite/ChangeLog * gcc.target/i386/funcspec-2.c: Tighten regexps to avoid false positives with -mcmodel=large. * gcc.target/i386/funcspec-3.c: Likewise. --- gcc/testsuite/gcc.target/i386/funcspec-2.c | 16 ++++++++-------- gcc/testsuite/gcc.target/i386/funcspec-3.c | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/i386/funcspec-2.c b/gcc/testsuite/gcc.target/i386/funcspec-2.c index d607fbc..147f623 100644 --- a/gcc/testsuite/gcc.target/i386/funcspec-2.c +++ b/gcc/testsuite/gcc.target/i386/funcspec-2.c @@ -89,11 +89,11 @@ int main () /* { dg-final { scan-assembler "vfnmaddsd" } } */ /* { dg-final { scan-assembler "vfnmsubss" } } */ /* { dg-final { scan-assembler "vfnmsubsd" } } */ -/* { dg-final { scan-assembler "call\t(.*)flt_mul_add" } } */ -/* { dg-final { scan-assembler "call\t(.*)flt_mul_sub" } } */ -/* { dg-final { scan-assembler "call\t(.*)flt_neg_mul_add" } } */ -/* { dg-final { scan-assembler "call\t(.*)flt_neg_mul_sub" } } */ -/* { dg-final { scan-assembler "call\t(.*)dbl_mul_add" } } */ -/* { dg-final { scan-assembler "call\t(.*)dbl_mul_sub" } } */ -/* { dg-final { scan-assembler "call\t(.*)dbl_neg_mul_add" } } */ -/* { dg-final { scan-assembler "call\t(.*)dbl_neg_mul_sub" } } */ +/* { dg-final { scan-assembler "call\t(\[^\n\r\]*)flt_mul_add" } } */ +/* { dg-final { scan-assembler "call\t(\[^\n\r\]*)flt_mul_sub" } } */ +/* { dg-final { scan-assembler "call\t(\[^\n\r\]*)flt_neg_mul_add" } } */ +/* { dg-final { scan-assembler "call\t(\[^\n\r\]*)flt_neg_mul_sub" } } */ +/* { dg-final { scan-assembler "call\t(\[^\n\r\]*)dbl_mul_add" } } */ +/* { dg-final { scan-assembler "call\t(\[^\n\r\]*)dbl_mul_sub" } } */ +/* { dg-final { scan-assembler "call\t(\[^\n\r\]*)dbl_neg_mul_add" } } */ +/* { dg-final { scan-assembler "call\t(\[^\n\r\]*)dbl_neg_mul_sub" } } */ diff --git a/gcc/testsuite/gcc.target/i386/funcspec-3.c b/gcc/testsuite/gcc.target/i386/funcspec-3.c index 613a1a0..8fb425b 100644 --- a/gcc/testsuite/gcc.target/i386/funcspec-3.c +++ b/gcc/testsuite/gcc.target/i386/funcspec-3.c @@ -63,6 +63,6 @@ int main () /* { dg-final { scan-assembler "popcntl" { target { ! *-*-darwin* } } } } */ /* { dg-final { scan-assembler "popcntq" { target { ! *-*-darwin* } } } } */ /* { dg-final { scan-assembler-times "popcnt" 2 { target *-*-darwin* } } } */ -/* { dg-final { scan-assembler "call\t(.*)sse4a_pop_i" } } */ -/* { dg-final { scan-assembler "call\t(.*)sse42_pop_l" } } */ -/* { dg-final { scan-assembler "call\t(.*)popcountdi2" } } */ +/* { dg-final { scan-assembler "call\t(\[^\n\r\]*)sse4a_pop_i" } } */ +/* { dg-final { scan-assembler "call\t(\[^\n\r\]*)sse42_pop_l" } } */ +/* { dg-final { scan-assembler "call\t(\[^\n\r\]*)popcountdi2" } } */ -- cgit v1.1 From 9eec7c7686aedc79853699549d1c9eee0a0a84fd Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Wed, 24 Mar 2021 05:44:39 -0300 Subject: require et feature pie for PIE tests Both of these tests fail on platforms that reject -fPIC/-fPIE altogether. Other tests that perform PIE compilation or linking require the pie feature, whether for -fpie/-fPIE compilation or for -pie linking. This patch annotates both tests with the required target feature. for gcc/testsuite/ChangeLog * gcc.target/i386/pr97313.c: Require effective target feature pie. * g++.target/i386/pr94185.C: Likewise. --- gcc/testsuite/g++.target/i386/pr94185.C | 1 + gcc/testsuite/gcc.target/i386/pr97313.c | 1 + 2 files changed, 2 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.target/i386/pr94185.C b/gcc/testsuite/g++.target/i386/pr94185.C index 2b3f7a1..ed39980 100644 --- a/gcc/testsuite/g++.target/i386/pr94185.C +++ b/gcc/testsuite/g++.target/i386/pr94185.C @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fPIE -fstack-protector-strong" } */ +/* { dg-require-effective-target pie } */ struct a { int b; diff --git a/gcc/testsuite/gcc.target/i386/pr97313.c b/gcc/testsuite/gcc.target/i386/pr97313.c index ef93cf1..711766b 100644 --- a/gcc/testsuite/gcc.target/i386/pr97313.c +++ b/gcc/testsuite/gcc.target/i386/pr97313.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fPIE" } */ +/* { dg-require-effective-target pie } */ typedef struct { int unspecified : 1; -- cgit v1.1 From 65cfa2fed39c76498e7c3dfe138bddb049d60dd7 Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Wed, 24 Mar 2021 05:50:37 -0300 Subject: run sysconf-requiring test on systems that support it Some gcc.target/i386 tests requires the mmap feature, but that's not enough for the test to be able to call sysconf. This patch introduces a sysconf feature, analogous to mmap, and adds it to tests in gcc.target/i386 that call sysconf. There are other tests within gcc.dg and g++.dg that call sysconf, but I haven't added the tag to them, because they already cover it with target triplets. I was a little nervous about dropping the triplets, and saw how they implied sysconf, so I left those alone. for gcc/ChangeLog * doc/sourcebuild.texi (sysconf): New effective target. for gcc/testsuite/ChangeLog * lib/target-supports.exp (check_effective_target_sysconf): New. * gcc.target/i386/pr95443-1.c: Require it. * gcc.target/i386/pr95443-2.c: Likewise. * gcc.target/i386/sse2-mmx-maskmovq.c: Likewise. * gcc.target/i386/strncmp-1.c: Likewise. --- gcc/testsuite/gcc.target/i386/pr95443-1.c | 2 +- gcc/testsuite/gcc.target/i386/pr95443-2.c | 2 +- gcc/testsuite/gcc.target/i386/sse2-mmx-maskmovq.c | 2 +- gcc/testsuite/gcc.target/i386/strncmp-1.c | 2 +- gcc/testsuite/lib/target-supports.exp | 6 ++++++ 5 files changed, 10 insertions(+), 4 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/i386/pr95443-1.c b/gcc/testsuite/gcc.target/i386/pr95443-1.c index 698dfa0..d846fcb 100644 --- a/gcc/testsuite/gcc.target/i386/pr95443-1.c +++ b/gcc/testsuite/gcc.target/i386/pr95443-1.c @@ -1,4 +1,4 @@ -/* { dg-do run { target mmap } } */ +/* { dg-do run { target { sysconf && mmap } } } */ /* { dg-options "-O2 -minline-all-stringops" } */ #include diff --git a/gcc/testsuite/gcc.target/i386/pr95443-2.c b/gcc/testsuite/gcc.target/i386/pr95443-2.c index 23bb13a..2ab2606 100644 --- a/gcc/testsuite/gcc.target/i386/pr95443-2.c +++ b/gcc/testsuite/gcc.target/i386/pr95443-2.c @@ -1,4 +1,4 @@ -/* { dg-do run { target mmap } } */ +/* { dg-do run { target { sysconf && mmap } } } */ /* { dg-options "-O2 -minline-all-stringops" } */ #include diff --git a/gcc/testsuite/gcc.target/i386/sse2-mmx-maskmovq.c b/gcc/testsuite/gcc.target/i386/sse2-mmx-maskmovq.c index 037f665..87705be 100644 --- a/gcc/testsuite/gcc.target/i386/sse2-mmx-maskmovq.c +++ b/gcc/testsuite/gcc.target/i386/sse2-mmx-maskmovq.c @@ -1,4 +1,4 @@ -/* { dg-do run { target mmap } } */ +/* { dg-do run { target { sysconf && mmap } } } */ /* { dg-options "-O2 -fno-strict-aliasing -msse2" } */ /* { dg-additional-options "-mno-mmx" { target { ! ia32 } } } */ diff --git a/gcc/testsuite/gcc.target/i386/strncmp-1.c b/gcc/testsuite/gcc.target/i386/strncmp-1.c index 044fc5c..1ea3e0a 100644 --- a/gcc/testsuite/gcc.target/i386/strncmp-1.c +++ b/gcc/testsuite/gcc.target/i386/strncmp-1.c @@ -1,4 +1,4 @@ -/* { dg-do run { target mmap } } */ +/* { dg-do run { target { sysconf && mmap } } } */ /* { dg-options "-O2" } */ #include diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 733b6c8..1230d19 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -1067,6 +1067,12 @@ proc check_effective_target_mmap {} { return [check_function_available "mmap"] } +# Return 1 if the target supports sysconf, 0 otherwise. + +proc check_effective_target_sysconf {} { + return [check_function_available "sysconf"] +} + # Return 1 if the target supports dlopen, 0 otherwise. proc check_effective_target_dlopen {} { return [check_no_compiler_messages dlopen executable { -- cgit v1.1 From 4f992de4f369e17b64a66246ec35bf75f41dc98d Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 24 Mar 2021 11:22:35 +0100 Subject: arm: Fix some more vec-common.md patterns for iwmmxt [PR99724] The following patch fixes similar issues as in PR98849; in older gcc versions, the expanders were present in neon.md guarded with TARGET_NEON, but they got moved to vec-common.md and guarded with ARM_HAVE__ARITH so that they handle both MVE and Neon. The macros are enabled for some modes even for iwmmxt which has some vector support for those modes, but only limited. In particular, neither the one_cmpl, nor neg, nor movmisalign patterns are present. For some reason I've failed to construct something that ICEs with movmisalign, so that is not covered by the testsuite, but both one_cmpl and neg ICE. 2021-03-24 Jakub Jelinek PR target/99724 * config/arm/vec-common.md (one_cmpl2, neg2, movmisalign): Disable expanders for TARGET_REALLY_IWMMXT. * gcc.target/arm/pr99724.c: New test. --- gcc/testsuite/gcc.target/arm/pr99724.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 gcc/testsuite/gcc.target/arm/pr99724.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/arm/pr99724.c b/gcc/testsuite/gcc.target/arm/pr99724.c new file mode 100644 index 0000000..5411078 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pr99724.c @@ -0,0 +1,31 @@ +/* PR target/99724 */ +/* { dg-do compile } */ +/* { dg-skip-if "Test is specific to the iWMMXt" { arm*-*-* } { "-mcpu=*" } { "-mcpu=iwmmxt" } } */ +/* { dg-skip-if "Test is specific to the iWMMXt" { arm*-*-* } { "-mabi=*" } { "-mabi=iwmmxt" } } */ +/* { dg-skip-if "Test is specific to the iWMMXt" { arm*-*-* } { "-march=*" } { "-march=iwmmxt" } } */ +/* { dg-skip-if "Test is specific to ARM mode" { arm*-*-* } { "-mthumb" } { "" } } */ +/* { dg-require-effective-target arm32 } */ +/* { dg-require-effective-target arm_iwmmxt_ok } */ +/* { dg-options "-O1 -mcpu=iwmmxt" } */ + +typedef int V __attribute__((vector_size (8))); +struct __attribute__((packed)) S { char a; V b; char c[7]; }; + +void +foo (V *x) +{ + *x = ~*x; +} + +void +bar (V *x) +{ + *x = -*x; +} + +void +baz (V *x, struct S *p) +{ + V y = p->b; + *x = y; +} -- cgit v1.1 From 79cdbabbc4cbf79491c274220928406dff3d4039 Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Wed, 24 Mar 2021 08:51:41 +0000 Subject: arm: Fix MVE constraints for movmisalign [PR target/99727] MVE has different constraints than Neon for load/store: we should use the Ux constraint instead of Um. 2021-03-24 Christophe Lyon PR target/99727 gcc/ * config/arm/mve.md (movmisalign_mve_store): Use Ux constraint. (movmisalign_mve_load): Likewise. gcc/testsuite/ * gcc.target/arm/pr99727.c: New test. --- gcc/testsuite/gcc.target/arm/pr99727.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 gcc/testsuite/gcc.target/arm/pr99727.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/arm/pr99727.c b/gcc/testsuite/gcc.target/arm/pr99727.c new file mode 100644 index 0000000..92585e2 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pr99727.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_v8_1m_mve_ok } */ +/* { dg-options "-O3" } */ +/* { dg-add-options arm_v8_1m_mve } */ + +char a[7][25][15][14]; +void b() { + for (int c;; ++c) + for (int d = 0; d < 25; ++d) + for (int e = 0; e < 15; ++e) + for (int f = 0; f < 14; ++f) + a[c][d][e][f] = 1; +} -- cgit v1.1 From f225c6b0c50dc472e0b73b440b572a3bf1514020 Mon Sep 17 00:00:00 2001 From: Martin Jambor Date: Wed, 24 Mar 2021 20:27:27 +0100 Subject: ipa: Check that scalar types that IPA-CP comes up with are sane (PR99122) This patch fixes the last bit of PR 99122 where various bits of IPA infrastructure are presented with a program with type mismatches that make it have undefined behavior, and when inlining or performing IPA-CP, and encountering such mismatch, we basically try to VIEW_CONVERT_EXPR whatever the caller has into whatever the callee has or simply use an empty constructor if that cannot be done. This however does not work when the callee has VLA parameters because we ICE in the process. Richi has already disabled inlining for such cases, this patch avoids the issue in IPA-CP. It adds checks that whatever constant the propagation arrived at is actually compatible or fold_convertible to the callees formal parameer type. Unlike in the past, we now have types of all parameters of functions that we have analyzed, even with LTO, and so can do it. This should prevent only bogus propagations. I have looked at the effect of the patch on WPA of Firefox and did not have any. I have bootstrapped and LTO bootstrapped and tested the patch on x86_64-linux. OK for trunk? And perhaps later for GCC 10 too? Thanks gcc/ChangeLog: 2021-02-26 Martin Jambor PR ipa/99122 * ipa-cp.c (initialize_node_lattices): Mark as bottom all parameters with unknown type. (ipacp_value_safe_for_type): New function. (propagate_vals_across_arith_jfunc): Verify that the constant type can be used for a type of the formal parameter. (propagate_vals_across_ancestor): Likewise. (propagate_scalar_across_jump_function): Likewise. Pass the type also to propagate_vals_across_ancestor. gcc/testsuite/ChangeLog: 2021-02-26 Martin Jambor PR ipa/99122 * gcc.dg/pr99122-3.c: Remove -fno-ipa-cp from options. --- gcc/testsuite/gcc.dg/pr99122-3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/pr99122-3.c b/gcc/testsuite/gcc.dg/pr99122-3.c index 6aa5b29..6a908ad 100644 --- a/gcc/testsuite/gcc.dg/pr99122-3.c +++ b/gcc/testsuite/gcc.dg/pr99122-3.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -g -fno-ipa-cp -w" } */ +/* { dg-options "-O2 -g -w" } */ static int foo (); -- cgit v1.1 From 4f00c4d40a539360938607561460904663c64cda Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Wed, 24 Mar 2021 15:58:03 +0100 Subject: i386: fix -march=amd crash It started with g:3e2ae3ee285a57455d5a23bd352a68c289130186 where new entry was added to processor_alias_table after generic node: + {"amdfam19h", PROCESSOR_GENERIC, CPU_GENERIC, 0, + M_CPU_TYPE (AMDFAM19H), P_NONE}, and then the following is violated: /* NB: processor_alias_table stops at the "generic" entry. */ gcc/ChangeLog: PR target/99753 * common/config/i386/i386-common.c (ARRAY_SIZE): Fix off-by-one error. * config/i386/i386-options.c (ix86_option_override_internal): Add run-time assert. gcc/testsuite/ChangeLog: PR target/99753 * gcc.target/i386/pr99753.c: New test. --- gcc/testsuite/gcc.target/i386/pr99753.c | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr99753.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/i386/pr99753.c b/gcc/testsuite/gcc.target/i386/pr99753.c new file mode 100644 index 0000000..3def1fd --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr99753.c @@ -0,0 +1,5 @@ +/* PR target/99753 */ + +/* { dg-do compile } */ +/* { dg-options "-march=amd -m32" } */ +/* { dg-error "bad value .'amd'. for '-march=' switch" "" { target *-*-* } 0 } */ -- cgit v1.1 From 8bf52ffa92f7d1539cbb82fbc0e95389e084ec31 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 25 Mar 2021 00:16:48 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8ee6b10..c14c3b7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,51 @@ +2021-03-24 Martin Liska + + PR target/99753 + * gcc.target/i386/pr99753.c: New test. + +2021-03-24 Martin Jambor + + PR ipa/99122 + * gcc.dg/pr99122-3.c: Remove -fno-ipa-cp from options. + +2021-03-24 Christophe Lyon + + PR target/99727 + * gcc.target/arm/pr99727.c: New test. + +2021-03-24 Jakub Jelinek + + PR target/99724 + * gcc.target/arm/pr99724.c: New test. + +2021-03-24 Alexandre Oliva + + * lib/target-supports.exp (check_effective_target_sysconf): New. + * gcc.target/i386/pr95443-1.c: Require it. + * gcc.target/i386/pr95443-2.c: Likewise. + * gcc.target/i386/sse2-mmx-maskmovq.c: Likewise. + * gcc.target/i386/strncmp-1.c: Likewise. + +2021-03-24 Alexandre Oliva + + * gcc.target/i386/pr97313.c: Require effective target feature pie. + * g++.target/i386/pr94185.C: Likewise. + +2021-03-24 Alexandre Oliva + + * gcc.target/i386/funcspec-2.c: Tighten regexps to avoid false + positives with -mcmodel=large. + * gcc.target/i386/funcspec-3.c: Likewise. + +2021-03-24 Alexandre Oliva + + * gcc.target/i386/pr94467-3.c: New. + +2021-03-24 Tobias Burnus + + PR fortran/99369 + * gfortran.dg/longnames.f90: New test. + 2021-03-23 Nathan Sidwell PR c++/99283 -- cgit v1.1 From 71fc4655ab86ab66b40165b2cb49c1395ca82a9a Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Wed, 24 Mar 2021 20:47:57 -0400 Subject: analyzer; reset sm-state for SSA names at def-stmts [PR93695,PR99044,PR99716] Various false positives from -fanalyzer involve SSA names in loops, where sm-state associated with an SSA name from one iteration is erroneously reused in a subsequent iteration. For example, PR analyzer/99716 describes a false "double 'fclose' of FILE 'fp'" on: for (i = 0; i < 2; ++i) { FILE *fp = fopen ("/tmp/test", "w"); fprintf (fp, "hello"); fclose (fp); } where the gimple of the loop body is: fp_7 = fopen ("/tmp/test", "w"); __builtin_fwrite ("hello", 1, 5, fp_7); fclose (fp_7); i_10 = i_1 + 1; where fp_7 transitions to "closed" at the fclose, but is not reset at the subsequent fopen, leading to the false positive when the fclose is re-reached. The fix is to reset sm-state for svalues that involve an SSA name at the SSA name's def-stmt, since the def-stmt effectively changes the meaning of those related svalues. gcc/analyzer/ChangeLog: PR analyzer/93695 PR analyzer/99044 PR analyzer/99716 * engine.cc (exploded_node::on_stmt): Clear sm-state involving an SSA name at the def-stmt of that SSA name. * program-state.cc (sm_state_map::purge_state_involving): New. * program-state.h (sm_state_map::purge_state_involving): New decl. * region-model.cc (selftest::test_involves_p): New. (selftest::analyzer_region_model_cc_tests): Call it. * svalue.cc (class involvement_visitor): New class (svalue::involves_p): New. * svalue.h (svalue::involves_p): New decl. gcc/testsuite/ChangeLog: PR analyzer/93695 PR analyzer/99044 PR analyzer/99716 * gcc.dg/analyzer/attr-malloc-CVE-2019-19078-usb-leak.c: Remove xfail. * gcc.dg/analyzer/pr93695-1.c: New test. * gcc.dg/analyzer/pr99044-1.c: New test. * gcc.dg/analyzer/pr99044-2.c: New test. * gcc.dg/analyzer/pr99716-1.c: New test. * gcc.dg/analyzer/pr99716-2.c: New test. * gcc.dg/analyzer/pr99716-3.c: New test. --- .../analyzer/attr-malloc-CVE-2019-19078-usb-leak.c | 4 +- gcc/testsuite/gcc.dg/analyzer/pr93695-1.c | 53 +++++++++++++++++++ gcc/testsuite/gcc.dg/analyzer/pr99044-1.c | 60 ++++++++++++++++++++++ gcc/testsuite/gcc.dg/analyzer/pr99044-2.c | 42 +++++++++++++++ gcc/testsuite/gcc.dg/analyzer/pr99716-1.c | 40 +++++++++++++++ gcc/testsuite/gcc.dg/analyzer/pr99716-2.c | 34 ++++++++++++ gcc/testsuite/gcc.dg/analyzer/pr99716-3.c | 16 ++++++ 7 files changed, 246 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/analyzer/pr93695-1.c create mode 100644 gcc/testsuite/gcc.dg/analyzer/pr99044-1.c create mode 100644 gcc/testsuite/gcc.dg/analyzer/pr99044-2.c create mode 100644 gcc/testsuite/gcc.dg/analyzer/pr99716-1.c create mode 100644 gcc/testsuite/gcc.dg/analyzer/pr99716-2.c create mode 100644 gcc/testsuite/gcc.dg/analyzer/pr99716-3.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/analyzer/attr-malloc-CVE-2019-19078-usb-leak.c b/gcc/testsuite/gcc.dg/analyzer/attr-malloc-CVE-2019-19078-usb-leak.c index 905d50e..e086843 100644 --- a/gcc/testsuite/gcc.dg/analyzer/attr-malloc-CVE-2019-19078-usb-leak.c +++ b/gcc/testsuite/gcc.dg/analyzer/attr-malloc-CVE-2019-19078-usb-leak.c @@ -192,9 +192,7 @@ static int ath10k_usb_hif_tx_sg(struct ath10k *ar, u8 pipe_id, goto err_free_urb_to_pipe; } - /* TODO: the loop confuses the double-free checker (another - instance of PR analyzer/93695). */ - usb_free_urb(urb); /* { dg-bogus "double-'usb_free_urb' of 'urb'" "" { xfail *-*-* } } */ + usb_free_urb(urb); /* { dg-bogus "double-'usb_free_urb' of 'urb'" } */ } return 0; diff --git a/gcc/testsuite/gcc.dg/analyzer/pr93695-1.c b/gcc/testsuite/gcc.dg/analyzer/pr93695-1.c new file mode 100644 index 0000000..e0500c4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/pr93695-1.c @@ -0,0 +1,53 @@ +/* { dg-additional-options "-Wno-analyzer-too-complex" } */ +/* TODO: remove the need for this option (PR analyzer/93695). */ + +#define NELEMS 10 +#define ARRAY_SIZE(a) (sizeof (a) / sizeof (a[0])) + +void +test_1 (void) +{ + int *p[NELEMS]; + int i; + + for (i = 0; i < ARRAY_SIZE (p); ++i) + p[i] = __builtin_malloc (sizeof (i)); + + for (i = 0; i < ARRAY_SIZE (p); ++i) + __builtin_free (p [i]); +} + +void +test_2 (int n) +{ + int **p; + int i; + + p = (int **)__builtin_malloc (sizeof (int *) * n); + if (!p) + return; + + for (i = 0; i < n; ++i) + p[i] = __builtin_malloc (sizeof (i)); + + for (i = 0; i < n; ++i) + __builtin_free (p [i]); + + __builtin_free (p); +} + +void +test_3 (int **p, int n) +{ + int i; + for (i = 0; i < n; ++i) + p[i] = __builtin_malloc (sizeof (i)); +} + +void +test_4 (void **p, int n) +{ + int i; + for (i = 0; i < n; ++i) + __builtin_free (p[i]); +} diff --git a/gcc/testsuite/gcc.dg/analyzer/pr99044-1.c b/gcc/testsuite/gcc.dg/analyzer/pr99044-1.c new file mode 100644 index 0000000..6b5d901 --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/pr99044-1.c @@ -0,0 +1,60 @@ +#include + +struct hashmap_entry { + struct hashmap_entry *next; + unsigned int hash; +}; + +struct strbuf { + size_t alloc; + size_t len; + char *buf; +}; + +struct oid2strbuf { + struct hashmap_entry ent; /* must be the first member! */ + unsigned char key[21]; + struct strbuf *value; +}; + + +struct hashmap_iter { + struct hashmap *map; + struct hashmap_entry *next; + unsigned int tablepos; +}; + +struct hashmap { + struct hashmap_entry **table; + // hashmap_cmp_fn cmpfn; + unsigned int size, tablesize, grow_at, shrink_at; + unsigned disallow_rehash : 1; +}; +void strbuf_init(struct strbuf *, size_t); +void *hashmap_iter_next(struct hashmap_iter *iter); +void hashmap_free(struct hashmap *map, int free_entries); +void hashmap_iter_init(struct hashmap *map, struct hashmap_iter *iter); + +void strbuf_release(struct strbuf *sb) +{ + if (sb->alloc) { /* { dg-bogus "use after 'free'" } */ + free(sb->buf); + strbuf_init(sb, 0); + } +} + +void oid2strbuf_free(struct hashmap *map) { + struct hashmap_iter iter; + struct hashmap_entry *e; + + hashmap_iter_init(map, &iter); + while ((e = hashmap_iter_next(&iter))) { + struct oid2strbuf *e_strbuf = (struct oid2strbuf *)e; + strbuf_release(e_strbuf->value); /* { dg-bogus "use after 'free'" } */ + free(e_strbuf->value); + free(e); + } + + hashmap_free(map, 0); +} + diff --git a/gcc/testsuite/gcc.dg/analyzer/pr99044-2.c b/gcc/testsuite/gcc.dg/analyzer/pr99044-2.c new file mode 100644 index 0000000..fd71d35 --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/pr99044-2.c @@ -0,0 +1,42 @@ +struct node +{ + struct node *next; +}; + +void test_1 (struct node *n) +{ + while (n) + { + struct node *next = n->next; + __builtin_free (n); + n = next; + } +} + +extern void *get_ptr (void); + +void test_2 (void) +{ + void *p; + while (p = get_ptr ()) + __builtin_free (p); /* { dg-bogus "double-'free' of 'p'" } */ +} + +extern void **get_ptr_ptr (void); + +void test_3 (void) +{ + void **p; + while (p = get_ptr_ptr ()) + __builtin_free (*p); /* { dg-bogus "double-'free'" } */ +} + +void test_4 (void) +{ + void *p = (void *)0; + while (1) + { + __builtin_free (p); /* { dg-bogus "double-'free' of 'p'" } */ + p = get_ptr (); + } +} diff --git a/gcc/testsuite/gcc.dg/analyzer/pr99716-1.c b/gcc/testsuite/gcc.dg/analyzer/pr99716-1.c new file mode 100644 index 0000000..6720c3c --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/pr99716-1.c @@ -0,0 +1,40 @@ +#include +#include + +void +test_1 (void) +{ + int i; + + for (i = 0; i < 2; ++i) { + FILE *fp = fopen ("/tmp/test", "w"); + fprintf (fp, "hello:%s ", "world"); + fclose (fp); /* { dg-bogus "double 'fclose'" } */ + } +} + +void +test_2 (void) +{ + int i; + + for (i = 0; i < 2; ++i) { + FILE *fp = fopen ("/tmp/test", "w"); + fprintf (fp, "hello"); + } +} /* { dg-warning "leak of FILE 'fp'" } */ + +FILE *fp3; + +void +test_3 (FILE **fpp) +{ + int i; + + for (i = 0; i < 2; ++i) { + *fpp = fopen ("/tmp/test", "w"); + fprintf (*fpp, "hello"); + fclose (*fpp); /* { dg-bogus "double 'fclose'" } */ + *fpp = NULL; + } +} diff --git a/gcc/testsuite/gcc.dg/analyzer/pr99716-2.c b/gcc/testsuite/gcc.dg/analyzer/pr99716-2.c new file mode 100644 index 0000000..7c9881c --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/pr99716-2.c @@ -0,0 +1,34 @@ +/* Reduced from + https://github.com/libguestfs/libguestfs/blob/e0a11061035d47b118c95706240bcc17fd576edc/tests/mount-local/test-parallel-mount-local.c#L299-L335 + which is GPLv2 or later. */ + +#include +#include + +extern int foo (void); + +void +test_mountpoint (const char *mp) +{ + const int nr_passes = 5 + (random () & 31); + int pass; + int ret = 1; + FILE *fp; + + for (pass = 0; pass < nr_passes; ++pass) { + if (foo ()) { + goto error; + } + fp = fopen ("file", "w"); + if (fp == NULL) { + goto error; + } + fprintf (fp, "hello world\n"); + fclose (fp); /* { dg-bogus "double 'fclose'" } */ + } + + ret = 0; + + error: + exit (ret); +} diff --git a/gcc/testsuite/gcc.dg/analyzer/pr99716-3.c b/gcc/testsuite/gcc.dg/analyzer/pr99716-3.c new file mode 100644 index 0000000..77d450e --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/pr99716-3.c @@ -0,0 +1,16 @@ +#include + +extern void foo (void *); + +void +test_1 (int nr_passes) +{ + int pass; + void *p; + + for (pass = 0; pass < nr_passes; ++pass) { + p = malloc (1024); + foo (p); + free (p); + } +} -- cgit v1.1 From a29124d28253cdf603ba1977db2f09c9f233fea5 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 24 Mar 2021 12:55:16 +0100 Subject: tree-optimization/99746 - avoid confusing hybrid code This avoids confusing the hybrid vectorization code with SLP patterns by not marking SLP pattern covered stmts as patterns (they are marked as SLP patterns already). This means that loop vectorization will vectorize the scalar stmt rather than the SLP pattern stmt (which it can't anyway). 2021-03-24 Richard Biener PR tree-optimization/99746 * tree-vect-slp-patterns.c (complex_pattern::build): Do not mark the scalar stmt as patterned. Instead set up required things manually. * gfortran.dg/vect/pr99746.f90: New testcase. --- gcc/testsuite/gfortran.dg/vect/pr99746.f90 | 45 ++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/vect/pr99746.f90 (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gfortran.dg/vect/pr99746.f90 b/gcc/testsuite/gfortran.dg/vect/pr99746.f90 new file mode 100644 index 0000000..fe947ae --- /dev/null +++ b/gcc/testsuite/gfortran.dg/vect/pr99746.f90 @@ -0,0 +1,45 @@ +! { dg-do compile } +! { dg-additional-options "-march=armv8.3-a" { target aarch64-*-* } } +SUBROUTINE CLAREF(A, WANTZ, Z, ICOL1, ITMP1, ITMP2, T1, T2, V2) +LOGICAL BLOCK, WANTZ +COMPLEX T1, T2, V2 +COMPLEX A(LDA, *), VECS, Z(LDA, *) +COMPLEX SUM +LOGICAL LSAME +IF (LSAME) THEN + DO 30 K = ITMP1, ITMP2, 3 + T1 = VECS0 +30 CONTINUE +ELSE + IF (BLOCK) THEN + DO 90 K = ITMP1, ITMP2 - 1, 3 + A(J, ICOL1) = ITMP1 + IF (WANTZ) THEN + DO 80 J = ITMP1, ITMP2 + SUM = ICOL1 + Z(J, 3) = V23 +80 CONTINUE + END IF +90 CONTINUE + DO 120 K = ITMP1, ITMP2 + V2 = VECS() + DO 100 J = ITMP1, ITMP2 + A(J, ICOL1) = A(J, ICOL1) - SUM +100 CONTINUE + IF (WANTZ) THEN + DO 110 J = 1, 3 + SUM = Z(J, ICOL1) + Z(J, ICOL1) = 0 +110 CONTINUE + END IF + ICOL1 = ICOL1 + 1 +120 CONTINUE + ELSE + DO 130 J = ITMP1, ITMP2 + SUM = T1 * A(J, ICOL1) + T2 * A(J, 1) + V2 * A(J, 2) + A(J, ICOL1) = SUM + A(J, ICOL1 + 2) = SUM * V1 +130 CONTINUE + END IF +END IF +END -- cgit v1.1 From 72982851d70dfbc547d83ed2bb45356b9ebe3ff0 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Tue, 23 Mar 2021 20:04:58 -0700 Subject: x86: Skip ISA check for always_inline in system headers For always_inline in system headers, we don't know if caller's ISAs are compatible with callee's ISAs until much later. Skip ISA check for always_inline in system headers if caller has target attribute. gcc/ PR target/98209 PR target/99744 * config/i386/i386.c (ix86_can_inline_p): Don't check ISA for always_inline in system headers. gcc/testsuite/ PR target/98209 PR target/99744 * gcc.target/i386/pr98209.c: New test. * gcc.target/i386/pr99744-1.c: Likewise. * gcc.target/i386/pr99744-2.c: Likewise. --- gcc/testsuite/gcc.target/i386/pr98209.c | 13 +++++++++++++ gcc/testsuite/gcc.target/i386/pr99744-1.c | 16 ++++++++++++++++ gcc/testsuite/gcc.target/i386/pr99744-2.c | 13 +++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr98209.c create mode 100644 gcc/testsuite/gcc.target/i386/pr99744-1.c create mode 100644 gcc/testsuite/gcc.target/i386/pr99744-2.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/i386/pr98209.c b/gcc/testsuite/gcc.target/i386/pr98209.c new file mode 100644 index 0000000..4566d4c --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr98209.c @@ -0,0 +1,13 @@ +/* { dg-do run { target *-*-linux* } } */ +/* { dg-options "-O2 -D_FORTIFY_SOURCE=2" } */ + +#include + +extern int main(int argc, char** argv) + __attribute__ ((__target__ ("no-sse,no-mmx"))); + +int main(int argc, char** argv) +{ + printf ("hello!\n"); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/pr99744-1.c b/gcc/testsuite/gcc.target/i386/pr99744-1.c new file mode 100644 index 0000000..9253592 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr99744-1.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +#include + +extern unsigned long long int curr_deadline; +extern void bar (void); + +__attribute__ ((target("general-regs-only"))) +void +foo (void) +{ + if (__rdtsc () < curr_deadline) + return; + bar (); +} diff --git a/gcc/testsuite/gcc.target/i386/pr99744-2.c b/gcc/testsuite/gcc.target/i386/pr99744-2.c new file mode 100644 index 0000000..4bb2a6b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr99744-2.c @@ -0,0 +1,13 @@ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-O2" } */ + +#include + +extern __m128i x, y; + +__attribute__ ((target("general-regs-only"))) +void +foo (void) +{ + x = _mm_move_epi64 (y); /* { dg-error "SSE register return with SSE disabled" } */ +} -- cgit v1.1 From 660eb7e9dee46ef1c986d5a4fa5cbd182b435518 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 25 Mar 2021 11:33:35 +0100 Subject: c-family: Fix up -Wduplicated-branches for union members [PR99565] Honza has fairly recently changed operand_equal_p to compare DECL_FIELD_OFFSET for COMPONENT_REFs when comparing addresses. As the first testcase in this patch shows, while that is very nice for optimizations, for the -Wduplicated-branches warning it causes regressions. Pedantically a union in both C and C++ has only one active member at a time, so using some other union member even if it has the same type is UB, so I think the warning shouldn't warn when it sees access to different fields that happen to have the same offset and should consider them different. In my first attempt to fix this I've keyed the old behavior on OEP_LEXICOGRAPHIC, but unfortunately that has various problems, the warning has a quick non-lexicographic compare in build_conditional_expr* and another lexicographic more expensive one later during genericization and turning the first one into lexicographic would mean wasting compile time on large conditionals. So, this patch instead introduces a new OEP_ flag and makes sure to pass it to operand_equal_p in all -Wduplicated-branches cases. The cvt.c changes are because on the other testcase we were warning with UNKNOWN_LOCATION, so the user wouldn't really know where the questionable code is. 2021-03-25 Jakub Jelinek PR c++/99565 * tree-core.h (enum operand_equal_flag): Add OEP_ADDRESS_OF_SAME_FIELD. * fold-const.c (operand_compare::operand_equal_p): Don't compare field offsets if OEP_ADDRESS_OF_SAME_FIELD. * c-warn.c (do_warn_duplicated_branches): Pass also OEP_ADDRESS_OF_SAME_FIELD to operand_equal_p. * c-typeck.c (build_conditional_expr): Pass OEP_ADDRESS_OF_SAME_FIELD to operand_equal_p. * call.c (build_conditional_expr_1): Pass OEP_ADDRESS_OF_SAME_FIELD to operand_equal_p. * cvt.c (convert_to_void): Preserve location_t on COND_EXPR or or COMPOUND_EXPR. * g++.dg/warn/Wduplicated-branches6.C: New test. * g++.dg/warn/Wduplicated-branches7.C: New test. --- gcc/testsuite/g++.dg/warn/Wduplicated-branches6.C | 9 +++++++++ gcc/testsuite/g++.dg/warn/Wduplicated-branches7.C | 11 +++++++++++ 2 files changed, 20 insertions(+) create mode 100644 gcc/testsuite/g++.dg/warn/Wduplicated-branches6.C create mode 100644 gcc/testsuite/g++.dg/warn/Wduplicated-branches7.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/warn/Wduplicated-branches6.C b/gcc/testsuite/g++.dg/warn/Wduplicated-branches6.C new file mode 100644 index 0000000..70f0bee --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wduplicated-branches6.C @@ -0,0 +1,9 @@ +// PR c++/99565 +// { dg-do compile } +// { dg-options "-Wduplicated-branches" } + +struct A { + union { int a; int b; }; + int& foo (bool x) { return x ? a : b; } // { dg-bogus "this condition has identical branches" } + void bar (bool x, int y) { if (x) a = y; else b = y; } +}; diff --git a/gcc/testsuite/g++.dg/warn/Wduplicated-branches7.C b/gcc/testsuite/g++.dg/warn/Wduplicated-branches7.C new file mode 100644 index 0000000..bbc0793 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wduplicated-branches7.C @@ -0,0 +1,11 @@ +// PR c++/99565 +// { dg-do compile } +// { dg-options "-Wduplicated-branches" } + +int a; + +void +foo (bool x) +{ + x ? ++a : ++a; // { dg-warning "this condition has identical branches" } +} -- cgit v1.1 From de00a7bda94910835012bc7150be53b460a5c8b6 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Thu, 25 Mar 2021 06:57:37 -0700 Subject: Revert "x86: Skip ISA check for always_inline in system headers" This reverts commit 72982851d70dfbc547d83ed2bb45356b9ebe3ff0. --- gcc/testsuite/gcc.target/i386/pr98209.c | 13 ------------- gcc/testsuite/gcc.target/i386/pr99744-1.c | 16 ---------------- gcc/testsuite/gcc.target/i386/pr99744-2.c | 13 ------------- 3 files changed, 42 deletions(-) delete mode 100644 gcc/testsuite/gcc.target/i386/pr98209.c delete mode 100644 gcc/testsuite/gcc.target/i386/pr99744-1.c delete mode 100644 gcc/testsuite/gcc.target/i386/pr99744-2.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/i386/pr98209.c b/gcc/testsuite/gcc.target/i386/pr98209.c deleted file mode 100644 index 4566d4c..0000000 --- a/gcc/testsuite/gcc.target/i386/pr98209.c +++ /dev/null @@ -1,13 +0,0 @@ -/* { dg-do run { target *-*-linux* } } */ -/* { dg-options "-O2 -D_FORTIFY_SOURCE=2" } */ - -#include - -extern int main(int argc, char** argv) - __attribute__ ((__target__ ("no-sse,no-mmx"))); - -int main(int argc, char** argv) -{ - printf ("hello!\n"); - return 0; -} diff --git a/gcc/testsuite/gcc.target/i386/pr99744-1.c b/gcc/testsuite/gcc.target/i386/pr99744-1.c deleted file mode 100644 index 9253592..0000000 --- a/gcc/testsuite/gcc.target/i386/pr99744-1.c +++ /dev/null @@ -1,16 +0,0 @@ -/* { dg-do compile } */ -/* { dg-options "-O0" } */ - -#include - -extern unsigned long long int curr_deadline; -extern void bar (void); - -__attribute__ ((target("general-regs-only"))) -void -foo (void) -{ - if (__rdtsc () < curr_deadline) - return; - bar (); -} diff --git a/gcc/testsuite/gcc.target/i386/pr99744-2.c b/gcc/testsuite/gcc.target/i386/pr99744-2.c deleted file mode 100644 index 4bb2a6b..0000000 --- a/gcc/testsuite/gcc.target/i386/pr99744-2.c +++ /dev/null @@ -1,13 +0,0 @@ -/* { dg-do compile { target { ! ia32 } } } */ -/* { dg-options "-O2" } */ - -#include - -extern __m128i x, y; - -__attribute__ ((target("general-regs-only"))) -void -foo (void) -{ - x = _mm_move_epi64 (y); /* { dg-error "SSE register return with SSE disabled" } */ -} -- cgit v1.1 From aac12084fc07319d5c8232c51dafa4e297bd5415 Mon Sep 17 00:00:00 2001 From: Stam Markianos-Wright Date: Thu, 25 Mar 2021 15:29:41 +0000 Subject: tree-optimization/96974 - avoid ICE by replacing assert with standard failure Minor patch to add a graceful exit in the rare case where an invalid combination of TYPE_VECTOR_SUBPARTS for nunits_vectype and *stmt_vectype_out is reached in vect_get_vector_types_for_stmt. This resolves the ICE seen in PR tree-optimization/96974, however the issue of correctly handling this rare vectorization combination is left for a later patch. Bootstrapped and reg-tested on aarch64-linux-gnu. 2021-03-25 Stam Markianos-Wright gcc/ChangeLog: PR tree-optimization/96974 * tree-vect-stmts.c (vect_get_vector_types_for_stmt): Replace assert with graceful exit. gcc/testsuite/ChangeLog: PR tree-optimization/96974 * g++.target/aarch64/sve/pr96974.C: New test. --- gcc/testsuite/g++.target/aarch64/sve/pr96974.C | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 gcc/testsuite/g++.target/aarch64/sve/pr96974.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.target/aarch64/sve/pr96974.C b/gcc/testsuite/g++.target/aarch64/sve/pr96974.C new file mode 100644 index 0000000..363241d --- /dev/null +++ b/gcc/testsuite/g++.target/aarch64/sve/pr96974.C @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-Ofast -march=armv8.2-a+sve -fdisable-tree-fre4 -fdump-tree-slp-details" } */ + +float a; +int +b () +{ return __builtin_lrintf(a); } + +struct c { + float d; + c() { + for (int e = 0; e < 9; e++) + coeffs[e] = d ? b() : 0; + } + int coeffs[10]; +} f; + +/* { dg-final { scan-tree-dump "Not vectorized: Incompatible number of vector subparts between" "slp1" } } */ -- cgit v1.1 From 9efd72d28956eb79c7fca38e3c959733a3bb25bb Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Thu, 4 Mar 2021 20:20:40 -0500 Subject: c++: -Wconversion vs value-dependent expressions [PR99331] This PR complains that we issue a -Wconversion warning in template struct X {}; template X foo(); saying "conversion from 'long unsigned int' to 'int' may change value". While it's not technically wrong, I suspect -Wconversion warnings aren't all that useful for value-dependent expressions. So this patch disables them. This is a regression that started with r241425: @@ -7278,7 +7306,7 @@ convert_template_argument (tree parm, val = error_mark_node; } } - else if (!dependent_template_arg_p (orig_arg) + else if (!type_dependent_expression_p (orig_arg) && !uses_template_parms (t)) /* We used to call digest_init here. However, digest_init will report errors, which we don't want when complain Here orig_arg is SIZEOF_EXPR; dependent_template_arg_p (orig_arg) was true, but type_dependent_expression_p (orig_arg) is false so we warn in convert_nontype_argument. gcc/cp/ChangeLog: PR c++/99331 * call.c (build_converted_constant_expr_internal): Don't emit -Wconversion warnings. gcc/testsuite/ChangeLog: PR c++/99331 * g++.dg/warn/Wconversion5.C: New test. --- gcc/testsuite/g++.dg/warn/Wconversion5.C | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 gcc/testsuite/g++.dg/warn/Wconversion5.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/warn/Wconversion5.C b/gcc/testsuite/g++.dg/warn/Wconversion5.C new file mode 100644 index 0000000..f5ae631 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wconversion5.C @@ -0,0 +1,19 @@ +// PR c++/99331 +// { dg-do compile { target c++11 } } +// { dg-options "-Wconversion" } +// Don't issue -Wconversion warnings for value-dependent expressions. + +template struct X {}; +template struct Y {}; +template X foo(); +template X foo2(); +template Y foo3(); +template Y<1024> foo4(); // { dg-error "narrowing conversion" } +template Y<1u> foo5(); +template X<__INT_MAX__ + 1U> foo6(); // { dg-error "narrowing conversion" } + +template +struct S { + using t = X; + using u = X; +}; -- cgit v1.1 From 0b86a6438191f720bebf880a2b932cd97d10229a Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 25 Mar 2021 21:06:09 +0100 Subject: c++: Diagnose bare parameter packs in bitfield widths [PR99745] The following invalid tests ICE because we don't diagnose (and drop) bare parameter packs in bitfield widths. 2021-03-25 Jakub Jelinek PR c++/99745 * decl2.c (grokbitfield): Diagnose bitfields containing bare parameter packs and don't set DECL_BIT_FIELD_REPRESENTATIVE in that case. * g++.dg/cpp0x/variadic181.C: New test. --- gcc/testsuite/g++.dg/cpp0x/variadic181.C | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic181.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic181.C b/gcc/testsuite/g++.dg/cpp0x/variadic181.C new file mode 100644 index 0000000..0bb6fe7 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/variadic181.C @@ -0,0 +1,9 @@ +// PR c++/99745 +// { dg-do compile { target c++11 } } + +template +struct S { int a : sizeof(Ts); }; // { dg-error "parameter packs not expanded with '\.\.\.':" } +S s; // { dg-message "'Ts'" "" { target *-*-* } .-1 } +template +struct T { int a : Ns; }; // { dg-error "parameter packs not expanded with '\.\.\.':" } +T<0> t; // { dg-message "'Ns'" "" { target *-*-* } .-1 } -- cgit v1.1 From d4e0bdbc036644401f9de49f594b2bb16b287381 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Fri, 5 Mar 2021 15:46:50 -0500 Subject: c++: ICE on invalid with inheriting constructors [PR94751] This is an ICE on invalid where we crash because since r269032 we keep error_mark_node around instead of using noexcept_false_spec when things go wrong; see the walk_field_subobs hunk. We crash in deduce_inheriting_ctor which calls synthesized_method_walk to deduce the exception-specification, but fails to do so in this case, because the testcase is invalid so get_nsdmi returns error_mark_node for the member 'c', and per r269032 the error_mark_node propagates back to deduce_inheriting_ctor which subsequently calls build_exception_variant whereon we crash. I think we should return early if the deduction fails and I decided to call mark_used to get an error right away instead of hoping that it would get called later. My worry is that we could forget that there was an error and think that we just deduced noexcept(false). And then I noticed that the test still crashes in C++98. Here again we failed to deduce the exception-specification in implicitly_declare_fn, but nothing reported an error between synthesized_method_walk and the assert. Well, not much we can do except calling synthesized_method_walk again, this time in the verbose mode and making sure that we did get an error. gcc/cp/ChangeLog: PR c++/94751 * call.c (build_over_call): Maybe call mark_used in case deduce_inheriting_ctor fails and return error_mark_node. * cp-tree.h (deduce_inheriting_ctor): Adjust declaration. * method.c (deduce_inheriting_ctor): Return bool if the deduction fails. (implicitly_declare_fn): If raises is error_mark_node, call synthesized_method_walk with diag being true. gcc/testsuite/ChangeLog: PR c++/94751 * g++.dg/cpp0x/inh-ctor37.C: New test. --- gcc/testsuite/g++.dg/cpp0x/inh-ctor37.C | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/inh-ctor37.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp0x/inh-ctor37.C b/gcc/testsuite/g++.dg/cpp0x/inh-ctor37.C new file mode 100644 index 0000000..7d12b53 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/inh-ctor37.C @@ -0,0 +1,26 @@ +// PR c++/94751 +// { dg-do compile } +// { dg-options "-w" } + +struct A { + A(float); +}; + +template +struct B : A { + using A::A; + + struct C { + C(int); + }; + + C c{ "foo" }; // { dg-error "invalid conversion" } +}; + +struct S { S(B *); }; + +S +fn () +{ + return S(new B(10.5)); // { dg-error "no matching function" "" { target c++98_only } } +} -- cgit v1.1 From 2132a36370e282d8c0ed0c97e5bfb952e23dbfa1 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 25 Mar 2021 21:35:11 +0100 Subject: c++: Fix source_location inconsistency between calls from templates and non-templates [PR99672] The srcloc19.C testcase shows inconsistency in std::source_location::current() locations between calls from templates and non-templates. The location used by __builtin_source_location comes in both cases from input_location which is set on it by bot_manip when handling the default argument, called during finish_call_expr. The problem is that in templates that input_location comes from the CALL_EXPR we built earlier and that has the combined locus with range between first character of the function name and closing paren with caret on the opening paren, so something printed as caret as: foobar (); ~~~~~~^~ But outside of templates, finish_call_expr is called when input_location is just the closing paren token, i.e. foobar (); ^ and only after that returns we create the combined location and set the CALL_EXPR location to that. So, it means std::source_location::current() reports in templates the column of opening (, while outside of templates closing ). The following patch makes it consistent by creating the combined location already before calling finish_call_expr and temporarily overriding input_location to that. 2021-03-25 Jakub Jelinek PR c++/99672 * parser.c (cp_parser_postfix_expression): For calls, create combined_loc and temporarily set input_location to it before calling finish_call_expr. * g++.dg/concepts/diagnostic2.C: Adjust expected caret line. * g++.dg/cpp1y/builtin_location.C (f4, n6): Move #line directives to match locus changes. * g++.dg/cpp2a/srcloc1.C: Adjust expected column numbers. * g++.dg/cpp2a/srcloc2.C: Likewise. * g++.dg/cpp2a/srcloc15.C: Likewise. * g++.dg/cpp2a/srcloc16.C: Likewise. * g++.dg/cpp2a/srcloc19.C: New test. * g++.dg/modules/adhoc-1_b.C: Adjust expected column numbers and caret line. * g++.dg/modules/macloc-1_c.C: Adjust expected column numbers. * g++.dg/modules/macloc-1_d.C: Likewise. * g++.dg/plugin/diagnostic-test-expressions-1.C: Adjust expected caret line. * testsuite/18_support/source_location/consteval.cc (main): Adjust expected column numbers. * testsuite/18_support/source_location/1.cc (main): Likewise. --- gcc/testsuite/g++.dg/concepts/diagnostic2.C | 2 +- gcc/testsuite/g++.dg/cpp1y/builtin_location.C | 8 ++-- gcc/testsuite/g++.dg/cpp2a/srcloc1.C | 4 +- gcc/testsuite/g++.dg/cpp2a/srcloc15.C | 6 +-- gcc/testsuite/g++.dg/cpp2a/srcloc16.C | 4 +- gcc/testsuite/g++.dg/cpp2a/srcloc19.C | 44 ++++++++++++++++++++++ gcc/testsuite/g++.dg/cpp2a/srcloc2.C | 4 +- gcc/testsuite/g++.dg/modules/adhoc-1_b.C | 2 +- gcc/testsuite/g++.dg/modules/macloc-1_c.C | 4 +- gcc/testsuite/g++.dg/modules/macloc-1_d.C | 4 +- .../g++.dg/plugin/diagnostic-test-expressions-1.C | 2 +- 11 files changed, 64 insertions(+), 20 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp2a/srcloc19.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/concepts/diagnostic2.C b/gcc/testsuite/g++.dg/concepts/diagnostic2.C index 004c7a3..6550ed6 100644 --- a/gcc/testsuite/g++.dg/concepts/diagnostic2.C +++ b/gcc/testsuite/g++.dg/concepts/diagnostic2.C @@ -25,6 +25,6 @@ baz() bar(); // { dg-error "no match" } /* { dg-begin-multiline-output "" } bar(); - ^ + ~~~~~~~~^~ { dg-end-multiline-output "" } */ } diff --git a/gcc/testsuite/g++.dg/cpp1y/builtin_location.C b/gcc/testsuite/g++.dg/cpp1y/builtin_location.C index b3b9b43..1f8a7fd 100644 --- a/gcc/testsuite/g++.dg/cpp1y/builtin_location.C +++ b/gcc/testsuite/g++.dg/cpp1y/builtin_location.C @@ -103,10 +103,10 @@ A (0 == __builtin_strcmp (f3, FILE_3)); #define FILE_4 "next_file_name.another_suffix" #line 1 "foobar" constexpr const char* f4 = this_file - ( #line 1 FILE_4 - ) + ( #line 1 "foobar" + ) ; A (0 == __builtin_strcmp (f4, FILE_4)); @@ -167,9 +167,9 @@ A (n5 == 9); // of the function call. #line 1 constexpr int n6 = this_line - ( #line 99 - ) + ( #line 1 + ) ; A (n6 == 99); diff --git a/gcc/testsuite/g++.dg/cpp2a/srcloc1.C b/gcc/testsuite/g++.dg/cpp2a/srcloc1.C index 029a037..2e97974 100644 --- a/gcc/testsuite/g++.dg/cpp2a/srcloc1.C +++ b/gcc/testsuite/g++.dg/cpp2a/srcloc1.C @@ -80,7 +80,7 @@ constexpr source_location s2 = baz <1> (); const source_location *p1 = &s1; const source_location *p2 = &s2; static_assert (source_location::current ().line () == __LINE__); -static_assert (source_location::current ().column () == 42); +static_assert (source_location::current ().column () == 41); constexpr bool quux () @@ -106,7 +106,7 @@ quux () return false; if (line1 != line2) return false; - if (column != 33) + if (column != 32) return false; return true; } diff --git a/gcc/testsuite/g++.dg/cpp2a/srcloc15.C b/gcc/testsuite/g++.dg/cpp2a/srcloc15.C index d02617e..3bb3958 100644 --- a/gcc/testsuite/g++.dg/cpp2a/srcloc15.C +++ b/gcc/testsuite/g++.dg/cpp2a/srcloc15.C @@ -69,8 +69,8 @@ bar () source_location a = foo (); source_location b = source_location::current (); source_location c = foo (); - // ^ column 28 - // ^ column 49 + // ^ column 27 + // ^ column 48 const source_location *d[3] = { &a, &b, &c }; const char *file1 = __FILE__; const char *function1 = __PRETTY_FUNCTION__; @@ -83,7 +83,7 @@ bar () return false; if (d[j]->line () != line + j + 1) return false; - if (d[j]->column () != (j == 1 ? 49 : 28)) + if (d[j]->column () != (j == 1 ? 48 : 27)) return false; } diff --git a/gcc/testsuite/g++.dg/cpp2a/srcloc16.C b/gcc/testsuite/g++.dg/cpp2a/srcloc16.C index c8bd281..0ecd636 100644 --- a/gcc/testsuite/g++.dg/cpp2a/srcloc16.C +++ b/gcc/testsuite/g++.dg/cpp2a/srcloc16.C @@ -79,10 +79,10 @@ foo () || u.u.line () + 1 != v.line () || s.a.column () != 18 || s.b.column () != 18 - || s.c.column () != 50 + || s.c.column () != 49 || t.u.column () != 21 || u.u.column () != 13 - || v.column () != 49) + || v.column () != 48) return false; return true; } diff --git a/gcc/testsuite/g++.dg/cpp2a/srcloc19.C b/gcc/testsuite/g++.dg/cpp2a/srcloc19.C new file mode 100644 index 0000000..b7e8c37 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/srcloc19.C @@ -0,0 +1,44 @@ +// PR c++/99672 +// { dg-do compile { target c++20 } } + +namespace std { + struct source_location { + struct __impl { + const char *_M_file_name; + const char *_M_function_name; + unsigned int _M_line, _M_column; + }; + const __impl *__ptr; + constexpr source_location () : __ptr (nullptr) {} + static consteval source_location + current (const void *__p = __builtin_source_location ()) { + source_location __ret; + __ret.__ptr = static_cast (__p); + return __ret; + } + constexpr const char *file_name () const { + return __ptr ? __ptr->_M_file_name : ""; + } + constexpr const char *function_name () const { + return __ptr ? __ptr->_M_function_name : ""; + } + constexpr unsigned line () const { + return __ptr ? __ptr->_M_line : 0; + } + constexpr unsigned column () const { + return __ptr ? __ptr->_M_column : 0; + } + }; +} + +constexpr int g(auto...) { +return std::source_location::current().column(); +} + +constexpr int f() { +return std::source_location::current().column(); +} + +constexpr int a = g(); +constexpr int b = f(); +static_assert (a == b); diff --git a/gcc/testsuite/g++.dg/cpp2a/srcloc2.C b/gcc/testsuite/g++.dg/cpp2a/srcloc2.C index 4e0b960..3f91a64 100644 --- a/gcc/testsuite/g++.dg/cpp2a/srcloc2.C +++ b/gcc/testsuite/g++.dg/cpp2a/srcloc2.C @@ -84,7 +84,7 @@ const source_location *p1 = &s1; const source_location *p2 = &s2; static_assert (source_location::current ().line () == __LINE__); -static_assert (source_location::current ().column () == 42); +static_assert (source_location::current ().column () == 41); constexpr bool quux () @@ -110,7 +110,7 @@ quux () return false; if (line1 != line2) return false; - if (column != 33) + if (column != 32) return false; return true; } diff --git a/gcc/testsuite/g++.dg/modules/adhoc-1_b.C b/gcc/testsuite/g++.dg/modules/adhoc-1_b.C index 59907a0..7fd5701 100644 --- a/gcc/testsuite/g++.dg/modules/adhoc-1_b.C +++ b/gcc/testsuite/g++.dg/modules/adhoc-1_b.C @@ -6,7 +6,7 @@ void foo () massivelongnamethatcausesadhoclocationsokeepaddingcharsyourgettheidea (); } -// { dg-regexp "\n\[^\n]*adhoc-1_b.C:6:74: error: no matching function for call to 'massivelongnamethatcausesadhoclocationsokeepaddingcharsyourgettheidea\\(\\)'\n massivelongnamethatcausesadhoclocationsokeepaddingcharsyourgettheidea \\(\\);\n \\^$" } +// { dg-regexp "\n\[^\n]*adhoc-1_b.C:6:73: error: no matching function for call to 'massivelongnamethatcausesadhoclocationsokeepaddingcharsyourgettheidea\\(\\)'\n massivelongnamethatcausesadhoclocationsokeepaddingcharsyourgettheidea \\(\\);\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\\^~$" } // { dg-regexp "\nIn module bob, imported at \[^\n]*adhoc-1_b.C:3:\n\[^\n]*adhoc-1_a.C:5:12: note: candidate: 'int massivelongnamethatcausesadhoclocationsokeepaddingcharsyourgettheidea@bob\\(int\\)'\n export int massivelongnamethatcausesadhoclocationsokeepaddingcharsyourgettheidea \\(int\\);\n \\^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~$" } // { dg-regexp "\nIn module bob, imported at \[^\n]*adhoc-1_b.C:3:\n\[^\n]*adhoc-1_a.C:6:188: note: candidate: 'void massivelongnamethatcausesadhoclocationsokeepaddingcharsyourgettheidea@bob\\(float\\)'\n\[ \t]*export void massivelongnamethatcausesadhoclocationsokeepaddingcharsyourgettheidea \\(float\\);\n\[ \t]*\\^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~?$" } // For some reason dg-regexp inserts a blank line diff --git a/gcc/testsuite/g++.dg/modules/macloc-1_c.C b/gcc/testsuite/g++.dg/modules/macloc-1_c.C index 9b8f7fb..5865a34 100644 --- a/gcc/testsuite/g++.dg/modules/macloc-1_c.C +++ b/gcc/testsuite/g++.dg/modules/macloc-1_c.C @@ -8,6 +8,6 @@ void gru () you (1); } -// { dg-regexp "\[^\n]*macloc-1_c.C:7:8: error: too many arguments to function 'int me@agnes\\(\\)'\nIn module agnes, imported at \[^\n]*macloc-1_b.C:8,\nof module edith, imported at \[^\n]*macloc-1_c.C:3:\n\[^\n]*macloc-1_a.C:11:12: note: declared here\n\[^\n]*macloc-1_a.C:8:20: note: in definition of macro 'BOB'\n" } +// { dg-regexp "\[^\n]*macloc-1_c.C:7:6: error: too many arguments to function 'int me@agnes\\(\\)'\nIn module agnes, imported at \[^\n]*macloc-1_b.C:8,\nof module edith, imported at \[^\n]*macloc-1_c.C:3:\n\[^\n]*macloc-1_a.C:11:12: note: declared here\n\[^\n]*macloc-1_a.C:8:20: note: in definition of macro 'BOB'\n" } -// { dg-regexp "\[^\n]*macloc-1_c.C:8:9: error: too many arguments to function 'int you@agnes\\(\\)'\nIn module agnes, imported at \[^\n]*macloc-1_b.C:8,\nof module edith, imported at \[^\n]*macloc-1_c.C:3:\n\[^\n]*macloc-1_a.C:12:14: note: declared here\n\[^\n]*macloc-1_a.C:9:22: note: in definition of macro 'KEVIN'\n" } +// { dg-regexp "\[^\n]*macloc-1_c.C:8:7: error: too many arguments to function 'int you@agnes\\(\\)'\nIn module agnes, imported at \[^\n]*macloc-1_b.C:8,\nof module edith, imported at \[^\n]*macloc-1_c.C:3:\n\[^\n]*macloc-1_a.C:12:14: note: declared here\n\[^\n]*macloc-1_a.C:9:22: note: in definition of macro 'KEVIN'\n" } diff --git a/gcc/testsuite/g++.dg/modules/macloc-1_d.C b/gcc/testsuite/g++.dg/modules/macloc-1_d.C index 5b2b7ba..282a31c 100644 --- a/gcc/testsuite/g++.dg/modules/macloc-1_d.C +++ b/gcc/testsuite/g++.dg/modules/macloc-1_d.C @@ -9,5 +9,5 @@ void margo () gru (2); } -// { dg-regexp "\[^\n]*macloc-1_d.C:8:8: error: too many arguments to function 'int me@agnes\\(\\)'\nIn module agnes, imported at \[^\n]*macloc-1_d.C:4:\n\[^\n]*macloc-1_a.C:11:12: note: declared here\n\[^\n]*macloc-1_a.C:8:20: note: in definition of macro 'BOB'\n" } -// { dg-regexp "\[^\n]*macloc-1_d.C:9:9: error: too many arguments to function 'void gru@edith\\(\\)'\nIn module edith, imported at \[^\n]*macloc-1_d.C:3:\n\[^\n]*macloc-1_b.C:10:20: note: declared here\n\[^\n]*macloc-1_b.C:6:19: note: in definition of macro 'STUART'\n" } +// { dg-regexp "\[^\n]*macloc-1_d.C:8:6: error: too many arguments to function 'int me@agnes\\(\\)'\nIn module agnes, imported at \[^\n]*macloc-1_d.C:4:\n\[^\n]*macloc-1_a.C:11:12: note: declared here\n\[^\n]*macloc-1_a.C:8:20: note: in definition of macro 'BOB'\n" } +// { dg-regexp "\[^\n]*macloc-1_d.C:9:7: error: too many arguments to function 'void gru@edith\\(\\)'\nIn module edith, imported at \[^\n]*macloc-1_d.C:3:\n\[^\n]*macloc-1_b.C:10:20: note: declared here\n\[^\n]*macloc-1_b.C:6:19: note: in definition of macro 'STUART'\n" } diff --git a/gcc/testsuite/g++.dg/plugin/diagnostic-test-expressions-1.C b/gcc/testsuite/g++.dg/plugin/diagnostic-test-expressions-1.C index 288da2c..70778e9 100644 --- a/gcc/testsuite/g++.dg/plugin/diagnostic-test-expressions-1.C +++ b/gcc/testsuite/g++.dg/plugin/diagnostic-test-expressions-1.C @@ -900,7 +900,7 @@ void test_methods () ((base *)1)->priv (); // { dg-error " is private " } /* { dg-begin-multiline-output "" } ((base *)1)->priv (); - ^ + ~~~~~~~~~~~~~~~~~~^~ { dg-end-multiline-output "" } { dg-begin-multiline-output "" } int priv (); -- cgit v1.1 From 1b229a305091f0a9c64e5be3c1af5ef62b75e3cb Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Thu, 25 Mar 2021 15:31:46 -0600 Subject: New test for PR tree-optimization/44547 - -Wuninitialized reports false warning in nested switch statements. gcc/testsuite/ChangeLog: * gcc.dg/uninit-pr44547.c: New. --- gcc/testsuite/gcc.dg/uninit-pr44547.c | 61 +++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/uninit-pr44547.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/uninit-pr44547.c b/gcc/testsuite/gcc.dg/uninit-pr44547.c new file mode 100644 index 0000000..ee1035a --- /dev/null +++ b/gcc/testsuite/gcc.dg/uninit-pr44547.c @@ -0,0 +1,61 @@ +/* PR tree-optimization/44547 - -Wuninitialized reports false warning + in nested switch statements + { dg-do compile } + { dg-options "-O1 -Wall" } */ + +__attribute__ ((noipa)) int test_O1 (int argc) +{ + switch( argc ) + { + case 1: + case 2: + case 4: + { + int n; + switch( argc ) + { + case 1: + case 2: + case 4: + n = argc; + break; + } + + return n; + + break; + } + } + + return 0; +} + + +#pragma GCC optimize ("2") + +__attribute__ ((noipa)) int test_O2 (int argc) +{ + switch( argc ) + { + case 1: + case 2: + case 4: + { + int n; + switch( argc ) + { + case 1: + case 2: + case 4: + n = argc; + break; + } + + return n; + + break; + } + } + + return 0; +} -- cgit v1.1 From 26e80a496853b21da1886779d97ff613ccb64f9b Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Thu, 25 Mar 2021 16:08:00 -0600 Subject: PR tree-optimization/48483 - Construct from yourself w/o warning gcc/testsuite/ChangeLog: PR tree-optimization/48483 * g++.dg/warn/uninit-pr48483.C: New test. --- gcc/testsuite/g++.dg/warn/uninit-pr48483.C | 56 ++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 gcc/testsuite/g++.dg/warn/uninit-pr48483.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/warn/uninit-pr48483.C b/gcc/testsuite/g++.dg/warn/uninit-pr48483.C new file mode 100644 index 0000000..41e8513 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/uninit-pr48483.C @@ -0,0 +1,56 @@ +/* PR tree-optimization/48483 - Construct from yourself w/o warning + { dg-do compile } + { dg-options "-Wall" } */ + +void sink (int); + +struct B +{ + int x; +}; + +struct A +{ + B& b; + A (B &x): b(x) { } +}; + +__attribute__ ((noipa)) void test_c0_O0 () +{ + A a (a.b); // { dg-warning "'a.A::b' is used uninitialized" } + sink (a.b.x); +} + +__attribute__ ((noipa)) int test_c3_O0 (void) +{ + struct S { int a; } s; + return s.a; // { dg-warning "s.test_c3_O0\\\(\\\)::S::a' is used uninitialized" } +} + +#pragma GCC optimize ("1") + +__attribute__ ((noipa)) void test_c0_O1 () +{ + A a (a.b); // { dg-warning "'a.A::b' is used uninitialized" } + sink (a.b.x); +} + +__attribute__ ((noipa)) int test_c3_O1 (void) +{ + struct S { int a; } s; + return s.a; // { dg-warning "s.test_c3_O1\\\(\\\)::S::a' is used uninitialized" } +} + +#pragma GCC optimize ("2") + +__attribute__ ((noipa)) void test_c0_O2 () +{ + A a (a.b); // { dg-warning "'a.A::b' is used uninitialized" } + sink (a.b.x); +} + +__attribute__ ((noipa)) int test_c3_O2 (void) +{ + struct S { int a; } s; + return s.a; // { dg-warning "s.test_c3_O2\\\(\\\)::S::a' is used uninitialized" } +} -- cgit v1.1 From e88ca9f42306e291d3cb2d34dd7f2b017a3c1e52 Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Thu, 25 Mar 2021 17:23:06 -0600 Subject: PR tree-optimization/55060 - False un-initialized variable warnings gcc/testsuite/ChangeLog: PR tree-optimization/55060 * gcc.dg/uninit-pr55060.c: New. --- gcc/testsuite/gcc.dg/uninit-pr55060.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/uninit-pr55060.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/uninit-pr55060.c b/gcc/testsuite/gcc.dg/uninit-pr55060.c new file mode 100644 index 0000000..b2f2cb1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/uninit-pr55060.c @@ -0,0 +1,30 @@ +/* PR tree-optimization/55060 - False un-initialized variable warnings + { dg-do compile } + { dg-options "-O1 -Wuninitialized" } */ + +static void a(int *i) { } +static void b(int p) { } +int foo(void) { + int i; + a(&i); + b(i); // { dg-bogus "\\\[-Wuninitialized" } + return 0; +} + +static void c(int *i) { } +extern void d(int p); +int bar(void) { + int i; + c(&i); + d(i); // { dg-warning "\\\[-Wuninitialized" } + return 0; +} + +extern void e(int *i); +static void f(int p) {}; +int baz(void) { + int i; + e(&i); + f(i); // { dg-bogus "\\\[-Wuninitialized" } + return 0; +} -- cgit v1.1 From 4493b1c1ad7e2b2a60ad70563b81f51173115471 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 26 Mar 2021 00:16:25 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 96 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c14c3b7..45af4ac 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,99 @@ +2021-03-25 Martin Sebor + + PR tree-optimization/55060 + * gcc.dg/uninit-pr55060.c: New. + +2021-03-25 Martin Sebor + + PR tree-optimization/48483 + * g++.dg/warn/uninit-pr48483.C: New test. + +2021-03-25 Martin Sebor + + * gcc.dg/uninit-pr44547.c: New. + +2021-03-25 Jakub Jelinek + + PR c++/99672 + * g++.dg/concepts/diagnostic2.C: Adjust expected caret line. + * g++.dg/cpp1y/builtin_location.C (f4, n6): Move #line directives + to match locus changes. + * g++.dg/cpp2a/srcloc1.C: Adjust expected column numbers. + * g++.dg/cpp2a/srcloc2.C: Likewise. + * g++.dg/cpp2a/srcloc15.C: Likewise. + * g++.dg/cpp2a/srcloc16.C: Likewise. + * g++.dg/cpp2a/srcloc19.C: New test. + * g++.dg/modules/adhoc-1_b.C: Adjust expected column numbers + and caret line. + * g++.dg/modules/macloc-1_c.C: Adjust expected column numbers. + * g++.dg/modules/macloc-1_d.C: Likewise. + * g++.dg/plugin/diagnostic-test-expressions-1.C: Adjust expected + caret line. + +2021-03-25 Marek Polacek + + PR c++/94751 + * g++.dg/cpp0x/inh-ctor37.C: New test. + +2021-03-25 Jakub Jelinek + + PR c++/99745 + * g++.dg/cpp0x/variadic181.C: New test. + +2021-03-25 Marek Polacek + + PR c++/99331 + * g++.dg/warn/Wconversion5.C: New test. + +2021-03-25 Stam Markianos-Wright + + PR tree-optimization/96974 + * g++.target/aarch64/sve/pr96974.C: New test. + +2021-03-25 H.J. Lu + + Revert: + 2021-03-25 H.J. Lu + + PR target/98209 + PR target/99744 + * gcc.target/i386/pr98209.c: New test. + * gcc.target/i386/pr99744-1.c: Likewise. + * gcc.target/i386/pr99744-2.c: Likewise. + +2021-03-25 Jakub Jelinek + + PR c++/99565 + * g++.dg/warn/Wduplicated-branches6.C: New test. + * g++.dg/warn/Wduplicated-branches7.C: New test. + +2021-03-25 H.J. Lu + + PR target/98209 + PR target/99744 + * gcc.target/i386/pr98209.c: New test. + * gcc.target/i386/pr99744-1.c: Likewise. + * gcc.target/i386/pr99744-2.c: Likewise. + +2021-03-25 Richard Biener + + PR tree-optimization/99746 + * gfortran.dg/vect/pr99746.f90: New testcase. + +2021-03-25 David Malcolm + + PR analyzer/93695 + PR analyzer/99044 + PR analyzer/99716 + * gcc.dg/analyzer/attr-malloc-CVE-2019-19078-usb-leak.c: Remove + xfail. + * gcc.dg/analyzer/pr93695-1.c: New test. + * gcc.dg/analyzer/pr99044-1.c: New test. + * gcc.dg/analyzer/pr99044-2.c: New test. + * gcc.dg/analyzer/pr99716-1.c: New test. + * gcc.dg/analyzer/pr99716-2.c: New test. + * gcc.dg/analyzer/pr99716-3.c: New test. + 2021-03-24 Martin Liska PR target/99753 -- cgit v1.1 From 9d45e848d02e71c11420ec49630281e9a29c89b8 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Fri, 26 Mar 2021 08:39:24 +0100 Subject: Fortran: Fix intrinsic null() handling [PR99651] gcc/fortran/ChangeLog: PR fortran/99651 * intrinsic.c (gfc_intrinsic_func_interface): Set attr.proc = PROC_INTRINSIC if FL_PROCEDURE. gcc/testsuite/ChangeLog: PR fortran/99651 * gfortran.dg/null_11.f90: New test. --- gcc/testsuite/gfortran.dg/null_11.f90 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/null_11.f90 (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gfortran.dg/null_11.f90 b/gcc/testsuite/gfortran.dg/null_11.f90 new file mode 100644 index 0000000..040cc26 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/null_11.f90 @@ -0,0 +1,16 @@ +! { dg-do compile } +! +! PR fortran/99651 +! +module m + type :: CHAR_STAR + character(len=1),dimension(:),pointer :: ptr + end type + type(CHAR_STAR), parameter ::CHAR_STAR_NULL = CHAR_STAR(NULL()) +end module m + +use m +type typeNode + type(typeNode), pointer :: Next => null() +end type typeNode +end -- cgit v1.1 From 6081d8994ed1a0aef6b7f5fb34f091faa3580416 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 26 Mar 2021 09:35:26 +0100 Subject: c++: Fix ICE with nsdmi [PR99705] When adding P0784R7 constexpr new support, we still didn't have P1331R2 implemented and so I had to change also build_vec_delete_1 - instead of having uninitialized tbase temporary later initialized by MODIFY_EXPR I've set the DECL_INITIAL for it - because otherwise it would be rejected during constexpr evaluation which didn't like uninitialized vars. Unfortunately, that change broke the following testcase. The problem is that these temporaries (not just tbase but tbase was the only one with an initializer) are created during NSDMI parsing and current_function_decl is NULL at that point. Later when we clone body of constructors, auto_var_in_fn_p is false for those (as they have NULL DECL_CONTEXT) and so they aren't duplicated, and what is worse, the DECL_INITIAL isn't duplicated either nor processed, and during expansion we ICE because the code from DECL_INITIAL of that var refers to the abstract constructor's PARM_DECL (this) rather than the actual constructor's one. So, either we can just revert those build_vec_delete_1 changes (as done in the second patch - in attachment), or, as the first patch does, we can copy the temporaries during bot_manip like we copy the temporaries of TARGET_EXPRs. To me that looks like a better fix because e.g. if break_out_of_target_exprs is called for the same NSDMI multiple times, sharing the temporaries looks just wrong to me. If the temporaries are declared as BIND_EXPR_VARS of some BIND_EXPR (which is the case of the tbase variable built by build_vec_delete_1 and is the only way how the DECL_INITIAL can be walked by *walk_tree*), then we need to copy it also in the BIND_EXPR BIND_EXPR_VARS chain, other temporaries (those that don't need DECL_INITIAL) often have just DECL_EXPR and no corresponding BIND_EXPR. Note, ({ }) are rejected in nsdmis, so all we run into are temporaries the FE creates artificially. 2021-03-26 Jakub Jelinek PR c++/99705 * tree.c (bot_manip): Remap artificial automatic temporaries mentioned in DECL_EXPR or in BIND_EXPR_VARS. * g++.dg/cpp0x/new5.C: New test. --- gcc/testsuite/g++.dg/cpp0x/new5.C | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/new5.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp0x/new5.C b/gcc/testsuite/g++.dg/cpp0x/new5.C new file mode 100644 index 0000000..b5a9ca2 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/new5.C @@ -0,0 +1,21 @@ +// PR c++/99705 +// { dg-do compile { target c++11 } } + +template +struct C +{ + C () { f (); } + ~C () {} + static void f () {} +}; + +struct X +{ + X (); + int n = 10; + C *p = new C[n]; +}; + +X::X () +{ +} -- cgit v1.1 From 8f5e18db259c8a9790feb1d73bb0348182264f15 Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Sat, 13 Mar 2021 17:05:52 +0100 Subject: Fix ICE: in function_and_variable_visibility, at ipa-visibility.c:795 [PR99466] In get_emutls_init_templ_addr, only thread-local declarations that were DECL_ONE_ONLY would have a public initializer symbol, ignoring variables that were declared with __attribute__((weak)). gcc/ChangeLog: PR ipa/99466 * tree-emutls.c (get_emutls_init_templ_addr): Mark initializer of weak TLS declarations as public. gcc/testsuite/ChangeLog: PR ipa/99466 * gcc.dg/tls/pr99466-1.c: New test. * gcc.dg/tls/pr99466-2.c: New test. --- gcc/testsuite/gcc.dg/tls/pr99466-1.c | 8 ++++++++ gcc/testsuite/gcc.dg/tls/pr99466-2.c | 10 ++++++++++ 2 files changed, 18 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/tls/pr99466-1.c create mode 100644 gcc/testsuite/gcc.dg/tls/pr99466-2.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/tls/pr99466-1.c b/gcc/testsuite/gcc.dg/tls/pr99466-1.c new file mode 100644 index 0000000..446850e --- /dev/null +++ b/gcc/testsuite/gcc.dg/tls/pr99466-1.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-require-weak "" } */ +/* { dg-require-effective-target tls_emulated } */ +/* { dg-add-options tls } */ +__attribute__((weak)) +__thread int tlsvar = 3; +/* { dg-final { scan-assembler ".weak_definition ___emutls_t.tlsvar" { target *-*-darwin* } } } */ +/* { dg-final { scan-assembler-not ".private_extern ___emutls_t.tlsvar" { target *-*-darwin* } } } */ diff --git a/gcc/testsuite/gcc.dg/tls/pr99466-2.c b/gcc/testsuite/gcc.dg/tls/pr99466-2.c new file mode 100644 index 0000000..86ffaad --- /dev/null +++ b/gcc/testsuite/gcc.dg/tls/pr99466-2.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-require-weak "" } */ +/* { dg-require-visibility "" } */ +/* { dg-require-effective-target tls_emulated } */ +/* { dg-add-options tls } */ +__attribute__((weak)) +__attribute__((visibility ("hidden"))) +__thread int tlsvar = 3; +/* { dg-final { scan-assembler ".weak_definition ___emutls_t.tlsvar" { target *-*-darwin* } } } */ +/* { dg-final { scan-assembler ".private_extern ___emutls_t.tlsvar" { target *-*-darwin* } } } */ -- cgit v1.1 From 0d37e2d3ead072ba57e03fcb97a041504a22e721 Mon Sep 17 00:00:00 2001 From: Vladimir Makarov Date: Fri, 26 Mar 2021 17:09:24 +0000 Subject: [PR99766] Consider relaxed memory associated more with memory instead of special memory. Relaxed memory should be considered more like memory then special memory. gcc/ChangeLog: PR target/99766 * ira-costs.c (record_reg_classes): Put case with CT_RELAXED_MEMORY adjacent to one with CT_MEMORY. * ira.c (ira_setup_alts): Ditto. * lra-constraints.c (process_alt_operands): Ditto. * recog.c (asm_operand_ok): Ditto. * reload.c (find_reloads): Ditto. gcc/testsuite/ChangeLog: PR target/99766 * g++.target/aarch64/sve/pr99766.C: New. --- gcc/testsuite/g++.target/aarch64/sve/pr99766.C | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 gcc/testsuite/g++.target/aarch64/sve/pr99766.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.target/aarch64/sve/pr99766.C b/gcc/testsuite/g++.target/aarch64/sve/pr99766.C new file mode 100644 index 0000000..0ca8aee --- /dev/null +++ b/gcc/testsuite/g++.target/aarch64/sve/pr99766.C @@ -0,0 +1,24 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-O3 -march=armv8.2-a+sve" } */ +typedef float a __attribute__((__mode__(HF))); +typedef struct { + a b; + a c; +} d; +int e; +d *f, *g; +__fp16 h; +void j() { + for (int i;; ++i) { + auto l = &f[i]; + for (int k; k < e;) { + k = 0; + for (; k < e; ++k) + g[k].b = l[k].b * l[k].c; + } + for (int k; k < e; ++k) { + g[k].b *= h; + g[k].c *= h; + } + } +} -- cgit v1.1 From d82797420c2238e31a7a25fe6db6bd05cd37224d Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Fri, 26 Mar 2021 10:46:31 -0700 Subject: c++: imported templates and alias-template changes [PR 99283] During development of modules, I had difficulty deciding whether the module flags of a template should live on the decl_template_result, the template_decl, or both. I chose the latter, and require them to be consistent. This and a few other defects show how hard that consistency is. Hence this patch move to holding the flags on the template-decl-result decl. That's the entity various bits of the parser have at the appropriate time. Once needs STRIP_TEMPLATE in a bunch of places, which this patch adds. Also a check that we never give a TEMPLATE_DECL to the module flag accessors. This left a problem with how I was handling template aliases. These were in two parts -- separating the TEMPLATE_DECL from the TYPE_DECL. That seemed somewhat funky, but development showed it necessary. Of course, that causes problems if the TEMPLATE_DECL cannot contain 'am imported' information. Investigating now shows that we do not need to treat them separately. By reverting a bit of template instantiation machinery that caused the problem, we're back on course. I think what has happened is that between then and now, other typedef fixes have corrected the underlying problem this separation was working around. It allows a bunch of cleanup in the decl streamer, as we no longer have to handle a null TEMPLATE_DECL_RESULT. PR c++/99283 gcc/cp/ * cp-tree.h (DECL_MODULE_CHECK): Ban TEMPLATE_DECL. (SET_TYPE_TEMPLATE_INFO): Restore Alias template setting. * decl.c (duplicate_decls): Remove template_decl module flag propagation. * module.cc (merge_kind_name): Add alias tmpl spec as a thing. (dumper::impl::nested_name): Adjust for template-decl module flag change. (trees_in::assert_definition): Likewise. (trees_in::install_entity): Likewise. (trees_out::decl_value): Likewise. Remove alias template separation of template and type_decl. (trees_in::decl_value): Likewise. (trees_out::key_mergeable): Likewise, (trees_in::key_mergeable): Likewise. (trees_out::decl_node): Adjust for template-decl module flag change. (depset::hash::make_dependency): Likewise. (get_originating_module, module_may_redeclare): Likewise. (set_instantiating_module, set_defining_module): Likewise. * name-lookup.c (name_lookup::search_adl): Likewise. (do_pushdecl): Likewise. * pt.c (build_template_decl): Likewise. (lookup_template_class_1): Remove special alias_template handling of DECL_TI_TEMPLATE. (tsubst_template_decl): Likewise. gcc/testsuite/ * g++.dg/modules/pr99283-2_a.H: New. * g++.dg/modules/pr99283-2_b.H: New. * g++.dg/modules/pr99283-2_c.H: New. * g++.dg/modules/pr99283-3_a.H: New. * g++.dg/modules/pr99283-3_b.H: New. * g++.dg/modules/pr99283-4.H: New. * g++.dg/modules/tpl-alias-1_a.H: Adjust scans. * g++.dg/modules/tpl-alias-1_b.C: Adjust scans. --- gcc/testsuite/g++.dg/modules/pr99283-2_a.H | 12 +++++++++++ gcc/testsuite/g++.dg/modules/pr99283-2_b.H | 22 ++++++++++++++++++++ gcc/testsuite/g++.dg/modules/pr99283-2_c.H | 20 ++++++++++++++++++ gcc/testsuite/g++.dg/modules/pr99283-3_a.H | 31 ++++++++++++++++++++++++++++ gcc/testsuite/g++.dg/modules/pr99283-3_b.H | 9 ++++++++ gcc/testsuite/g++.dg/modules/pr99283-4.H | 20 ++++++++++++++++++ gcc/testsuite/g++.dg/modules/tpl-alias-1_a.H | 8 +++---- gcc/testsuite/g++.dg/modules/tpl-alias-1_b.C | 7 ++++--- 8 files changed, 122 insertions(+), 7 deletions(-) create mode 100644 gcc/testsuite/g++.dg/modules/pr99283-2_a.H create mode 100644 gcc/testsuite/g++.dg/modules/pr99283-2_b.H create mode 100644 gcc/testsuite/g++.dg/modules/pr99283-2_c.H create mode 100644 gcc/testsuite/g++.dg/modules/pr99283-3_a.H create mode 100644 gcc/testsuite/g++.dg/modules/pr99283-3_b.H create mode 100644 gcc/testsuite/g++.dg/modules/pr99283-4.H (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/modules/pr99283-2_a.H b/gcc/testsuite/g++.dg/modules/pr99283-2_a.H new file mode 100644 index 0000000..c5faf1d --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr99283-2_a.H @@ -0,0 +1,12 @@ +// PR 99283 part 2 ICE on definition with qualified-name +// { dg-additional-options -fmodule-header } +// { dg-module-cmi {} } + +inline namespace __cxx11 { + +template +class collate; + +} + + diff --git a/gcc/testsuite/g++.dg/modules/pr99283-2_b.H b/gcc/testsuite/g++.dg/modules/pr99283-2_b.H new file mode 100644 index 0000000..a1b7d60 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr99283-2_b.H @@ -0,0 +1,22 @@ +// { dg-additional-options -fmodule-header } +// { dg-module-cmi {} } +import "pr99283-2_a.H"; + +inline namespace __cxx11 { +template +class collate +{ +}; +} + +template +void Check () +{ + typedef collate __collate_type; +} + + + + + + diff --git a/gcc/testsuite/g++.dg/modules/pr99283-2_c.H b/gcc/testsuite/g++.dg/modules/pr99283-2_c.H new file mode 100644 index 0000000..8263928 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr99283-2_c.H @@ -0,0 +1,20 @@ +// { dg-additional-options -fmodule-header } +// { dg-module-cmi {} } +import "pr99283-2_a.H"; + +template +class __cxx11::collate +{ +}; + +template +void Check () +{ + typedef collate __collate_type; +} + + + + + + diff --git a/gcc/testsuite/g++.dg/modules/pr99283-3_a.H b/gcc/testsuite/g++.dg/modules/pr99283-3_a.H new file mode 100644 index 0000000..5926b9d --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr99283-3_a.H @@ -0,0 +1,31 @@ +// PR 99283 part 2 ICE on definition with qualified-name +// { dg-additional-options -fmodule-header } +// { dg-module-cmi {} } + +template +struct enable_if; + +template +struct enable_if +{ typedef _Tp type; }; + +template +class basic_string; + +typedef basic_string string; + +template +class basic_string +{ +private: + template + using _If_sv = typename enable_if::type; + +public: + const _CharT *c_str() const noexcept; +}; + +inline void stoi(const string& __str) +{ + __str.c_str (); +} diff --git a/gcc/testsuite/g++.dg/modules/pr99283-3_b.H b/gcc/testsuite/g++.dg/modules/pr99283-3_b.H new file mode 100644 index 0000000..cb14de6 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr99283-3_b.H @@ -0,0 +1,9 @@ +// { dg-additional-options {-fmodule-header -fno-module-lazy} } +// { dg-module-cmi {} } + +template +class basic_string; + +typedef basic_string string; + +import "pr99283-3_a.H"; diff --git a/gcc/testsuite/g++.dg/modules/pr99283-4.H b/gcc/testsuite/g++.dg/modules/pr99283-4.H new file mode 100644 index 0000000..d15ccc4 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr99283-4.H @@ -0,0 +1,20 @@ +// PR 99283 part 3, ICE with template alias as default template parm +// of member template +// { dg-additional-options -fmodule-header } +// { dg-module-cmi {} } + +template +struct _Insert +{ + using size_type = int; + + template + using _IFconsp = bool; + + template> + int insert (_Pair&& __v); +}; + +void Foo (typename _Insert::size_type); + + diff --git a/gcc/testsuite/g++.dg/modules/tpl-alias-1_a.H b/gcc/testsuite/g++.dg/modules/tpl-alias-1_a.H index 502a649..37002ee 100644 --- a/gcc/testsuite/g++.dg/modules/tpl-alias-1_a.H +++ b/gcc/testsuite/g++.dg/modules/tpl-alias-1_a.H @@ -3,7 +3,7 @@ #include "tpl-alias-1.h" -// { dg-final { scan-lang-dump {Writing named:-[0-9]* template_decl:'::allocator_traits<::allocator>::template rebind_alloc<_Up>'} module } } -// { dg-final { scan-lang-dump {Writing decl spec:-[0-9]* type_decl:'::allocator_traits<::allocator>::rebind_alloc<_Up>'} module } } -// { dg-final { scan-lang-dump {Writing:-[0-9]*'s decl spec merge key \(specialization\) type_decl:'::allocator_traits<::allocator>::rebind_alloc<_Up>'} module } } -// { dg-final { scan-lang-dump {Wrote\(-[0-9]*\) alias template type_decl:'::allocator_traits<::allocator>::rebind_alloc<_Up>'} module } } +// { dg-final { scan-lang-dump {Writing decl tmpl spec:-[0-9]* template_decl:'::allocator_traits<::allocator>::template rebind_alloc<_Up>'} module } } +// { dg-final { scan-lang-dump {Writing decl tmpl spec:-[0-9]* type_decl:'::allocator_traits<::allocator>::template rebind_alloc<_Up>'} module } } + +// { dg-final { scan-lang-dump {Writing:-[0-9]*'s alias spec merge key \(specialization\) type_decl:'::allocator_traits<::allocator>::rebind_alloc'} module } } diff --git a/gcc/testsuite/g++.dg/modules/tpl-alias-1_b.C b/gcc/testsuite/g++.dg/modules/tpl-alias-1_b.C index 59fd09c..cc9499f 100644 --- a/gcc/testsuite/g++.dg/modules/tpl-alias-1_b.C +++ b/gcc/testsuite/g++.dg/modules/tpl-alias-1_b.C @@ -3,7 +3,8 @@ #include "tpl-alias-1.h" import "tpl-alias-1_a.H"; -// { dg-final { scan-lang-dump {Read:-[0-9]*'s named merge key \(matched\) template_decl:'::allocator_traits<::allocator>::template rebind_alloc'} module } } -// { dg-final { scan-lang-dump {Read:-[0-9]*'s decl spec merge key \(matched\) type_decl:'::allocator_traits<::allocator<_Tp>>::rebind_alloc'} module } } -// { dg-final { scan-lang-dump {Read alias template type_decl:'::allocator_traits<::allocator>::rebind_alloc<_Up>'} module } } +// { dg-final { scan-lang-dump {Deduping '::allocator_traits<::allocator<_Tp>>::template rebind_alloc'} module } } +// { dg-final { scan-lang-dump {Deduping '::allocator_traits<::allocator>::template rebind_alloc<_Up>'} module } } +// { dg-final { scan-lang-dump {Deduping '::allocator_traits<::allocator>::rebind_alloc'} module } } + // { dg-final { scan-lang-dump-not {merge key \(new\)} module } } -- cgit v1.1 From c453a817129c2c362726a9773390419f1df7dda3 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Fri, 26 Mar 2021 11:20:03 -0400 Subject: c++: ICE on invalid with NSDMI in C++98 [PR98352] NSDMIs are a C++11 thing, and here we ICE with them on the non-C++11 path. Fortunately all we need is a small tweak to my recent r11-7835 patch. gcc/cp/ChangeLog: PR c++/98352 * method.c (implicitly_declare_fn): Pass &raises to synthesized_method_walk. gcc/testsuite/ChangeLog: PR c++/98352 * g++.dg/cpp0x/inh-ctor37.C: Remove dg-error. * g++.dg/cpp0x/nsdmi17.C: New test. --- gcc/testsuite/g++.dg/cpp0x/inh-ctor37.C | 2 +- gcc/testsuite/g++.dg/cpp0x/nsdmi17.C | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/nsdmi17.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp0x/inh-ctor37.C b/gcc/testsuite/g++.dg/cpp0x/inh-ctor37.C index 7d12b53..a14874f 100644 --- a/gcc/testsuite/g++.dg/cpp0x/inh-ctor37.C +++ b/gcc/testsuite/g++.dg/cpp0x/inh-ctor37.C @@ -22,5 +22,5 @@ struct S { S(B *); }; S fn () { - return S(new B(10.5)); // { dg-error "no matching function" "" { target c++98_only } } + return S(new B(10.5)); } diff --git a/gcc/testsuite/g++.dg/cpp0x/nsdmi17.C b/gcc/testsuite/g++.dg/cpp0x/nsdmi17.C new file mode 100644 index 0000000..e69d6ce --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/nsdmi17.C @@ -0,0 +1,8 @@ +// PR c++/98352 +// { dg-do compile } + +struct A { + int i = (A(), 42); // { dg-error "default member initializer" } +// { dg-error "only available" "" { target c++98_only } .-1 } +}; +A a; -- cgit v1.1 From 980b12cc81979e52f491bf0dfe961d30c07fe864 Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Fri, 26 Mar 2021 16:37:34 -0600 Subject: PR tree-optimization/59970 - Bogus -Wmaybe-uninitialized at low optimization levels PR tree-optimization/59970 * gcc.dg/uninit-pr59970.c: New test. --- gcc/testsuite/gcc.dg/uninit-pr59970.c | 79 +++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/uninit-pr59970.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/uninit-pr59970.c b/gcc/testsuite/gcc.dg/uninit-pr59970.c new file mode 100644 index 0000000..145af65 --- /dev/null +++ b/gcc/testsuite/gcc.dg/uninit-pr59970.c @@ -0,0 +1,79 @@ +/* PR tree-optimization/59970 - Bogus -Wmaybe-uninitialized at low optimization + levels + { dg-do compile } + { dg-options "-Wall" } */ + +#pragma GCC push_options +#pragma GCC optimize ("1") + +__attribute__ ((noipa)) int +d_demangle_callback_O1 (const char *mangled) +{ + enum { DCT_TYPE, DCT_GLOBAL_DTORS } type; + int dc; + + /* Fails for -Og and -O1. */ + if (mangled) + type = DCT_GLOBAL_DTORS; + else + type = DCT_TYPE; + + /* If both cases assign the same value, all is fine. */ + switch (type) + { + case DCT_TYPE: + dc = 0 /* 1 */; + break; + case DCT_GLOBAL_DTORS: + dc = /* 0 */ 1; + break; + + /* If this is added, all is fine. */ +#ifdef ABORT + default: + __builtin_unreachable (); +#endif + } + + return dc; // { dg-bogus "uninitialized" } +} + +#pragma GCC pop_options + + +#pragma GCC optimize ("Og") + +__attribute__ ((noipa)) int +d_demangle_callback_Og (const char *mangled) +{ + enum { DCT_TYPE, DCT_GLOBAL_DTORS } type; + int dc; + + /* Fails for -Og. */ + /* Removing either the function call or the array dereference, it'll be like + the TOGGLE1 case. */ + extern int cmp (void); + if (cmp () && mangled[0]) + type = DCT_GLOBAL_DTORS; + else + type = DCT_TYPE; + + /* If both cases assign the same value, all is fine. */ + switch (type) + { + case DCT_TYPE: + dc = 0 /* 1 */; + break; + case DCT_GLOBAL_DTORS: + dc = /* 0 */ 1; + break; + + /* If this is added, all is fine. */ +#ifdef ABORT + default: + __builtin_unreachable (); +#endif + } + + return dc; // { dg-bogus "uninitialized" } +} -- cgit v1.1 From 42a21b4cb540be93548a6ff6d4cb4a73ab1665be Mon Sep 17 00:00:00 2001 From: David Edelsohn Date: Sun, 14 Mar 2021 15:09:21 -0400 Subject: aix: ABI struct alignment (PR99557) The AIX power alignment rules apply the natural alignment of the "first member" if it is of a floating-point data type (or is an aggregate whose recursively "first" member or element is such a type). The alignment associated with these types for subsequent members use an alignment value where the floating-point data type is considered to have 4-byte alignment. GCC had been stripping array type but had not recursively looked within structs and unions. This also applies to classes and subclasses and, therefore, becomes more prominent with C++. For example, struct A { double x[2]; int y; }; struct B { int i; struct A a; }; struct A has double-word alignment for the bare type, but word alignment and offset within struct B despite the alignment of struct A. If struct A were the first member of struct B, struct B would have double-word alignment. One must search for the innermost first member to increase the alignment if double and then search for the innermost first member to reduce the alignment if the TYPE had double-word alignment solely because the innermost first member was double. This patch recursively looks through the first member to apply the double-word alignment to the struct / union as a whole and to apply the word alignment to the struct or union as a member within a struct or union. This is an ABI change for GCC on AIX, but GCC on AIX had not correctly implemented the AIX ABI and had not been compatible with the IBM XL compiler. Bootstrapped on powerpc-ibm-aix7.2.3.0. gcc/ChangeLog: * config/rs6000/aix.h (ADJUST_FIELD_ALIGN): Call function. * config/rs6000/rs6000-protos.h (rs6000_special_adjust_field_align): Declare. * config/rs6000/rs6000.c (rs6000_special_adjust_field_align): New. (rs6000_special_round_type_align): Recursively check innermost first field. gcc/testsuite/ChangeLog: * gcc.target/powerpc/pr99557.c: New. --- gcc/testsuite/gcc.target/powerpc/pr99557.c | 53 ++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 gcc/testsuite/gcc.target/powerpc/pr99557.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/powerpc/pr99557.c b/gcc/testsuite/gcc.target/powerpc/pr99557.c new file mode 100644 index 0000000..e0f8b24 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr99557.c @@ -0,0 +1,53 @@ +/* { dg-do run { target { powerpc*-ibm-aix* } } } */ +/* { dg-options "" } */ + +void abort (void); + +struct A { + double x[2]; + int y; +}; + +struct B { + int i; + struct A a; +}; + +struct N { + double d[2]; +}; + +struct S { + struct N n; + float f; +}; + +struct T { + char c; + struct S s; +}; + +int main() { + if (__alignof(struct A) != 8) + abort(); + + if (__alignof(struct B) != 4) + abort(); + + if (__builtin_offsetof(struct B, a) != 4) + abort(); + + if (__alignof(struct N) != 8) + abort(); + + if (__alignof(struct S) != 8) + abort(); + + if (__alignof(struct T) != 4) + abort(); + + if (__builtin_offsetof(struct T, s) != 4) + abort(); + + return 0; +} -- cgit v1.1 From 651684b462f979a4e70a668c4c9767a5fd7d223a Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 27 Mar 2021 00:16:27 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 45af4ac..9abcc02 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,51 @@ +2021-03-26 David Edelsohn + + * gcc.target/powerpc/pr99557.c: New. + +2021-03-26 Martin Sebor + + PR tree-optimization/59970 + * gcc.dg/uninit-pr59970.c: New test. + +2021-03-26 Marek Polacek + + PR c++/98352 + * g++.dg/cpp0x/inh-ctor37.C: Remove dg-error. + * g++.dg/cpp0x/nsdmi17.C: New test. + +2021-03-26 Nathan Sidwell + + PR c++/99283 + * g++.dg/modules/pr99283-2_a.H: New. + * g++.dg/modules/pr99283-2_b.H: New. + * g++.dg/modules/pr99283-2_c.H: New. + * g++.dg/modules/pr99283-3_a.H: New. + * g++.dg/modules/pr99283-3_b.H: New. + * g++.dg/modules/pr99283-4.H: New. + * g++.dg/modules/tpl-alias-1_a.H: Adjust scans. + * g++.dg/modules/tpl-alias-1_b.C: Adjust scans. + +2021-03-26 Vladimir Makarov + + PR target/99766 + * g++.target/aarch64/sve/pr99766.C: New. + +2021-03-26 Iain Buclaw + + PR ipa/99466 + * gcc.dg/tls/pr99466-1.c: New test. + * gcc.dg/tls/pr99466-2.c: New test. + +2021-03-26 Jakub Jelinek + + PR c++/99705 + * g++.dg/cpp0x/new5.C: New test. + +2021-03-26 Tobias Burnus + + PR fortran/99651 + * gfortran.dg/null_11.f90: New test. + 2021-03-25 Martin Sebor PR tree-optimization/55060 -- cgit v1.1 From 65c001bfaf778e83ded451f94d2a0da528758dd8 Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Sun, 14 Mar 2021 18:11:14 +0100 Subject: d: Don't generate per-module wrapper for calling DSO constructor/destructor. The static constructor/destructor list only ever has one function to call in it, so mark the gdc.dso_ctor and gdc.dso_dtor functions as static ctor/dtor directly instead. gcc/d/ChangeLog: * config-lang.in (gtfiles): Remove modules.cc. * modules.cc (struct module_info): Remove GTY marker. (static_ctor_list): Remove variable. (static_dtor_list): Remove variable. (register_moduleinfo): Directly set DECL_STATIC_CONSTRUCTOR on dso_ctor, and DECL_STATIC_DESTRUCTOR on dso_dtor. (d_finish_compilation): Remove static ctor/dtor handling. gcc/testsuite/ChangeLog: * gdc.dg/gdc270a.d: Removed. * gdc.dg/gdc270b.d: Removed. --- gcc/testsuite/gdc.dg/gdc270a.d | 11 ----------- gcc/testsuite/gdc.dg/gdc270b.d | 7 ------- 2 files changed, 18 deletions(-) delete mode 100644 gcc/testsuite/gdc.dg/gdc270a.d delete mode 100644 gcc/testsuite/gdc.dg/gdc270b.d (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gdc.dg/gdc270a.d b/gcc/testsuite/gdc.dg/gdc270a.d deleted file mode 100644 index 4df6f02..0000000 --- a/gcc/testsuite/gdc.dg/gdc270a.d +++ /dev/null @@ -1,11 +0,0 @@ -// https://bugzilla.gdcproject.org/show_bug.cgi?id=270 -// { dg-do compile } - -module gdc270; - -void foo() -{ -} - -/* { dg-final { scan-assembler "_GLOBAL__D_6gdc270" } } */ -/* { dg-final { scan-assembler "_GLOBAL__I_6gdc270" } } */ diff --git a/gcc/testsuite/gdc.dg/gdc270b.d b/gcc/testsuite/gdc.dg/gdc270b.d deleted file mode 100644 index 5a544c5..0000000 --- a/gcc/testsuite/gdc.dg/gdc270b.d +++ /dev/null @@ -1,7 +0,0 @@ -// https://bugzilla.gdcproject.org/show_bug.cgi?id=270 -// { dg-do compile } - -module gdc270; - -/* { dg-final { scan-assembler "_GLOBAL__D_6gdc270" } } */ -/* { dg-final { scan-assembler "_GLOBAL__I_6gdc270" } } */ -- cgit v1.1 From be080b17271cfbe3b8b46d9ca635f8d77de2088e Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Fri, 26 Mar 2021 00:57:54 +0100 Subject: d: Don't create gdc.test symlink in the gdc testsuite directory Instead, tests are copied from the source tree (i.e: $srcdir/compilable) into the test base directory ($base_dir/compilable). A dejagnu test file with all translated test directives is created in a path that follows DejaGnu naming conventions ($base_dir/gdc.test/compilable), which is then passed to `dg-test'. Before invoking the compiler, the gdc.test prefixed is trimmed from the test program in `gdc-dg-test' so that all copied test files are picked up with the correct path names. gcc/testsuite/ChangeLog: * lib/gdc-utils.exp (gdc-copy-extra): Rename to... (gdc-copy-file): ... this. Use file copy instead of open/close. (gdc-convert-test): Save translated dejagnu test to gdc.test directory, only write dejagnu directives to the test file. (gdc-do-test): Don't create gdc.test symlink. --- gcc/testsuite/lib/gdc-utils.exp | 85 ++++++++++++++++------------------------- 1 file changed, 32 insertions(+), 53 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/lib/gdc-utils.exp b/gcc/testsuite/lib/gdc-utils.exp index 6d4a15e..33c0145 100644 --- a/gcc/testsuite/lib/gdc-utils.exp +++ b/gcc/testsuite/lib/gdc-utils.exp @@ -145,37 +145,33 @@ proc gdc-convert-args { args } { return $out } -proc gdc-copy-extra { base extra } { - # Split base, folder/file. - set type [file dirname $extra] +proc gdc-copy-file { srcdir filename } { + # Split folder/file from the filename. + set targetdir [file dirname $filename] - # print "Filename: $base - $extra" + # print "Filename: $srcdir - $filename" - set fdin [open $base/$extra r] - fconfigure $fdin -encoding binary - - file mkdir $type - set fdout [open $extra w] - fconfigure $fdout -encoding binary - - while { [gets $fdin copy_line] >= 0 } { - set out_line $copy_line - puts $fdout $out_line - } - - close $fdin - close $fdout + file mkdir $targetdir + file copy -force $srcdir/$filename $filename # Remove file once test is finished. upvar 2 cleanup_extra_files cleanups - lappend cleanups $extra - - return $extra + lappend cleanups $filename } # # Translate DMD test directives to dejagnu equivalent. # +# This procedure copies the test and all its dependencies from its source +# location in `$srcdir/$type' to `$base_dir/$type'. A stub dejagnu test file +# is then created in `$base_dir/gdc.test/$type' containing all translated test +# directives. This stub is then the test that is handed over to `dg-test'. +# Before invoking the compiler, the `gdc.test' prefix is trimmed from the test +# `$prog' name in `gdc-dg-test' so that all copied tests then get picked up +# with the correct path names. +# +# The following directives are recognized: +# # COMPILE_SEPARATELY: Not handled. # EXECUTE_ARGS: Parameters to add to the execution of the test. # COMPILED_IMPORTS: List of modules files that are imported by the main @@ -215,29 +211,31 @@ proc gdc-convert-test { base test } { upvar 1 compilable_do_what compilable_do_what set compilable_output_file_ext "" - # Split base, folder/file. + # Split folder/file from the test. set type [file dirname $test] set name [file tail $test] # print "Filename: $base - $test" + gdc-copy-file $base $test + # Read in all test directives, and save the dejagnu equivalents to a new + # file that will be returned as the test to run. set fdin [open $base/$test r] #fconfigure $fdin -encoding binary - file mkdir $type - set fdout [open $test w] + # Include gdc.test prefix so test names follow DejaGnu conventions. + set testdir [file tail $base] + file mkdir $testdir/$type + set fdout [open $testdir/$test w] #fconfigure $fdout -encoding binary while { [gets $fdin copy_line] >= 0 } { - set out_line $copy_line if [regexp -- {COMPILE_SEPARATELY} $copy_line] { # COMPILE_SEPARATELY is not handled. - regsub -- {COMPILE_SEPARATELY.*$} $copy_line "" out_line } elseif [regexp -- {DISABLED} $copy_line] { # DISABLED is not handled. - regsub -- {DISABLED.*$} $copy_line "" out_line } elseif [regexp -- {LINK:} $copy_line] { # LINK sets dg-do-what-default "link" @@ -245,7 +243,6 @@ proc gdc-convert-test { base test } { } elseif [regexp -- {POST_SCRIPT} $copy_line] { # POST_SCRIPT is not handled - regsub -- {POST_SCRIPT.*$} $copy_line "" out_line } elseif [regexp -- {DFLAGS\s*:\s*(.*)} $copy_line match args] { # DFLAGS overrides the default value of PERMUTE_ARGS. @@ -253,32 +250,27 @@ proc gdc-convert-test { base test } { error "gdc-convert-test: DFLAGS is not empty as expected" } set saw_test_flags 1 - regsub -- {DFLAGS.*$} $copy_line "" out_line } elseif [regexp -- {PERMUTE_ARGS\s*:\s*(.*)} $copy_line match args] { # PERMUTE_ARGS is handled by gdc-do-test. set PERMUTE_ARGS [gdc-convert-args $args] set saw_test_flags 1 - regsub -- {PERMUTE_ARGS.*$} $copy_line "" out_line } elseif [regexp -- {EXECUTE_ARGS\s*:\s*(.*)} $copy_line match args] { # EXECUTE_ARGS is handled by gdc_load. foreach arg $args { lappend GDC_EXECUTE_ARGS $arg } - regsub -- {EXECUTE_ARGS.*$} $copy_line "" out_line } elseif [regexp -- {REQUIRED_ARGS\s*:\s*(.*)} $copy_line match args] { # Convert all listed arguments to from dmd to gdc-style. - set new_option "{ dg-additional-options \"[gdc-convert-args $args]\" }" - regsub -- {REQUIRED_ARGS.*$} $copy_line $new_option out_line + puts $fdout "// { dg-additional-options \"[gdc-convert-args $args]\" }" } elseif [regexp -- {EXTRA_SOURCES\s*:\s*(.*)} $copy_line match sources] { # EXTRA_SOURCES are appended to extra_sources list foreach srcfile $sources { lappend extra_sources $srcfile } - regsub -- {EXTRA_SOURCES.*$} $copy_line "" out_line } elseif [regexp -- {EXTRA_CPP_SOURCES\s*:\s*(.*)} $copy_line match sources] { # EXTRA_CPP_SOURCES are appended to extra_sources list @@ -286,50 +278,43 @@ proc gdc-convert-test { base test } { # C++ sources are found in the extra-files directory. lappend extra_sources "extra-files/$srcfile" } - regsub -- {EXTRA_CPP_SOURCES.*$} $copy_line "" out_line } elseif [regexp -- {EXTRA_FILES\s*:\s*(.*)} $copy_line match files] { # EXTRA_FILES are appended to extra_files list foreach file $files { lappend extra_files $file } - regsub -- {EXTRA_FILES.*$} $copy_line "" out_line } elseif [regexp -- {COMPILED_IMPORTS\s*:\s*(.*)} $copy_line match sources] { # COMPILED_IMPORTS are appended to extra_sources list foreach import $sources { lappend extra_sources $import } - regsub -- {COMPILED_IMPORTS.*$} $copy_line "" out_line } elseif [regexp -- {RUNNABLE_PHOBOS_TEST} $copy_line match sources] { # RUNNABLE_PHOBOS_TEST annotates tests that import the std module. # It will need skipping if phobos is not available on the target. - regsub -- {RUNNABLE_PHOBOS_TEST.*$} $copy_line "" out_line set needs_phobos 1 } elseif [regexp -- {COMPILABLE_MATH_TEST} $copy_line match sources] { # COMPILABLE_MATH_TEST annotates tests that import the std.math # module. Which will need skipping if not available on the target. - regsub -- {RUNNABLE_PHOBOS_TEST.*$} $copy_line "" out_line set needs_phobos 1 } - - puts $fdout $out_line } # Now that all extra sources and files have been collected, copy them all # to the testsuite build directory. if { [llength $extra_sources] > 0 } { foreach srcfile $extra_sources { - gdc-copy-extra $base "$type/$srcfile" + gdc-copy-file $base "$type/$srcfile" } puts $fdout "// { dg-additional-sources \"$extra_sources\" }" } if { [llength $extra_files] > 0 } { foreach file $extra_files { - gdc-copy-extra $base "$type/$file" + gdc-copy-file $base "$type/$file" } puts $fdout "// { dg-additional-files \"$extra_files\" }" } @@ -367,9 +352,9 @@ proc gdc-convert-test { base test } { # Check that file generation tests output the expected file. set genfile "[file rootname $name].$compilable_output_file_ext" puts $fdout "// { dg-final { if \[file exists $genfile\] \\{ } }" - puts $fdout "// { dg-final { pass \"$test (file exists $genfile)\" } }" + puts $fdout "// { dg-final { pass \"$testdir/$test (file exists $genfile)\" } }" puts $fdout "// { dg-final { \\} else \\{ } }" - puts $fdout "// { dg-final { fail \"$test (file exists $genfile)\" } }" + puts $fdout "// { dg-final { fail \"$testdir/$test (file exists $genfile)\" } }" puts $fdout "// { dg-final { \\} } }" # Cleanup extra generated files. puts $fdout "// { dg-final { file delete $genfile } }" @@ -387,7 +372,7 @@ proc gdc-convert-test { base test } { close $fdin close $fdout - return $test + return $testdir/$test } proc gdc-permute-options { options } { @@ -413,7 +398,6 @@ proc gdc-permute-options { options } { proc gdc-do-test { testcases } { global dg-do-what-default - global subdir global verbose # If a testcase doesn't have special options, use these. @@ -441,10 +425,6 @@ proc gdc-do-test { testcases } { set saved-dg-do-what-default ${dg-do-what-default} - # Create gdc.test link so test names include that subdir. - set testdir [file dirname $subdir] - catch { file link $testdir . } - # Main loop. # set verbose 1 @@ -457,8 +437,7 @@ proc gdc-do-test { testcases } { set imports [format "-I%s/%s" $base $type] set cleanup_extra_files "" set compilable_do_what "compile" - # Include $testdir prefix so test names follow DejaGnu conventions. - set filename "$testdir/[gdc-convert-test $base $type/$name.$ext]" + set filename "[gdc-convert-test $base $type/$name.$ext]" if { $type == "runnable" || $type == "runnable_cxx" } { append PERMUTE_ARGS " $SHARED_OPTION" -- cgit v1.1 From 297363774e6a5dca2f46a85ab086f1d9e59431ac Mon Sep 17 00:00:00 2001 From: Paul Thomas Date: Sun, 28 Mar 2021 16:48:27 +0100 Subject: Fortran: Fix problem with runtime pointer check [PR99602]. 2021-03-28 Paul Thomas gcc/fortran/ChangeLog PR fortran/99602 * trans-expr.c (gfc_conv_procedure_call): Use the _data attrs for class expressions and detect proc pointer evaluations by the non-null actual argument list. gcc/testsuite/ChangeLog PR fortran/99602 * gfortran.dg/pr99602.f90: New test. * gfortran.dg/pr99602a.f90: New test. * gfortran.dg/pr99602b.f90: New test. * gfortran.dg/pr99602c.f90: New test. * gfortran.dg/pr99602d.f90: New test. --- gcc/testsuite/gfortran.dg/pr99602.f90 | 94 ++++++++++++++++++++++++++++++++++ gcc/testsuite/gfortran.dg/pr99602a.f90 | 93 +++++++++++++++++++++++++++++++++ gcc/testsuite/gfortran.dg/pr99602b.f90 | 64 +++++++++++++++++++++++ gcc/testsuite/gfortran.dg/pr99602c.f90 | 25 +++++++++ gcc/testsuite/gfortran.dg/pr99602d.f90 | 25 +++++++++ 5 files changed, 301 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/pr99602.f90 create mode 100644 gcc/testsuite/gfortran.dg/pr99602a.f90 create mode 100644 gcc/testsuite/gfortran.dg/pr99602b.f90 create mode 100644 gcc/testsuite/gfortran.dg/pr99602c.f90 create mode 100644 gcc/testsuite/gfortran.dg/pr99602d.f90 (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gfortran.dg/pr99602.f90 b/gcc/testsuite/gfortran.dg/pr99602.f90 new file mode 100644 index 0000000..6c8455b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr99602.f90 @@ -0,0 +1,94 @@ +! { dg-do compile } +! { dg-options "-fcheck=pointer -fdump-tree-original" } +! +! Test fix of PR99602, where a spurious runtime error was introduced +! by PR99112. This is the testcase in comment #6 of the PR. +! PR99602a.f90 turns on the runtime errors by eliminating the pointer +! attribute from the formal arguments in the abstract interface and +! prepare_whizard_m2. +! +! Contributed by Jeurgen Reuter +! +module m + implicit none + private + public :: m_t + type :: m_t + private + end type m_t +end module m + +module m2_testbed + use m + implicit none + private + public :: prepare_m2 + procedure (prepare_m2_proc), pointer :: prepare_m2 => null () + + abstract interface + subroutine prepare_m2_proc (m2) + import + class(m_t), intent(inout), pointer :: m2 + end subroutine prepare_m2_proc + end interface + +end module m2_testbed + +module a + use m + use m2_testbed, only: prepare_m2 + implicit none + private + public :: a_1 + +contains + + subroutine a_1 () + class(m_t), pointer :: mm + mm => null () + call prepare_m2 (mm) ! Runtime error triggered here + end subroutine a_1 + +end module a + + +module m2 + use m + implicit none + private + public :: m2_t + + type, extends (m_t) :: m2_t + private + contains + procedure :: read => m2_read + end type m2_t +contains + + subroutine m2_read (mm) + class(m2_t), intent(out), target :: mm + end subroutine m2_read +end module m2 + +program main + use m2_testbed + use a, only: a_1 + implicit none + prepare_m2 => prepare_whizard_m2 + call a_1 () + +contains + + subroutine prepare_whizard_m2 (mm) + use m + use m2 + class(m_t), intent(inout), pointer :: mm + if (.not. associated (mm)) allocate (m2_t :: mm) + select type (mm) + type is (m2_t) +! call mm%read () ! Since mm is passed to non-pointer, this generates the error code. + end select + end subroutine prepare_whizard_m2 +end program main +! { dg-final { scan-tree-dump-times "_gfortran_runtime_error_at" 0 "original" } } +! { dg-final { scan-tree-dump-times "Pointer actual argument" 0 "original" } } diff --git a/gcc/testsuite/gfortran.dg/pr99602a.f90 b/gcc/testsuite/gfortran.dg/pr99602a.f90 new file mode 100644 index 0000000..45063e4 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr99602a.f90 @@ -0,0 +1,93 @@ +! { dg-do compile } +! { dg-options "-fcheck=pointer -fdump-tree-original" } +! +! Test fix of PR99602, where a spurious runtime error was introduced +! by PR99112. This is the testcase in comment #6 of the PR. +! This version of PR99602.f90 turns on the runtime errors by eliminating +! the pointer attribute from the formal arguments in the abstract interface +! and prepare_whizard_m2. +! +! Contributed by Jeurgen Reuter +! +module m + implicit none + private + public :: m_t + type :: m_t + private + end type m_t +end module m + +module m2_testbed + use m + implicit none + private + public :: prepare_m2 + procedure (prepare_m2_proc), pointer :: prepare_m2 => null () + + abstract interface + subroutine prepare_m2_proc (m2) + import + class(m_t), intent(inout) :: m2 + end subroutine prepare_m2_proc + end interface + +end module m2_testbed + +module a + use m + use m2_testbed, only: prepare_m2 + implicit none + private + public :: a_1 + +contains + + subroutine a_1 () + class(m_t), pointer :: mm + mm => null () + call prepare_m2 (mm) ! Runtime error triggered here + end subroutine a_1 + +end module a + + +module m2 + use m + implicit none + private + public :: m2_t + + type, extends (m_t) :: m2_t + private + contains + procedure :: read => m2_read + end type m2_t +contains + + subroutine m2_read (mm) + class(m2_t), intent(out), target :: mm + end subroutine m2_read +end module m2 + +program main + use m2_testbed + use a, only: a_1 + implicit none + prepare_m2 => prepare_whizard_m2 + call a_1 () + +contains + + subroutine prepare_whizard_m2 (mm) + use m + use m2 + class(m_t), intent(inout) :: mm + select type (mm) + type is (m2_t) + call mm%read () + end select + end subroutine prepare_whizard_m2 +end program main +! { dg-final { scan-tree-dump-times "_gfortran_runtime_error_at" 1 "original" } } +! { dg-final { scan-tree-dump-times "Pointer actual argument" 1 "original" } } diff --git a/gcc/testsuite/gfortran.dg/pr99602b.f90 b/gcc/testsuite/gfortran.dg/pr99602b.f90 new file mode 100644 index 0000000..ba6d5b6 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr99602b.f90 @@ -0,0 +1,64 @@ +! { dg-do run } +! { dg-options "-fcheck=pointer" } +! +! Test the fix for PR99602 in which the runtime error, +! "Proc-pointer actual argument 'model' is not associated" was triggered +! by the NULL result from model%get_par_data_ptr ("tea ") +! +! Contributed by Juergen Reuter +! +module model_data + type :: model_data_t + type(modelpar_real_t), dimension(:), pointer :: par_real => null () + contains + procedure :: get_par_data_ptr => model_data_get_par_data_ptr_name + procedure :: set => field_data_set + end type model_data_t + + type :: modelpar_real_t + character (4) :: name + real(4) :: value + end type modelpar_real_t + + type(modelpar_real_t), target :: names(2) = [modelpar_real_t("foo ", 1.0), & + modelpar_real_t("bar ", 2.0)] + integer :: return_value = 0 + +contains + + function model_data_get_par_data_ptr_name (model, name) result (ptr) + class(model_data_t), intent(in) :: model + character (*), intent(in) :: name + class(modelpar_real_t), pointer :: ptr + integer :: i + ptr => null () + do i = 1, size (model%par_real) + if (model%par_real(i)%name == name) ptr => model%par_real(i) + end do + end function model_data_get_par_data_ptr_name + + subroutine field_data_set (this, ptr) + class(model_data_t), intent(inout) :: this + class(modelpar_real_t), intent(in), pointer :: ptr + if (associated (ptr)) then + return_value = int (ptr%value) + else + return_value = -1 + end if + end subroutine + +end module model_data + + use model_data + class(model_data_t), allocatable :: model + class(modelpar_real_t), pointer :: name_ptr + + allocate (model_data_t :: model) + model%par_real => names + + call model%set (model%get_par_data_ptr ("bar ")) + if (return_value .ne. 2) stop 1 + call model%set (model%get_par_data_ptr ("tea ")) ! Triggered runtime error + if (return_value .ne. -1) stop 2 +end + diff --git a/gcc/testsuite/gfortran.dg/pr99602c.f90 b/gcc/testsuite/gfortran.dg/pr99602c.f90 new file mode 100644 index 0000000..d16c9ff --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr99602c.f90 @@ -0,0 +1,25 @@ +! { dg-do compile } +! { dg-options "-fcheck=pointer -fdump-tree-original" } +! +! PR fortran/99602 +! + +module m + implicit none +contains + subroutine wr(y) + class(*), pointer :: y + if (associated (y)) stop 1 + end +end module m + +use m +implicit none +class(*), pointer :: cptr + +nullify (cptr) +call wr(cptr) +end + +! { dg-final { scan-tree-dump-not "_gfortran_runtime_error_at" "original" } } +! { dg-final { scan-tree-dump-not "Pointer actual argument" "original" } } diff --git a/gcc/testsuite/gfortran.dg/pr99602d.f90 b/gcc/testsuite/gfortran.dg/pr99602d.f90 new file mode 100644 index 0000000..d16c9ff --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr99602d.f90 @@ -0,0 +1,25 @@ +! { dg-do compile } +! { dg-options "-fcheck=pointer -fdump-tree-original" } +! +! PR fortran/99602 +! + +module m + implicit none +contains + subroutine wr(y) + class(*), pointer :: y + if (associated (y)) stop 1 + end +end module m + +use m +implicit none +class(*), pointer :: cptr + +nullify (cptr) +call wr(cptr) +end + +! { dg-final { scan-tree-dump-not "_gfortran_runtime_error_at" "original" } } +! { dg-final { scan-tree-dump-not "Pointer actual argument" "original" } } -- cgit v1.1 From 46720db72cadfb85501e102d94e06683300a2327 Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Sun, 28 Mar 2021 18:59:06 +0000 Subject: testsuite/arm: Improve scan-assembler in pr96770.c I'm seeing random scan-assembler-times failures in pr96770.c when LTO is used. I suspect this is because the \\+4 string matches the LTO sections, sometimes. This small patch avoids the issue, by matching arr\\+4 instead of \\+4. 2021-03-28 Christophe Lyon gcc/testsuite/ PR target/96770 * gcc.target/arm/pure-code/pr96770.c: Improve scan-assembler-times. --- gcc/testsuite/gcc.target/arm/pure-code/pr96770.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/arm/pure-code/pr96770.c b/gcc/testsuite/gcc.target/arm/pure-code/pr96770.c index a43d71f..ae1bd10 100644 --- a/gcc/testsuite/gcc.target/arm/pure-code/pr96770.c +++ b/gcc/testsuite/gcc.target/arm/pure-code/pr96770.c @@ -5,17 +5,17 @@ int arr[1000]; int *f4 (void) { return &arr[1]; } /* For cortex-m0 (thumb-1/v6m), we generate 4 movs with upper/lower:#arr+4. */ -/* { dg-final { scan-assembler-times "\\+4" 4 { target { { ! arm_thumb1_movt_ok } && { ! arm_thumb2_ok } } } } } */ +/* { dg-final { scan-assembler-times "arr\\+4" 4 { target { { ! arm_thumb1_movt_ok } && { ! arm_thumb2_ok } } } } } */ /* For cortex-m with movt/movw (thumb-1/v8m.base or thumb-2), we generate a movt/movw pair with upper/lower:#arr+4. */ -/* { dg-final { scan-assembler-times "\\+4" 2 { target { arm_thumb1_movt_ok || arm_thumb2_ok } } } } */ +/* { dg-final { scan-assembler-times "arr\\+4" 2 { target { arm_thumb1_movt_ok || arm_thumb2_ok } } } } */ int *f5 (void) { return &arr[80]; } /* For cortex-m0 (thumb-1/v6m), we generate 1 ldr from rodata pointer to arr+320. */ -/* { dg-final { scan-assembler-times "\\+320" 1 { target { { ! arm_thumb1_movt_ok } && { ! arm_thumb2_ok } } } } } */ +/* { dg-final { scan-assembler-times "arr\\+320" 1 { target { { ! arm_thumb1_movt_ok } && { ! arm_thumb2_ok } } } } } */ /* For cortex-m with movt/movw (thumb-1/v8m.base or thumb-2), we generate a movt/movw pair with upper/lower:arr+320. */ -/* { dg-final { scan-assembler-times "\\+320" 2 { target { arm_thumb1_movt_ok || arm_thumb2_ok } } } } */ +/* { dg-final { scan-assembler-times "arr\\+320" 2 { target { arm_thumb1_movt_ok || arm_thumb2_ok } } } } */ -- cgit v1.1 From c411011287f707d42fd582a01de2ed0d36867211 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 29 Mar 2021 00:16:20 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9abcc02..557db47 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,30 @@ +2021-03-28 Christophe Lyon + + PR target/96770 + * gcc.target/arm/pure-code/pr96770.c: Improve scan-assembler-times. + +2021-03-28 Paul Thomas + + PR fortran/99602 + * gfortran.dg/pr99602.f90: New test. + * gfortran.dg/pr99602a.f90: New test. + * gfortran.dg/pr99602b.f90: New test. + * gfortran.dg/pr99602c.f90: New test. + * gfortran.dg/pr99602d.f90: New test. + +2021-03-28 Iain Buclaw + + * lib/gdc-utils.exp (gdc-copy-extra): Rename to... + (gdc-copy-file): ... this. Use file copy instead of open/close. + (gdc-convert-test): Save translated dejagnu test to gdc.test + directory, only write dejagnu directives to the test file. + (gdc-do-test): Don't create gdc.test symlink. + +2021-03-28 Iain Buclaw + + * gdc.dg/gdc270a.d: Removed. + * gdc.dg/gdc270b.d: Removed. + 2021-03-26 David Edelsohn * gcc.target/powerpc/pr99557.c: New. -- cgit v1.1 From 25e515d2199d555848dfba01fd5364df94096496 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Mon, 29 Mar 2021 12:35:32 +0200 Subject: fold-const: Fix ICE in extract_muldiv_1 [PR99777] extract_muldiv{,_1} is apparently only prepared to handle scalar integer operations, the callers ensure it by only calling it if the divisor or one of the multiplicands is INTEGER_CST and because neither multiplication nor division nor modulo are really supported e.g. for pointer types, nullptr type etc. But the CASE_CONVERT handling doesn't really check if it isn't a cast from some other type kind, so on the testcase we end up trying to build MULT_EXPR in POINTER_TYPE which ICEs. A few years ago Marek has added ANY_INTEGRAL_TYPE_P checks to two spots, but the code uses TYPE_PRECISION which means something completely different for vector types, etc. So IMNSHO we should just punt on conversions from non-integrals or non-scalar integrals. 2021-03-29 Jakub Jelinek PR tree-optimization/99777 * fold-const.c (extract_muldiv_1): For conversions, punt on casts from types other than scalar integral types. * g++.dg/torture/pr99777.C: New test. --- gcc/testsuite/g++.dg/torture/pr99777.C | 44 ++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 gcc/testsuite/g++.dg/torture/pr99777.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/torture/pr99777.C b/gcc/testsuite/g++.dg/torture/pr99777.C new file mode 100644 index 0000000..3cddde5 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr99777.C @@ -0,0 +1,44 @@ +// PR tree-optimization/99777 + +template +inline const T & +min (const T &a, const T &b) +{ + if (b < a) + return b; + return a; +} + +template +inline const T & +max (const T &a, const T &b) +{ + if (a < b) + return b; + return a; +} + +extern int o, a, c; +long h; +unsigned long long e; +signed char d; +extern short p[][7][5][30]; + +void +test (long long b, short f[][17][25][22][20]) +{ + for (char i = 0; i < 7; i += 3) + for (unsigned char l = e; l < 5; l += 2) + { + if (max (0LL, min (7LL, b))) + for (bool j = 0; j < 1; j = b) + { + for (unsigned k = d; k < 20; k++) + h = f[0][i][l][b][k]; + for (int m = 0; m < 5; m++) + p[c][i][l][m] = 0; + } + for (int n = 0; n < 4; n += a) + o = n; + } +} -- cgit v1.1 From 37d9074e12082132ae62c12fbe958c697f638c0a Mon Sep 17 00:00:00 2001 From: Kyrylo Tkachov Date: Mon, 29 Mar 2021 11:52:24 +0100 Subject: aarch64: PR target/99037 Fix RTL represntation in move_lo_quad patterns This patch fixes the RTL representation of the move_lo_quad patterns to use aarch64_simd_or_scalar_imm_zero for the zero part rather than a vec_duplicate of zero or a const_int 0. The expander that generates them is also adjusted so that we use and match the correct const_vector forms throughout. Co-Authored-By: Jakub Jelinek gcc/ChangeLog: PR target/99037 * config/aarch64/aarch64-simd.md (move_lo_quad_internal_): Use aarch64_simd_or_scalar_imm_zero to match zeroes. Remove pattern matching const_int 0. (move_lo_quad_internal_be_): Likewise. (move_lo_quad_): Update for the above. * config/aarch64/iterators.md (VQ_2E): Delete. gcc/testsuite/ChangeLog: PR target/99808 * gcc.target/aarch64/pr99808.c: New test. --- gcc/testsuite/gcc.target/aarch64/pr99808.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 gcc/testsuite/gcc.target/aarch64/pr99808.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/aarch64/pr99808.c b/gcc/testsuite/gcc.target/aarch64/pr99808.c new file mode 100644 index 0000000..4d7edab --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr99808.c @@ -0,0 +1,14 @@ +/* PR target/99808 */ +/* PR target/99037 */ +/* { dg-do compile } */ +/* { dg-options "-Og -fweb -fno-forward-propagate -g" } */ + +#include + +float32x4_t +foo (void) +{ + float64x2_t arg2 = vcombine_f64 ((float64x1_t) 0UL, (float64x1_t) 1UL); + return vcvt_high_f32_f64 ((float32x2_t) 1UL, arg2); +} + -- cgit v1.1 From 8cf2812cfceaf464dff99651b2d911d6e12b52b7 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 29 Mar 2021 13:10:37 +0200 Subject: tree-optimization/99807 - avoid bogus assert with permute SLP node This avoids asserting anything on the SLP_TREE_REPRESENTATIVE of an SLP permute node (which shouldn't be there). 2021-03-29 Richard Biener PR tree-optimization/99807 * tree-vect-slp.c (vect_slp_analyze_node_operations_1): Move assert below VEC_PERM handling. * gfortran.dg/vect/pr99807.f90: New testcase. --- gcc/testsuite/gfortran.dg/vect/pr99807.f90 | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/vect/pr99807.f90 (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gfortran.dg/vect/pr99807.f90 b/gcc/testsuite/gfortran.dg/vect/pr99807.f90 new file mode 100644 index 0000000..4ab46a3 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/vect/pr99807.f90 @@ -0,0 +1,11 @@ +! { dg-do compile } +! { dg-additional-options "-march=armv8.3-a" { target aarch64-*-* } } + +subroutine cppco(ap, z) + implicit none + complex :: ap(*), z(*) + + z(1) = z(1) + z(2) * (ap(1)) + + return +end subroutine cppco -- cgit v1.1 From e4005cf8717abe8c949f840c707e02e6c394c2e7 Mon Sep 17 00:00:00 2001 From: Alex Coplan Date: Mon, 29 Mar 2021 12:18:19 +0100 Subject: aarch64: Fix SVE ACLE builtins with LTO [PR99216] As discussed in the PR, we currently have two different numbering schemes for SVE builtins: one for C, and one for C++. This is problematic for LTO, where we end up getting confused about which intrinsic we're talking about. This patch inserts placeholders into the registered_functions vector to ensure that there is a consistent numbering scheme for both C and C++. We use integer_zero_node as a placeholder node instead of building a function decl. This is safe because the node is only returned by the TARGET_BUILTIN_DECL hook, which (on AArch64) is only used for validation when builtin decls are streamed into lto1. gcc/ChangeLog: PR target/99216 * config/aarch64/aarch64-sve-builtins.cc (function_builder::add_function): Add placeholder_p argument, use placeholder decls if this is set. (function_builder::add_unique_function): Instead of conditionally adding direct overloads, unconditionally add either a direct overload or a placeholder. (function_builder::add_overloaded_function): Set placeholder_p if we're using C++ overloads. Use the obstack for string storage instead of relying on the tree nodes. (function_builder::add_overloaded_functions): Don't return early for m_direct_overloads: we need to add placeholders. * config/aarch64/aarch64-sve-builtins.h (function_builder::add_function): Add placeholder_p argument. gcc/testsuite/ChangeLog: PR target/99216 * g++.target/aarch64/sve/pr99216.C: New test. --- gcc/testsuite/g++.target/aarch64/sve/pr99216.C | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 gcc/testsuite/g++.target/aarch64/sve/pr99216.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.target/aarch64/sve/pr99216.C b/gcc/testsuite/g++.target/aarch64/sve/pr99216.C new file mode 100644 index 0000000..61a58a7 --- /dev/null +++ b/gcc/testsuite/g++.target/aarch64/sve/pr99216.C @@ -0,0 +1,5 @@ +/* { dg-do link { target aarch64_asm_sve_ok } } */ +/* { dg-additional-options "-flto" } */ +#include +bool a; +int main() { a = svaddv(svptrue_b8(), svdup_s8(0)); } -- cgit v1.1 From afa8c67eb95f669a9bd8e356ffa073418bb269cb Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Mon, 29 Mar 2021 17:05:47 +0200 Subject: testsuite: Expect a warning on aarch64 for declare-simd-coarray-lib.f90 [PR93660] aarch64 currently doesn't support declare simd where the return value and arguments have different sizes and warns about that case. This change adds a dg-warning for that case like various other tests have already. 2021-03-29 Jakub Jelinek PR fortran/93660 * gfortran.dg/gomp/declare-simd-coarray-lib.f90: Expect a mixed size declare simd warning on aarch64. --- gcc/testsuite/gfortran.dg/gomp/declare-simd-coarray-lib.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gfortran.dg/gomp/declare-simd-coarray-lib.f90 b/gcc/testsuite/gfortran.dg/gomp/declare-simd-coarray-lib.f90 index 1f74da7..f0c4e39 100644 --- a/gcc/testsuite/gfortran.dg/gomp/declare-simd-coarray-lib.f90 +++ b/gcc/testsuite/gfortran.dg/gomp/declare-simd-coarray-lib.f90 @@ -5,7 +5,7 @@ ! Failed as TREE_TYPE(fndecl) did not include the ! hidden caf_token/caf_offset arguments. ! -integer function f(x) +integer function f(x) ! { dg-warning "GCC does not currently support mixed size types for 'simd' functions" "" { target aarch64*-*-* } } integer :: x[*] !$omp declare simd f = x[1] -- cgit v1.1 From dd64aaafe6916ac11ccae3182b4550c8b8f5e066 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Mon, 29 Mar 2021 20:09:35 +0200 Subject: Fix typo in merge_call_lhs_flags gcc/ChangeLog: 2021-03-29 Jan Hubicka * ipa-modref.c (merge_call_lhs_flags): Correct handling of deref. (analyze_ssa_name_flags): Fix typo in comment. gcc/testsuite/ChangeLog: 2021-03-29 Jan Hubicka * gcc.c-torture/compile/pr99751.c: New test. --- gcc/testsuite/gcc.c-torture/compile/pr99751.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr99751.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.c-torture/compile/pr99751.c b/gcc/testsuite/gcc.c-torture/compile/pr99751.c new file mode 100644 index 0000000..f1d5101 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr99751.c @@ -0,0 +1,20 @@ +int *ptr1 = 0, **ptr2 = &ptr1; + +int *identity(int *p) +{ + return p; +} + +void store_to_c(int *p) +{ + *ptr2 = identity(p); +} + +int main() +{ + int f; + store_to_c(&f); + if (ptr1 != &f) + __builtin_abort(); + return 0; +} -- cgit v1.1 From 7b6ca93b2d57ead352cd5cc3e10be4c33dda674b Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Mon, 29 Mar 2021 20:59:42 +0200 Subject: Fix pr99751.c testcase PR ipa/99751 * gcc.c-torture/compile/pr99751.c: Rename from ... * gcc.c-torture/execute/pr99751.c: ... to this. --- gcc/testsuite/gcc.c-torture/compile/pr99751.c | 20 -------------------- gcc/testsuite/gcc.c-torture/execute/pr99751.c | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 20 deletions(-) delete mode 100644 gcc/testsuite/gcc.c-torture/compile/pr99751.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr99751.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.c-torture/compile/pr99751.c b/gcc/testsuite/gcc.c-torture/compile/pr99751.c deleted file mode 100644 index f1d5101..0000000 --- a/gcc/testsuite/gcc.c-torture/compile/pr99751.c +++ /dev/null @@ -1,20 +0,0 @@ -int *ptr1 = 0, **ptr2 = &ptr1; - -int *identity(int *p) -{ - return p; -} - -void store_to_c(int *p) -{ - *ptr2 = identity(p); -} - -int main() -{ - int f; - store_to_c(&f); - if (ptr1 != &f) - __builtin_abort(); - return 0; -} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr99751.c b/gcc/testsuite/gcc.c-torture/execute/pr99751.c new file mode 100644 index 0000000..f1d5101 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr99751.c @@ -0,0 +1,20 @@ +int *ptr1 = 0, **ptr2 = &ptr1; + +int *identity(int *p) +{ + return p; +} + +void store_to_c(int *p) +{ + *ptr2 = identity(p); +} + +int main() +{ + int f; + store_to_c(&f); + if (ptr1 != &f) + __builtin_abort(); + return 0; +} -- cgit v1.1 From 77093a75ca4f3a0d6d9ca77ca8905b77695a2599 Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Mon, 29 Mar 2021 13:52:53 -0600 Subject: PR tree-optimization/61112 - repeated conditional triggers false positive -Wmaybe-uninitialized gcc/testsuite/ChangeLog: PR tree-optimization/61112 * gcc.dg/uninit-pr61112.c: New test. --- gcc/testsuite/gcc.dg/uninit-pr61112.c | 89 +++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/uninit-pr61112.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/uninit-pr61112.c b/gcc/testsuite/gcc.dg/uninit-pr61112.c new file mode 100644 index 0000000..1dbf756 --- /dev/null +++ b/gcc/testsuite/gcc.dg/uninit-pr61112.c @@ -0,0 +1,89 @@ +/* PR tree-optimization/61112 - repeated conditional triggers false-positive + -Wmaybe-uninitialized warning + { dg-do compile } + { dg-options "-O2 -Wall" } */ + +int p; + +void foo_c0 (int x, int y, int z) +{ + int w; + if (x) + w = z; + if (y) + w = __LINE__; + + if (x || y) + p = w; // { dg-bogus "-Wmaybe-uninitialized" } +} + + +void foo_c5_1_1 (int x, int y, int z, int a) +{ + int w; + if (x) + w = z; + if (y) + w = __LINE__; + if (a) + w = __LINE__; + + if (x || y || a) + p = w; // { dg-bogus "-Wmaybe-uninitialized" "pr61112" { xfail *-*-* } } +} + +void foo_c5_1_2 (int x, int y, int z, int a) +{ + int w; + if (x) + w = z; + if (y) + w = __LINE__; + if (a) + w = __LINE__; + + if (x || a || y) + p = w; // { dg-bogus "-Wmaybe-uninitialized" "pr61112" { xfail *-*-* } } +} + +void foo_c5_1_3 (int x, int y, int z, int a) +{ + int w; + if (x) + w = z; + if (y) + w = __LINE__; + if (a) + w = __LINE__; + + if (a || x || y) + p = w; // { dg-bogus "-Wmaybe-uninitialized" "pr61112" { xfail *-*-* } } +} + +void foo_c5_2 (int x, int y, int z, int a) +{ + int w; + if (x) + w = __LINE__; + if (y) + w = z; + if (a) + w = __LINE__; + + if (x || y || a) + p = w; // { dg-bogus "-Wmaybe-uninitialized" } +} + +void foo_c5_3 (int x, int y, int z, int a) +{ + int w; + if (x) + w = __LINE__; + if (y) + w = __LINE__; + if (a) + w = z; + + if (x || y || a) + p = w; // { dg-bogus "-Wmaybe-uninitialized" } +} -- cgit v1.1 From fecc835e216f537d3e7edb833cb3769489b983bb Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Mon, 29 Mar 2021 15:21:32 -0600 Subject: PR tree-optimization/61677 - False positive with -Wmaybe-uninitialized gcc/testsuite/ChangeLog: PR tree-optimization/61677 * gcc.dg/uninit-pr61677.c: New test. --- gcc/testsuite/gcc.dg/uninit-pr61677.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/uninit-pr61677.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/uninit-pr61677.c b/gcc/testsuite/gcc.dg/uninit-pr61677.c new file mode 100644 index 0000000..a982fae --- /dev/null +++ b/gcc/testsuite/gcc.dg/uninit-pr61677.c @@ -0,0 +1,26 @@ +/* PR tree-optimization/61677 - False positive with -Wmaybe-uninitialized + { dg-do compile } + { dg-options "-O2 -Wall" } */ + +void *xmalloc (void); + +struct menu { struct menu *parent; }; + +struct jump_key { int offset; }; + +void f (struct menu *menu) +{ + int i; + struct menu *submenu[8], *location; + struct jump_key *jump; + location = menu; + for (i = 0; menu && i < 8; menu = menu->parent) + submenu[i++] = menu; + if (location) + jump = xmalloc (); + while (--i >= 0) { + menu = submenu[i]; + if (location) + jump->offset = 42; + } +} -- cgit v1.1 From af739c8797d4cdf550366d0ef48136e0073df5c9 Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Mon, 29 Mar 2021 15:58:01 -0600 Subject: PR tree-optimization/61869 - Spurious uninitialized warning gcc/testsuite/ChangeLog: PR tree-optimization/61869 * gcc.dg/uninit-pr61869.c: New test. --- gcc/testsuite/gcc.dg/uninit-pr61869.c | 47 +++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/uninit-pr61869.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/uninit-pr61869.c b/gcc/testsuite/gcc.dg/uninit-pr61869.c new file mode 100644 index 0000000..ef4f436 --- /dev/null +++ b/gcc/testsuite/gcc.dg/uninit-pr61869.c @@ -0,0 +1,47 @@ +/* PR tree-optimization/61869 - Spurious uninitialized warning (lim1 pass, + pretty-printed internal var + { dg-do compile } + { dg-options "-O2 -Wall" } */ + +typedef struct data { + struct data *next; +} data; + +typedef struct list { + unsigned dummy; + struct list *next; + data *start; + int flags; +} list; + +typedef struct iterator { + struct data *ptr; + unsigned dummy; +} iterator; + +iterator start (list *a) { + iterator i = { + *(a->flags ? &a->start : 0), + 0 + }; + return i; +} + +void g (iterator *i); + +void f (list *b) +{ + list *a; + iterator i; // { dg-bogus "-Wmaybe-uninitialized" } + + for (a = b; a; a = a->next) + for (i = start (a); i.ptr; i.ptr = i.ptr->next) + { + if (i.ptr) + return; + } + + for (a = b; a; a = a->next) + for (i = start (a); i.ptr; i.ptr = i.ptr->next) + g(&i); +} -- cgit v1.1 From 65374af219f9c5c594951a07e766fe70c1136a1f Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 30 Mar 2021 00:16:29 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 51 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 557db47..570f2a7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,54 @@ +2021-03-29 Martin Sebor + + PR tree-optimization/61869 + * gcc.dg/uninit-pr61869.c: New test. + +2021-03-29 Martin Sebor + + PR tree-optimization/61677 + * gcc.dg/uninit-pr61677.c: New test. + +2021-03-29 Martin Sebor + + PR tree-optimization/61112 + * gcc.dg/uninit-pr61112.c: New test. + +2021-03-29 Jan Hubicka + + PR ipa/99751 + * gcc.c-torture/compile/pr99751.c: Rename from ... + * gcc.c-torture/execute/pr99751.c: ... to this. + +2021-03-29 Jan Hubicka + + * gcc.c-torture/compile/pr99751.c: New test. + +2021-03-29 Jakub Jelinek + + PR fortran/93660 + * gfortran.dg/gomp/declare-simd-coarray-lib.f90: Expect a mixed size + declare simd warning on aarch64. + +2021-03-29 Alex Coplan + + PR target/99216 + * g++.target/aarch64/sve/pr99216.C: New test. + +2021-03-29 Richard Biener + + PR tree-optimization/99807 + * gfortran.dg/vect/pr99807.f90: New testcase. + +2021-03-29 Kyrylo Tkachov + + PR target/99808 + * gcc.target/aarch64/pr99808.c: New test. + +2021-03-29 Jakub Jelinek + + PR tree-optimization/99777 + * g++.dg/torture/pr99777.C: New test. + 2021-03-28 Christophe Lyon PR target/96770 -- cgit v1.1 From cc2fda1328ee69b92724d6b3cffb741f07d86047 Mon Sep 17 00:00:00 2001 From: Mihailo Stojanovic Date: Tue, 30 Mar 2021 11:42:49 +0100 Subject: aarch64: Prevent use of SIMD fcvtz[su] instruction variant with "nosimd" Currently, SF->SI and DF->DI conversions on Aarch64 with the "nosimd" flag provided sometimes cause the emitting of a vector variant of the fcvtz[su] instruction (e.g. fcvtzu s0, s0). This modifies the corresponding pattern to only select the vector variant of the instruction when generating code with SIMD enabled. gcc/ChangeLog: * config/aarch64/aarch64.md (_trunc2): Set the "arch" attribute to disambiguate between SIMD and FP variants of the instruction. gcc/testsuite/ChangeLog: * gcc.target/aarch64/fcvt_nosimd.c: New test. --- gcc/testsuite/gcc.target/aarch64/fcvt_nosimd.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 gcc/testsuite/gcc.target/aarch64/fcvt_nosimd.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/aarch64/fcvt_nosimd.c b/gcc/testsuite/gcc.target/aarch64/fcvt_nosimd.c new file mode 100644 index 0000000..7b2ab65 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/fcvt_nosimd.c @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-options "-march=armv8-a+nosimd" } */ + +#include + +uint64_t test_double_to_uint64(double x) { + return (uint64_t)x; +} + +int64_t test_double_to_int64(double x) { + return (int64_t)x; +} + +uint32_t test_float_to_uint32(float x) { + return (uint32_t)x; +} + +int32_t test_float_to_int32(float x) { + return (int32_t)x; +} + +/* { dg-final { scan-assembler-not {\tfcvtz[su]\td[0-9]*, d[0-9]*} } } */ +/* { dg-final { scan-assembler-not {\tfcvtz[su]\ts[0-9]*, s[0-9]*} } } */ -- cgit v1.1 From 48c79f054bf435051c95ee093c45a0f8c9de5b4e Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Tue, 30 Mar 2021 11:42:50 +0100 Subject: aarch64: Tweak post-RA handling of CONST_INT moves [PR98136] This PR is a regression caused by r8-5967, where we replaced a call to aarch64_internal_mov_immediate in aarch64_add_offset with a call to aarch64_force_temporary, which in turn uses the normal emit_move_insn{,_1} routines. The problem is that aarch64_add_offset can be called while outputting a thunk, where we require all instructions to be valid without splitting. However, the move expanders were not splitting CONST_INT moves themselves. I think the right fix is to make the move expanders work even in this scenario, rather than require callers to handle it as a special case. gcc/ PR target/98136 * config/aarch64/aarch64.md (mov): Pass multi-instruction CONST_INTs to aarch64_expand_mov_immediate when called after RA. gcc/testsuite/ PR target/98136 * g++.dg/pr98136.C: New test. --- gcc/testsuite/g++.dg/pr98136.C | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 gcc/testsuite/g++.dg/pr98136.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/pr98136.C b/gcc/testsuite/g++.dg/pr98136.C new file mode 100644 index 0000000..f3c27f6 --- /dev/null +++ b/gcc/testsuite/g++.dg/pr98136.C @@ -0,0 +1,26 @@ +// { dg-do compile { target { ilp32 || lp64 } } } + +struct AddIn +{ + virtual ~AddIn() {} + virtual void AddInCall()=0; +}; + +struct Base +{ + char b[32*1024*1024]; // Anything bigger than 16mb causes internal compiler error + virtual ~Base() {} +}; + +struct Deriv : public Base, + public AddIn +{ + void AddInCall() {} +}; + +int main (int argc, char **argv) +{ + Deriv deriv; + deriv.AddInCall(); + return 0; +} -- cgit v1.1 From bd3d919b58466a9837e423c1255b88215f89bc9d Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 30 Mar 2021 11:22:52 +0200 Subject: tree-optimization/99824 - avoid excessive integer type precision in VN VN sometimes builds new integer types to handle accesss where precision of the access type does not match the access size. The way ao_ref_init_from_vn_reference is computing the access size ignores the access type in case the ref operands have an outermost COMPONENT_REF which, in case it is an array for example, can be way larger than the access size. This can cause us to try building an integer type with precision larger than WIDE_INT_MAX_PRECISION eventually leading to memory corruption. The following adjusts ao_ref_init_from_vn_reference to only lower access sizes via the outermost COMPONENT_REF but otherwise honor the access size as specified by the access type. It also places an assert in integer type building that we remain in the limits of WIDE_INT_MAX_PRECISION. I chose the shared code where we set TYPE_MIN/MAX_VALUE because that will immediately cross the wide_ints capacity otherwise. 2021-03-30 Richard Biener PR tree-optimization/99824 * stor-layout.c (set_min_and_max_values_for_integral_type): Assert the precision is within the bounds of WIDE_INT_MAX_PRECISION. * tree-ssa-sccvn.c (ao_ref_init_from_vn_reference): Use the outermost component ref only to lower the access size and initialize that from the access type. * gcc.dg/torture/pr99824.c: New testcase. --- gcc/testsuite/gcc.dg/torture/pr99824.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/torture/pr99824.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/torture/pr99824.c b/gcc/testsuite/gcc.dg/torture/pr99824.c new file mode 100644 index 0000000..9022d4a --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr99824.c @@ -0,0 +1,33 @@ +/* { dg-do compile } */ + +unsigned int +strlenx(char *s) +{ + char *orig_s = s; + for (; *s; ++s) + ; + return s - orig_s; +} + +struct i2c_adapter { + char name[48]; +}; + +struct { + int instance; + struct i2c_adapter i2c_adap[]; +} * init_cx18_i2c_cx; + +const struct i2c_adapter cx18_i2c_adap_template = {""}; +int init_cx18_i2c___trans_tmp_1; + +void +init_cx18_i2c() +{ + int i = 0; + for (;; i++) { + init_cx18_i2c_cx->i2c_adap[i] = cx18_i2c_adap_template; + init_cx18_i2c___trans_tmp_1 + = strlenx(init_cx18_i2c_cx->i2c_adap[i].name); + } +} -- cgit v1.1 From 41d57b2a97c44ae7b0a5b01ae703a8f0d0495238 Mon Sep 17 00:00:00 2001 From: Kyrylo Tkachov Date: Tue, 30 Mar 2021 14:07:50 +0100 Subject: aarch64: Fix gcc.target/aarch64/pr99808.c for ILP32 Fix test for -mabi=ilp32 gcc/testsuite/ChangeLog: PR target/99808 * gcc.target/aarch64/pr99808.c: Use ULL constant suffix. --- gcc/testsuite/gcc.target/aarch64/pr99808.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/aarch64/pr99808.c b/gcc/testsuite/gcc.target/aarch64/pr99808.c index 4d7edab..713360f 100644 --- a/gcc/testsuite/gcc.target/aarch64/pr99808.c +++ b/gcc/testsuite/gcc.target/aarch64/pr99808.c @@ -8,7 +8,7 @@ float32x4_t foo (void) { - float64x2_t arg2 = vcombine_f64 ((float64x1_t) 0UL, (float64x1_t) 1UL); - return vcvt_high_f32_f64 ((float32x2_t) 1UL, arg2); + float64x2_t arg2 = vcombine_f64 ((float64x1_t) 0ULL, (float64x1_t) 1ULL); + return vcvt_high_f32_f64 ((float32x2_t) 1ULL, arg2); } -- cgit v1.1 From 9c68e2abe294a48385224cd7617eca0720144b5c Mon Sep 17 00:00:00 2001 From: Tamar Christina Date: Tue, 30 Mar 2021 14:16:03 +0100 Subject: slp: reject non-multiple of 2 laned SLP trees (PR99825) TWO_OPERANDS allows any order or number of combinations of + and - operations but the pattern matcher only supports pairs of operations. This patch has the pattern matcher for complex numbers reject SLP trees where the lanes are not a multiple of 2. gcc/ChangeLog: PR tree-optimization/99825 * tree-vect-slp-patterns.c (vect_check_evenodd_blend): Reject non-mult 2 lanes. gcc/testsuite/ChangeLog: PR tree-optimization/99825 * gfortran.dg/vect/pr99825.f90: New test. --- gcc/testsuite/gfortran.dg/vect/pr99825.f90 | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/vect/pr99825.f90 (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gfortran.dg/vect/pr99825.f90 b/gcc/testsuite/gfortran.dg/vect/pr99825.f90 new file mode 100644 index 0000000..b1423df --- /dev/null +++ b/gcc/testsuite/gfortran.dg/vect/pr99825.f90 @@ -0,0 +1,15 @@ +! { dg-do compile } +! { dg-additional-options "-march=armv8.3-a -O3" { target { aarch64*-*-* } } } + +program main + complex, dimension(3, 2) :: a + complex, dimension(2, 4) :: b + complex, dimension(3, 4) :: c, res1 + + data a /0, (-5., -7.), (11., -13.), 0, 0, 0/ + data b /0, 0, 0, 0, 0, 0, 0, 0/ + data res1 /0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0/ + + c = matmul(a, conjg(b)) + if (any(res1 /= c)) stop 2 +end program main -- cgit v1.1 From 5463cee277038df4688b61144db498ae7d24e631 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Tue, 23 Mar 2021 20:04:58 -0700 Subject: x86: Define __rdtsc and __rdtscp as macros Define __rdtsc and __rdtscp as macros for callers with general-regs-only target attribute to avoid inline failure with always_inline attribute. gcc/ PR target/99744 * config/i386/ia32intrin.h (__rdtsc): Defined as macro. (__rdtscp): Likewise. gcc/testsuite/ PR target/99744 * gcc.target/i386/pr99744-1.c: New test. --- gcc/testsuite/gcc.target/i386/pr99744-1.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr99744-1.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/i386/pr99744-1.c b/gcc/testsuite/gcc.target/i386/pr99744-1.c new file mode 100644 index 0000000..a5a905c --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr99744-1.c @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +#include + +extern unsigned long long int curr_deadline; +extern void bar (void); + +__attribute__ ((target("general-regs-only"))) +void +foo1 (void) +{ + if (__rdtsc () < curr_deadline) + return; + bar (); +} + +__attribute__ ((target("general-regs-only"))) +void +foo2 (unsigned int *p) +{ + if (__rdtscp (p) < curr_deadline) + return; + bar (); +} -- cgit v1.1 From f64b91568f3ac8f152c6c617b4fcc6b51da10ac4 Mon Sep 17 00:00:00 2001 From: "luoxhu@cn.ibm.com" Date: Fri, 26 Mar 2021 22:26:57 -0500 Subject: rs6000: Enable 32bit variable vec_insert [PR99718] 32bit and P7 VSX could also benefit a lot from the variable vec_insert implementation with shift/insert/shift back method. 2011-03-29 Xionghu Luo PR target/99718 * config/rs6000/altivec.md (altivec_lvsl_reg): Change to ... (altivec_lvsl_reg_): ... this. (altivec_lvsr_reg): Change to ... (altivec_lvsr_reg_): ... this. * config/rs6000/predicates.md (vec_set_index_operand): New. * config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin): Enable 32bit variable vec_insert for all TARGET_VSX. * config/rs6000/rs6000.c (rs6000_expand_vector_set_var_p9): Enable 32bit variable vec_insert for p9 and above. (rs6000_expand_vector_set_var_p8): Rename to ... (rs6000_expand_vector_set_var_p7): ... this. (rs6000_expand_vector_set): Use TARGET_VSX and adjust assert position. * config/rs6000/vector.md (vec_set): Use vec_set_index_operand. * config/rs6000/vsx.md (xl_len_r): Use gen_altivec_lvsl_reg_di and gen_altivec_lvsr_reg_di. gcc/testsuite/ PR target/99718 * gcc.target/powerpc/fold-vec-insert-char-p8.c: Update instruction counts. * gcc.target/powerpc/fold-vec-insert-char-p9.c: Likewise. * gcc.target/powerpc/fold-vec-insert-double.c: Likewise. * gcc.target/powerpc/fold-vec-insert-float-p8.c: Likewise. * gcc.target/powerpc/fold-vec-insert-float-p9.c: Likewise. * gcc.target/powerpc/fold-vec-insert-int-p8.c: Likewise. * gcc.target/powerpc/fold-vec-insert-int-p9.c: Likewise. * gcc.target/powerpc/fold-vec-insert-longlong.c: Likewise. * gcc.target/powerpc/fold-vec-insert-short-p8.c: Likewise. * gcc.target/powerpc/fold-vec-insert-short-p9.c: Likewise. * gcc.target/powerpc/pr79251.p8.c: Likewise. * gcc.target/powerpc/pr79251.p9.c: Likewise. * gcc.target/powerpc/vsx-builtin-7.c: Likewise. * gcc.target/powerpc/pr79251-run.p7.c: New test. * gcc.target/powerpc/pr79251.p7.c: New test. --- .../gcc.target/powerpc/fold-vec-insert-char-p8.c | 8 ++++---- .../gcc.target/powerpc/fold-vec-insert-char-p9.c | 4 ++-- .../gcc.target/powerpc/fold-vec-insert-double.c | 18 ++++++++--------- .../gcc.target/powerpc/fold-vec-insert-float-p8.c | 4 ++-- .../gcc.target/powerpc/fold-vec-insert-float-p9.c | 2 +- .../gcc.target/powerpc/fold-vec-insert-int-p8.c | 6 +++--- .../gcc.target/powerpc/fold-vec-insert-int-p9.c | 6 +++--- .../gcc.target/powerpc/fold-vec-insert-longlong.c | 6 +++--- .../gcc.target/powerpc/fold-vec-insert-short-p8.c | 6 +++--- .../gcc.target/powerpc/fold-vec-insert-short-p9.c | 6 +++--- gcc/testsuite/gcc.target/powerpc/pr79251-run.p7.c | 15 ++++++++++++++ gcc/testsuite/gcc.target/powerpc/pr79251.p7.c | 23 ++++++++++++++++++++++ gcc/testsuite/gcc.target/powerpc/pr79251.p8.c | 10 +++++----- gcc/testsuite/gcc.target/powerpc/pr79251.p9.c | 6 +++--- gcc/testsuite/gcc.target/powerpc/vsx-builtin-7.c | 11 ++++++----- 15 files changed, 85 insertions(+), 46 deletions(-) create mode 100644 gcc/testsuite/gcc.target/powerpc/pr79251-run.p7.c create mode 100644 gcc/testsuite/gcc.target/powerpc/pr79251.p7.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-char-p8.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-char-p8.c index 4149d52..e0c7ee1 100644 --- a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-char-p8.c +++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-char-p8.c @@ -58,8 +58,8 @@ vector unsigned char testuu_cst (unsigned char x, vector unsigned char v) /* { dg-final { scan-assembler-times {\mvperm\M} 12 { target lp64 } } } */ /* -m32 codegen. */ -/* { dg-final { scan-assembler-times {\mstvx\M|\mstxvw4x\M} 4 { target ilp32 } } } */ -/* { dg-final { scan-assembler-times {\mstb\M} 8 { target ilp32 } } } */ -/* { dg-final { scan-assembler-times {\mlvx\M|\mlxvw4x\M} 8 { target { be && ilp32 } } } } */ -/* { dg-final { scan-assembler-times {\mvperm\M} 4 { target ilp32 } } } */ +/* { dg-final { scan-assembler-times {\mstvx\M|\mstxvw4x\M} 0 { target ilp32 } } } */ +/* { dg-final { scan-assembler-times {\mstb\M} 4 { target ilp32 } } } */ +/* { dg-final { scan-assembler-times {\mlvx\M|\mlxvw4x\M} 4 { target { be && ilp32 } } } } */ +/* { dg-final { scan-assembler-times {\mvperm\M} 12 { target ilp32 } } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-char-p9.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-char-p9.c index b8e751f..c18444d 100644 --- a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-char-p9.c +++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-char-p9.c @@ -54,8 +54,8 @@ vector unsigned char testuu_cst (unsigned char x, vector unsigned char v) /* -m32 codegen. */ /* { dg-final { scan-assembler-times {\mrlwinm\M} 4 { target ilp32 } } } */ -/* { dg-final { scan-assembler-times {\mstb\M} 8 { target ilp32 } } } */ +/* { dg-final { scan-assembler-times {\mstb\M} 4 { target ilp32 } } } */ /* { dg-final { scan-assembler-times {\mlxv\M} 8 { target ilp32 } } } */ /* { dg-final { scan-assembler-times {\mlvebx\M} 4 { target ilp32 } } } */ /* { dg-final { scan-assembler-times {\mvperm\M} 4 { target ilp32 } } } */ -/* { dg-final { scan-assembler-times {\mxxperm\M} 0 { target ilp32 } } } */ +/* { dg-final { scan-assembler-times {\mxxperm\M} 8 { target ilp32 } } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-double.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-double.c index 1286010..afd7f7e 100644 --- a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-double.c +++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-double.c @@ -24,15 +24,15 @@ testd_cst (double d, vector double vd) /* { dg-final { scan-assembler-times {\mrldic\M|\mrlwinm\M} 1 } } */ -/* { dg-final { scan-assembler-times {\mstxvd2x\M|\mstxv\M|\mstvx\M} 1 { target { ! has_arch_pwr8 } } } } */ -/* { dg-final { scan-assembler-times {\mstfdx\M|\mstfd\M} 1 { target { ! has_arch_pwr8 } } } } */ -/* { dg-final { scan-assembler-times {\mlxvd2x\M|\mlxv\M|\mlvx\M} 1 { target { ! has_arch_pwr8 } } } } */ +/* { dg-final { scan-assembler-times {\mstxvd2x\M|\mstxv\M|\mstvx\M} 1 { target { ! has_arch_pwr7 } } } } */ +/* { dg-final { scan-assembler-times {\mstfdx\M|\mstfd\M} 1 { target { ! has_arch_pwr7 } } } } */ +/* { dg-final { scan-assembler-times {\mlxvd2x\M|\mlxv\M|\mlvx\M} 1 { target { ! has_arch_pwr7 } } } } */ -/* { dg-final { scan-assembler-times {\mstxvd2x\M|\mstxv\M|\mstvx\M} 0 { target { has_arch_pwr8 && lp64 } } } } */ -/* { dg-final { scan-assembler-times {\mstfdx\M|\mstfd\M} 0 { target { has_arch_pwr8 && lp64 } } } } */ +/* { dg-final { scan-assembler-times {\mstxvd2x\M|\mstxv\M|\mstvx\M} 0 { target { has_arch_pwr7 && lp64 } } } } */ +/* { dg-final { scan-assembler-times {\mstfdx\M|\mstfd\M} 0 { target { has_arch_pwr7 && lp64 } } } } */ -/* { dg-final { scan-assembler-times {\mlxvd2x\M|\mlxv\M|\mlvx\M} 0 { target { has_arch_pwr8 && lp64 } } } } */ -/* { dg-final { scan-assembler-times {\mlxvd2x\M|\mlxv\M|\mlvx\M} 1 { target { has_arch_pwr8 && ilp32 } } } } */ -/* { dg-final { scan-assembler-times {\mstxvd2x\M|\mstxv\M|\mstvx\M} 1 { target { has_arch_pwr8 && ilp32 } } } } */ -/* { dg-final { scan-assembler-times {\mstfdx\M|\mstfd\M} 1 { target { has_arch_pwr8 && ilp32 } } } } */ +/* { dg-final { scan-assembler-times {\mlxvd2x\M|\mlxv\M|\mlvx\M} 0 { target { has_arch_pwr7 && lp64 } } } } */ +/* { dg-final { scan-assembler-times {\mlxvd2x\M|\mlxv\M|\mlvx\M} 0 { target { has_arch_pwr7 && ilp32 } } } } */ +/* { dg-final { scan-assembler-times {\mstxvd2x\M|\mstxv\M|\mstvx\M} 0 { target { has_arch_pwr7 && ilp32 } } } } */ +/* { dg-final { scan-assembler-times {\mstfdx\M|\mstfd\M} 0 { target { has_arch_pwr7 && ilp32 } } } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-float-p8.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-float-p8.c index e458d8f..1866ce2 100644 --- a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-float-p8.c +++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-float-p8.c @@ -29,8 +29,8 @@ testf_cst (float f, vector float vf) /* { dg-final { scan-assembler-times {\mvperm\M} 3 { target lp64 } } } */ /* -m32 codegen. */ -/* { dg-final { scan-assembler-times {\mstvx\M|\mstxv\M|\mstxvd2x\M} 1 { target ilp32 } } } */ +/* { dg-final { scan-assembler-times {\mstvx\M|\mstxv\M|\mstxvd2x\M} 0 { target ilp32 } } } */ /* { dg-final { scan-assembler-times {\mstfs\M|\mstfsx\M} 2 { target ilp32 } } } */ -/* { dg-final { scan-assembler-times {\mvperm\M} 1 { target ilp32 } } } */ +/* { dg-final { scan-assembler-times {\mvperm\M} 3 { target ilp32 } } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-float-p9.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-float-p9.c index 9684c9f..1c57672 100644 --- a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-float-p9.c +++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-float-p9.c @@ -32,4 +32,4 @@ testf_cst (float f, vector float vf) /* { dg-final { scan-assembler-times {\mlxv\M} 2 { target ilp32 } } } */ /* { dg-final { scan-assembler-times {\mlvewx\M} 1 { target ilp32 } } } */ /* { dg-final { scan-assembler-times {\mvperm\M} 1 { target ilp32 } } } */ -/* { dg-final { scan-assembler-times {\mxxperm\M} 0 { target ilp32 } } } */ +/* { dg-final { scan-assembler-times {\mxxperm\M} 2 { target ilp32 } } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-int-p8.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-int-p8.c index d5fa422c..bcee9b2 100644 --- a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-int-p8.c +++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-int-p8.c @@ -57,7 +57,7 @@ testui2_cst(unsigned int x, vector unsigned int v) /* { dg-final { scan-assembler-times {\mlvewx\M} 4 { target lp64 } } } */ /* { dg-final { scan-assembler-times {\mvperm\M} 12 { target lp64 } } } */ -/* { dg-final { scan-assembler-times {\mvperm\M} 4 { target ilp32 } } } */ -/* { dg-final { scan-assembler-times {\mstvx\M|\mstwx\M|\mstw\M|\mstxvw4x\M} 12 { target ilp32 } } } */ -/* { dg-final { scan-assembler-times {\mlvx\M|\mlxvw4x\M} 8 { target { be && ilp32 } } } } */ +/* { dg-final { scan-assembler-times {\mvperm\M} 12 { target ilp32 } } } */ +/* { dg-final { scan-assembler-times {\mstvx\M|\mstwx\M|\mstw\M|\mstxvw4x\M} 4 { target ilp32 } } } */ +/* { dg-final { scan-assembler-times {\mlvx\M|\mlxvw4x\M} 4 { target { be && ilp32 } } } } */ /* { dg-final { scan-assembler-times {\mlvewx\M} 4 { target ilp32 } } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-int-p9.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-int-p9.c index 5cd6b3e..5512810 100644 --- a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-int-p9.c +++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-int-p9.c @@ -57,9 +57,9 @@ testui2_cst(unsigned int x, vector unsigned int v) /* { dg-final { scan-assembler-times {\mmtvsrwz\M} 8 { target lp64 } } } */ /* { dg-final { scan-assembler-times {\mxxinsertw\M} 8 { target lp64 } } } */ -/* { dg-final { scan-assembler-times {\mstxv\M|\mstvx\M} 4 { target ilp32 } } } */ -/* { dg-final { scan-assembler-times {\mstw\M} 8 { target ilp32 } } } */ +/* { dg-final { scan-assembler-times {\mstxv\M|\mstvx\M} 0 { target ilp32 } } } */ +/* { dg-final { scan-assembler-times {\mstw\M} 4 { target ilp32 } } } */ /* { dg-final { scan-assembler-times {\mlxv\M} 8 { target ilp32 } } } */ /* { dg-final { scan-assembler-times {\mlvewx\M} 4 { target ilp32 } } } */ /* { dg-final { scan-assembler-times {\mvperm\M} 4 { target ilp32 } } } */ -/* { dg-final { scan-assembler-times {\mxxperm\M} 0 { target ilp32 } } } */ +/* { dg-final { scan-assembler-times {\mxxperm\M} 8 { target ilp32 } } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-longlong.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-longlong.c index 0a0ee31..8ca4ac7 100644 --- a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-longlong.c +++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-longlong.c @@ -65,6 +65,6 @@ testul2_cst(unsigned long long x, vector unsigned long long v) /* { dg-final { scan-assembler-times {\mlxvd2x\M|\mlxv\M|\mlvx\M} 0 { target lp64 } } } */ -/* { dg-final { scan-assembler-times {\mstxvd2x\M|\mstvx\M|\mstxv\M} 4 { target ilp32 } } } */ -/* { dg-final { scan-assembler-times {\mvperm\M} 0 { target ilp32 } } } */ -/* { dg-final { scan-assembler-times {\mlxvd2x\M|\mlxv\M|\mlvx\M} 4 { target ilp32 } } } */ +/* { dg-final { scan-assembler-times {\mstxvd2x\M|\mstvx\M|\mstxv\M} 0 { target ilp32 } } } */ +/* { dg-final { scan-assembler-times {\mvperm\M} 8 { target ilp32 } } } */ +/* { dg-final { scan-assembler-times {\mlxvd2x\M|\mlxv\M|\mlvx\M} 0 { target ilp32 } } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-short-p8.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-short-p8.c index a479d98..0d9d4e7 100644 --- a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-short-p8.c +++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-short-p8.c @@ -56,7 +56,7 @@ testus2_cst(unsigned short x, vector unsigned short v) /* { dg-final { scan-assembler-times {\mlvehx\M} 4 } } */ /* { dg-final { scan-assembler-times {\mvperm\M} 12 { target lp64 } } } */ -/* { dg-final { scan-assembler-times {\mlhz\M|\mlvx\M|\mlxv\M|\mlxvw4x\M} 8 { target { be && ilp32 } } } } */ -/* { dg-final { scan-assembler-times {\msthx\M|\mstvx\M|\msth\M|\mstxvw4x\M} 12 { target ilp32 } } } */ -/* { dg-final { scan-assembler-times {\mvperm\M} 4 { target ilp32 } } } */ +/* { dg-final { scan-assembler-times {\mlhz\M|\mlvx\M|\mlxv\M|\mlxvw4x\M} 4 { target { be && ilp32 } } } } */ +/* { dg-final { scan-assembler-times {\msthx\M|\mstvx\M|\msth\M|\mstxvw4x\M} 4 { target ilp32 } } } */ +/* { dg-final { scan-assembler-times {\mvperm\M} 12 { target ilp32 } } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-short-p9.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-short-p9.c index cea7488b..050adb2 100644 --- a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-short-p9.c +++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-short-p9.c @@ -55,10 +55,10 @@ testus2_cst(unsigned short x, vector unsigned short v) /* { dg-final { scan-assembler-times {\mlxv\M|\mlvx\M} 0 { target lp64 }} } */ /* -m32 uses sth/lvehx as part of the sequence. */ -/* { dg-final { scan-assembler-times {\mstxv\M|\mstvx\M} 4 { target ilp32 } } } */ -/* { dg-final { scan-assembler-times {\msth\M} 8 { target ilp32 } } } */ +/* { dg-final { scan-assembler-times {\mstxv\M|\mstvx\M} 0 { target ilp32 } } } */ +/* { dg-final { scan-assembler-times {\msth\M} 4 { target ilp32 } } } */ /* { dg-final { scan-assembler-times {\mlvehx\M} 4 { target ilp32 } } } */ /* { dg-final { scan-assembler-times {\mvperm\M} 4 { target ilp32 } } } */ -/* { dg-final { scan-assembler-times {\mxxperm\M} 0 { target ilp32 } } } */ +/* { dg-final { scan-assembler-times {\mxxperm\M} 8 { target ilp32 } } } */ /* { dg-final { scan-assembler-times {\mlxv\M|\mlvx\M} 8 { target ilp32 } } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/pr79251-run.p7.c b/gcc/testsuite/gcc.target/powerpc/pr79251-run.p7.c new file mode 100644 index 0000000..5e29b19 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr79251-run.p7.c @@ -0,0 +1,15 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vsx_hw } */ +/* { dg-options "-O2 -mvsx -mdejagnu-cpu=power7" } */ + +#include +#include +#include "pr79251.h" + +int +main (void) +{ + TEST_VEC_INSERT_ALL (run_test) + return 0; +} + diff --git a/gcc/testsuite/gcc.target/powerpc/pr79251.p7.c b/gcc/testsuite/gcc.target/powerpc/pr79251.p7.c new file mode 100644 index 0000000..25e227a --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr79251.p7.c @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target powerpc_vsx_ok } */ +/* { dg-options "-O2 -mdejagnu-cpu=power7 -mvsx" } */ + +#include +#include +#include "pr79251.h" + +/* { dg-final { scan-assembler-not {\mstxw\M} } } */ +/* { dg-final { scan-assembler-times {\mlvsl\M} 10 { target lp64 } } } */ +/* { dg-final { scan-assembler-times {\mlvsr\M} 3 { target lp64 } } } */ +/* { dg-final { scan-assembler-times {\mvperm\M} 20 { target lp64 } } } */ +/* { dg-final { scan-assembler-times {\mxxpermdi\M} 10 { target lp64 } } } */ +/* { dg-final { scan-assembler-times {\mxxsel\M} 7 { target lp64 } } } */ + +/* { dg-final { scan-assembler-times {\mrlwinm\M} 10 { target ilp32 } } } */ +/* { dg-final { scan-assembler-times {\mstxvw4x\M} 0 { target ilp32 } } } */ +/* { dg-final { scan-assembler-times {\mstxvd2x\M} 0 { target ilp32 } } } */ +/* { dg-final { scan-assembler-times {\mstb\M|\msth\M|\mstw\M|\mstfs\M|\mstfd\M} 19 { target ilp32 } } } */ +/* { dg-final { scan-assembler-times {\mlxvw4x\M} 0 { target ilp32 } } } */ +/* { dg-final { scan-assembler-times {\mlxvd2x\M} 7 { target ilp32 } } } */ + + diff --git a/gcc/testsuite/gcc.target/powerpc/pr79251.p8.c b/gcc/testsuite/gcc.target/powerpc/pr79251.p8.c index 178e02f..4fc3ea0 100644 --- a/gcc/testsuite/gcc.target/powerpc/pr79251.p8.c +++ b/gcc/testsuite/gcc.target/powerpc/pr79251.p8.c @@ -14,9 +14,9 @@ /* { dg-final { scan-assembler-times {\mxxsel\M} 7 { target lp64 } } } */ /* { dg-final { scan-assembler-times {\mrlwinm\M} 10 { target ilp32 } } } */ -/* { dg-final { scan-assembler-times {\mstxvw4x\M} 6 { target ilp32 } } } */ -/* { dg-final { scan-assembler-times {\mstxvd2x\M} 4 { target ilp32 } } } */ -/* { dg-final { scan-assembler-times {\mstb\M|\msth\M|\mstw\M|\mstfs\M|\mstfd\M} 12 { target ilp32 } } } */ -/* { dg-final { scan-assembler-times {\mlxvw4x\M} 6 { target ilp32 } } } */ -/* { dg-final { scan-assembler-times {\mlxvd2x\M} 4 { target ilp32 } } } */ +/* { dg-final { scan-assembler-times {\mstxvw4x\M} 0 { target ilp32 } } } */ +/* { dg-final { scan-assembler-times {\mstxvd2x\M} 0 { target ilp32 } } } */ +/* { dg-final { scan-assembler-times {\mstb\M|\msth\M|\mstw\M|\mstfs\M|\mstfd\M} 1 { target ilp32 } } } */ +/* { dg-final { scan-assembler-times {\mlxvw4x\M} 0 { target ilp32 } } } */ +/* { dg-final { scan-assembler-times {\mlxvd2x\M} 7 { target ilp32 } } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/pr79251.p9.c b/gcc/testsuite/gcc.target/powerpc/pr79251.p9.c index 2ae2da8..9312aa6 100644 --- a/gcc/testsuite/gcc.target/powerpc/pr79251.p9.c +++ b/gcc/testsuite/gcc.target/powerpc/pr79251.p9.c @@ -16,7 +16,7 @@ /* { dg-final { scan-assembler-times {\mxxpermdi\M} 3 { target lp64 } } } */ /* { dg-final { scan-assembler-times {\mrlwinm\M} 10 { target ilp32 } } } */ -/* { dg-final { scan-assembler-times {\mstxv\M} 10 { target ilp32 } } } */ -/* { dg-final { scan-assembler-times {\mstb\M|\msth\M|\mstw\M|\mstfs\M|\mstfd\M} 12 { target ilp32 } } } */ -/* { dg-final { scan-assembler-times {\mlxv\M} 10 { target ilp32 } } } */ +/* { dg-final { scan-assembler-times {\mstxv\M} 0 { target ilp32 } } } */ +/* { dg-final { scan-assembler-times {\mstb\M|\msth\M|\mstw\M|\mstfs\M|\mstfd\M} 1 { target ilp32 } } } */ +/* { dg-final { scan-assembler-times {\mlxv\M} 7 { target ilp32 } } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-7.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-7.c index 0780b01..8841660 100644 --- a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-7.c +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-7.c @@ -191,10 +191,11 @@ vector unsigned __int128 splat_uint128 (unsigned __int128 x) { return vec_splats */ /* { dg-final { scan-assembler-times {\mrldic\M} 0 { target { be && ilp32 } } } } */ -/* { dg-final { scan-assembler-times {\mrldic\M} 64 { target { be && lp64 } } } } */ -/* { dg-final { scan-assembler-times {\mrldic\M} 64 { target le } } } */ -/* { dg-final { scan-assembler-times "xxpermdi" 4 { target be } } } */ -/* { dg-final { scan-assembler-times "xxpermdi" 6 { target le } } } */ +/* { dg-final { scan-assembler-times {\mrldic\M} 65 { target { be && lp64 } } } } */ +/* { dg-final { scan-assembler-times {\mrldic\M} 65 { target le } } } */ +/* { dg-final { scan-assembler-times "xxpermdi" 33 { target be } } } */ +/* { dg-final { scan-assembler-times "xxpermdi" 35 { target le } } } */ /* { dg-final { scan-assembler-times "vspltisb" 2 } } */ /* { dg-final { scan-assembler-times "vspltish" 2 } } */ -/* { dg-final { scan-assembler-times "vspltisw" 2 } } */ +/* { dg-final { scan-assembler-times "vspltisw" 2 { target be } } } */ +/* { dg-final { scan-assembler-times "vspltisw" 23 { target le } } } */ -- cgit v1.1 From 19199a6f2b0f4ce4b100856c78706d56a16b1956 Mon Sep 17 00:00:00 2001 From: Kyrylo Tkachov Date: Tue, 30 Mar 2021 15:43:36 +0100 Subject: aarch64: PR target/99822 Don't allow zero register in first operand of SUBS/ADDS-immediate In this PR we end up generating an invalid instruction: adds x1,xzr,#2 because the pattern accepts zero as an operand in the comparison, but the instruction doesn't. Fix it by adjusting the predicate and constraints. gcc/ChangeLog: PR target/99822 * config/aarch64/aarch64.md (sub3_compare1_imm): Do not allow zero in operand 1. gcc/testsuite/ChangeLog: PR target/99822 * gcc.c-torture/compile/pr99822.c: New test. --- gcc/testsuite/gcc.c-torture/compile/pr99822.c | 41 +++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr99822.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.c-torture/compile/pr99822.c b/gcc/testsuite/gcc.c-torture/compile/pr99822.c new file mode 100644 index 0000000..0660784 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr99822.c @@ -0,0 +1,41 @@ +/* PR target/99822 */ +/* { dg-do assemble } */ +/* { dg-require-effective-target int128 } */ + +int zt, bm, p5 = 1; + +void __attribute__ ((cold)) +l2 (unsigned long int hz) +{ + __int128 d9 = 0; + unsigned long int *mg = hz ? &hz : (unsigned long int *) &d9; + + while (d9 < 1) + { + bm = bm > d9; + bm = bm == (d9 = bm || hz); + + hz = 0x197000000; + d9 = hz * hz; + + while (p5 < 1) + { + bm = ((hz = 3) ? zt : 0) > 0x1001; + if (bm != 0) + { + __int128 *nd = (__int128 *) bm; + + *nd /= 3; + } + + *mg = 0x1001; + p5 -= *mg; + } + + for (zt = 0; zt >= 0; zt += 2) + d9 = 0; + + d9 += 2; + } +} + -- cgit v1.1 From 953624089be3f51c2ebacba65be8521bf6ae8430 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Mar 2021 18:15:32 +0200 Subject: c++: Fix ICE on PTRMEM_CST in lambda in inline var initializer [PR99790] The following testcase ICEs (since the addition of inline var support), because the lambda contains PTRMEM_CST but finish_function is called for the lambda quite early during parsing it (from finish_lambda_function) when the containing class is still incomplete. That means that during genericization cplus_expand_constant keeps the PTRMEM_CST unmodified, but later nothing lowers it when the class is finalized. Using sizeof etc. on the class in such contexts is rejected by both g++ and clang++, and when the PTRMEM_CST appears e.g. in static var initializers rather than in functions, we handle it correctly because c_parse_final_cleanups -> lower_var_init will handle those cplus_expand_constant when all classes are already finalized. The following patch fixes it by calling cplus_expand_constant again during gimplification, as we are now unconditionally unit at a time, I'd think everything that could be completed will be before we start gimplification. 2021-03-30 Jakub Jelinek PR c++/99790 * cp-gimplify.c (cp_gimplify_expr): Handle PTRMEM_CST. * g++.dg/cpp1z/pr99790.C: New test. --- gcc/testsuite/g++.dg/cpp1z/pr99790.C | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1z/pr99790.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp1z/pr99790.C b/gcc/testsuite/g++.dg/cpp1z/pr99790.C new file mode 100644 index 0000000..99961f5 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/pr99790.C @@ -0,0 +1,9 @@ +// PR c++/99790 +// { dg-do compile { target c++17 } } + +struct A; +struct B { void (*fn) (A *); }; +template +int foo (const T &); +struct A { int a; static constexpr B b{[] (A *n) { n->*&A::a = 2; }}; }; +int a = foo (A::b); -- cgit v1.1 From 5f3c6027257118469a722816e228394b5978ddb0 Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Tue, 30 Mar 2021 09:45:59 -0700 Subject: c++: duplicate const static members [PR 99283] This is the bug that keeps on giving. Reducing it has been successful at hitting other defects. In this case, some more specialization hash table fun, plus an issue with reading in a definition of a duplicated declaration. At least I discovered a null context check is no longer needed. PR c++/99283 gcc/cp/ * module.cc (dumper::operator): Make less brittle. (trees_out::core_bools): VAR_DECLs always have a context. (trees_out::key_mergeable): Use same_type_p for asserting. (trees_in::read_var_def): Propagate DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P. gcc/testsuite/ * g++.dg/modules/pr99283-5.h: New. * g++.dg/modules/pr99283-5_a.H: New. * g++.dg/modules/pr99283-5_b.H: New. * g++.dg/modules/pr99283-5_c.C: New. --- gcc/testsuite/g++.dg/modules/pr99283-5.h | 9 +++++++++ gcc/testsuite/g++.dg/modules/pr99283-5_a.H | 14 ++++++++++++++ gcc/testsuite/g++.dg/modules/pr99283-5_b.H | 12 ++++++++++++ gcc/testsuite/g++.dg/modules/pr99283-5_c.C | 5 +++++ 4 files changed, 40 insertions(+) create mode 100644 gcc/testsuite/g++.dg/modules/pr99283-5.h create mode 100644 gcc/testsuite/g++.dg/modules/pr99283-5_a.H create mode 100644 gcc/testsuite/g++.dg/modules/pr99283-5_b.H create mode 100644 gcc/testsuite/g++.dg/modules/pr99283-5_c.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/modules/pr99283-5.h b/gcc/testsuite/g++.dg/modules/pr99283-5.h new file mode 100644 index 0000000..3c3421f --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr99283-5.h @@ -0,0 +1,9 @@ +template +struct __traits +{ + static const int __digits = 8; + static const _Value __min = 0; +}; + +template +const _Value __traits<_Value>::__min; diff --git a/gcc/testsuite/g++.dg/modules/pr99283-5_a.H b/gcc/testsuite/g++.dg/modules/pr99283-5_a.H new file mode 100644 index 0000000..6406dfe --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr99283-5_a.H @@ -0,0 +1,14 @@ +// PR 99283 part 5 +// { dg-additional-options -fmodule-header } +// { dg-module-cmi {} } + +#include "pr99283-5.h" + +template +const int __traits<_Value>::__digits; + +template +void Foo () +{ + __traits::__digits; +} diff --git a/gcc/testsuite/g++.dg/modules/pr99283-5_b.H b/gcc/testsuite/g++.dg/modules/pr99283-5_b.H new file mode 100644 index 0000000..3f4237e --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr99283-5_b.H @@ -0,0 +1,12 @@ +// { dg-additional-options {-fmodule-header -fno-module-lazy} } +// { dg-module-cmi {} } + +#include "pr99283-5.h" + +template +void Bar () +{ + __traits::__min; +} + +import "pr99283-5_a.H"; diff --git a/gcc/testsuite/g++.dg/modules/pr99283-5_c.C b/gcc/testsuite/g++.dg/modules/pr99283-5_c.C new file mode 100644 index 0000000..cc7e795 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr99283-5_c.C @@ -0,0 +1,5 @@ +// { dg-additional-options {-fmodules-ts -fno-module-lazy} } + +import "pr99283-5_b.H"; + +static_assert(!__traits::__min); -- cgit v1.1 From a01f5fd71031bb34fd9d2792e6ec42d982c68a8e Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Wed, 24 Mar 2021 21:08:04 -0400 Subject: analyzer testsuite: fix typo gcc/testsuite/ChangeLog: * gcc.dg/analyzer/symbolic-1.c: Fix typo. --- gcc/testsuite/gcc.dg/analyzer/symbolic-1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/analyzer/symbolic-1.c b/gcc/testsuite/gcc.dg/analyzer/symbolic-1.c index 9d228e6..feab9ce 100644 --- a/gcc/testsuite/gcc.dg/analyzer/symbolic-1.c +++ b/gcc/testsuite/gcc.dg/analyzer/symbolic-1.c @@ -1,6 +1,6 @@ #include "analyzer-decls.h" -/* The example from store2.h */ +/* The example from store.h */ void test_1 (char a, char b, char c, char d, char e, char f, int i, int j) -- cgit v1.1 From 08d2edae5d84209c0dcf327a13d4f6b4eacdb1ac Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 31 Mar 2021 00:16:31 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 72 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 570f2a7..b12e442 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,75 @@ +2021-03-30 David Malcolm + + * gcc.dg/analyzer/symbolic-1.c: Fix typo. + +2021-03-30 Nathan Sidwell + + PR c++/99283 + * g++.dg/modules/pr99283-5.h: New. + * g++.dg/modules/pr99283-5_a.H: New. + * g++.dg/modules/pr99283-5_b.H: New. + * g++.dg/modules/pr99283-5_c.C: New. + +2021-03-30 Jakub Jelinek + + PR c++/99790 + * g++.dg/cpp1z/pr99790.C: New test. + +2021-03-30 Kyrylo Tkachov + + PR target/99822 + * gcc.c-torture/compile/pr99822.c: New test. + +2021-03-30 Xionghu Luo + + PR target/99718 + PR target/99718 + * gcc.target/powerpc/fold-vec-insert-char-p8.c: Update + instruction counts. + * gcc.target/powerpc/fold-vec-insert-char-p9.c: Likewise. + * gcc.target/powerpc/fold-vec-insert-double.c: Likewise. + * gcc.target/powerpc/fold-vec-insert-float-p8.c: Likewise. + * gcc.target/powerpc/fold-vec-insert-float-p9.c: Likewise. + * gcc.target/powerpc/fold-vec-insert-int-p8.c: Likewise. + * gcc.target/powerpc/fold-vec-insert-int-p9.c: Likewise. + * gcc.target/powerpc/fold-vec-insert-longlong.c: Likewise. + * gcc.target/powerpc/fold-vec-insert-short-p8.c: Likewise. + * gcc.target/powerpc/fold-vec-insert-short-p9.c: Likewise. + * gcc.target/powerpc/pr79251.p8.c: Likewise. + * gcc.target/powerpc/pr79251.p9.c: Likewise. + * gcc.target/powerpc/vsx-builtin-7.c: Likewise. + * gcc.target/powerpc/pr79251-run.p7.c: New test. + * gcc.target/powerpc/pr79251.p7.c: New test. + +2021-03-30 H.J. Lu + + PR target/99744 + * gcc.target/i386/pr99744-1.c: New test. + +2021-03-30 Tamar Christina + + PR tree-optimization/99825 + * gfortran.dg/vect/pr99825.f90: New test. + +2021-03-30 Kyrylo Tkachov + + PR target/99808 + * gcc.target/aarch64/pr99808.c: Use ULL constant suffix. + +2021-03-30 Richard Biener + + PR tree-optimization/99824 + * gcc.dg/torture/pr99824.c: New testcase. + +2021-03-30 Richard Sandiford + + PR target/98136 + * g++.dg/pr98136.C: New test. + +2021-03-30 Mihailo Stojanovic + + * gcc.target/aarch64/fcvt_nosimd.c: New test. + 2021-03-29 Martin Sebor PR tree-optimization/61869 -- cgit v1.1 From 0bbf0edbfc782f8e4e416d5fbd1b52a515adb585 Mon Sep 17 00:00:00 2001 From: Patrick Palka Date: Tue, 30 Mar 2021 22:54:37 -0400 Subject: c++: placeholder type constraint and argument pack [PR99815] When checking dependence of a placeholder type constraint, if the first template argument of the constraint is an argument pack, we need to expand it in order to properly separate the implicit 'auto' argument from the rest. gcc/cp/ChangeLog: PR c++/99815 * pt.c (placeholder_type_constraint_dependent_p): Expand argument packs to separate the first non-pack argument from the rest. gcc/testsuite/ChangeLog: PR c++/99815 * g++.dg/cpp2a/concepts-placeholder5.C: New test. --- gcc/testsuite/g++.dg/cpp2a/concepts-placeholder5.C | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp2a/concepts-placeholder5.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-placeholder5.C b/gcc/testsuite/g++.dg/cpp2a/concepts-placeholder5.C new file mode 100644 index 0000000..eaea41a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/concepts-placeholder5.C @@ -0,0 +1,32 @@ +// PR c++/99815 +// { dg-do compile { target c++20 } } + +template +struct is_same { static constexpr bool value = false; }; + +template +struct is_same { static constexpr bool value = true; }; + +template +concept C = is_same::value; // { dg-error "wrong number" } + +template void f() { + C auto x = 0; // { dg-error "constraints" } +} + +template void f(); // { dg-bogus "" } +template void f(); // { dg-message "required from here" } +template void f<>(); // { dg-message "required from here" } +template void f(); // { dg-message "required from here" } + +template void g() { + C auto x = 0; // { dg-error "constraints" } +} + +template void g<>(); // { dg-bogus "" } +template void g(); // { dg-message "required from here" } + +template void h() { + C auto x = 0; // { dg-error "constraints" } + C auto y = 0; +} -- cgit v1.1 From a3bf6ce7f2e17f2c977c13df23eb718e7b433dcd Mon Sep 17 00:00:00 2001 From: Patrick Palka Date: Tue, 30 Mar 2021 22:57:11 -0400 Subject: c++: Adjust mangling of __alignof__ [PR88115] r11-4926 made __alignof__ get mangled differently from alignof, encoding __alignof__ as a vendor extended operator. But this mangling is problematic for the reasons mentioned in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88115#c6. This patch changes our mangling of __alignof__ to instead use the new "vendor extended expression" syntax that's proposed in https://github.com/itanium-cxx-abi/cxx-abi/issues/112. Clang does the same thing already, so after this patch Clang and GCC agree about the mangling of __alignof__(type) and __alignof__(expr). gcc/cp/ChangeLog: PR c++/88115 * mangle.c (write_expression): Adjust the mangling of __alignof__. include/ChangeLog: PR c++/88115 * demangle.h (enum demangle_component_type): Add DEMANGLE_COMPONENT_VENDOR_EXPR. libiberty/ChangeLog: PR c++/88115 * cp-demangle.c (d_dump, d_make_comp, d_expression_1) (d_count_templates_scopes): Handle DEMANGLE_COMPONENT_VENDOR_EXPR. (d_print_comp_inner): Likewise. : Revert r11-4926 change. : Likewise. * testsuite/demangle-expected: Adjust __alignof__ tests. gcc/testsuite/ChangeLog: PR c++/88115 * g++.dg/cpp0x/alignof7.C: Adjust expected mangling. --- gcc/testsuite/g++.dg/cpp0x/alignof7.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp0x/alignof7.C b/gcc/testsuite/g++.dg/cpp0x/alignof7.C index a4d7f24..2369b87 100644 --- a/gcc/testsuite/g++.dg/cpp0x/alignof7.C +++ b/gcc/testsuite/g++.dg/cpp0x/alignof7.C @@ -18,5 +18,5 @@ template void f4(std::size_t); // { dg-final { scan-assembler "_Z2f1IiEvDTatT_E" } } // { dg-final { scan-assembler "_Z2f2IiEvDTaztlT_EE" } } -// { dg-final { scan-assembler "_Z2f3IiEvDTv111__alignof__T_E" } } -// { dg-final { scan-assembler "_Z2f4IiEvDTv111__alignof__tlT_EE" } } +// { dg-final { scan-assembler "_Z2f3IiEvDTu11__alignof__T_EE" } } +// { dg-final { scan-assembler "_Z2f4IiEvDTu11__alignof__XtlT_EEEE" } } -- cgit v1.1 From 0989e99470c2a6797bacf6d04888bc9a46a632a8 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 31 Mar 2021 08:55:38 +0200 Subject: testsuite: Disable zero-scratch-regs-{8, 9, 10, 11}.c on all but ... [PR97680] Seems the target hook is only defined on config/i386/i386.c:#undef TARGET_ZERO_CALL_USED_REGS config/i386/i386.c:#define TARGET_ZERO_CALL_USED_REGS ix86_zero_call_used_regs config/sparc/sparc.c:#undef TARGET_ZERO_CALL_USED_REGS config/sparc/sparc.c:#define TARGET_ZERO_CALL_USED_REGS sparc_zero_call_used_regs but apparently many of the tests actually succeed on various targets that don't define those hooks. E.g. I haven't seen them to fail on aarch64, on arm only the -10.c fails, on powerpc*/s390* all {8,9,10,11} fail (plus 5 is skipped on power*-aix*). On ia64 according to testresults {6,7,8,9,10,11} fail, some with ICEs. On mipsel according to testresults {9,10,11} fail, some with ICEs. On nvptx at least 1-9 succeed, 10-11 don't know, don't have assert.h around. I've kept {5,6,7} with aix,ia64,ia64 skipped because those seems like outliers, it works pretty much everywhere but on those. The rest have known good targets. 2021-03-31 Jakub Jelinek PR testsuite/97680 * c-c++-common/zero-scratch-regs-6.c: Skip on ia64. * c-c++-common/zero-scratch-regs-7.c: Likewise. * c-c++-common/zero-scratch-regs-8.c: Change from dg-skip-if of selected unsupported triplets to all targets but selected triplets of supported targets. * c-c++-common/zero-scratch-regs-9.c: Likewise. * c-c++-common/zero-scratch-regs-10.c: Likewise. * c-c++-common/zero-scratch-regs-11.c: Likewise. --- gcc/testsuite/c-c++-common/zero-scratch-regs-10.c | 3 +-- gcc/testsuite/c-c++-common/zero-scratch-regs-11.c | 2 +- gcc/testsuite/c-c++-common/zero-scratch-regs-6.c | 1 + gcc/testsuite/c-c++-common/zero-scratch-regs-7.c | 1 + gcc/testsuite/c-c++-common/zero-scratch-regs-8.c | 2 +- gcc/testsuite/c-c++-common/zero-scratch-regs-9.c | 2 +- 6 files changed, 6 insertions(+), 5 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/c-c++-common/zero-scratch-regs-10.c b/gcc/testsuite/c-c++-common/zero-scratch-regs-10.c index f393a3b..ab17143 100644 --- a/gcc/testsuite/c-c++-common/zero-scratch-regs-10.c +++ b/gcc/testsuite/c-c++-common/zero-scratch-regs-10.c @@ -1,6 +1,5 @@ /* { dg-do run } */ -/* { dg-skip-if "not implemented" { powerpc*-*-* } } */ -/* { dg-skip-if "not implemented" { arm*-*-* } } */ +/* { dg-skip-if "not implemented" { ! { i?86*-*-* x86_64*-*-* sparc*-*-* aarch64*-*-* nvptx*-*-* } } } */ /* { dg-options "-O2" } */ #include diff --git a/gcc/testsuite/c-c++-common/zero-scratch-regs-11.c b/gcc/testsuite/c-c++-common/zero-scratch-regs-11.c index b04b6a2..6642a37 100644 --- a/gcc/testsuite/c-c++-common/zero-scratch-regs-11.c +++ b/gcc/testsuite/c-c++-common/zero-scratch-regs-11.c @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-skip-if "not implemented" { powerpc*-*-* } } */ +/* { dg-skip-if "not implemented" { ! { i?86*-*-* x86_64*-*-* sparc*-*-* aarch64*-*-* arm*-*-* nvptx*-*-* } } } */ /* { dg-options "-O2 -fzero-call-used-regs=all" } */ #include "zero-scratch-regs-10.c" diff --git a/gcc/testsuite/c-c++-common/zero-scratch-regs-6.c b/gcc/testsuite/c-c++-common/zero-scratch-regs-6.c index 80f5bbb..b038a25 100644 --- a/gcc/testsuite/c-c++-common/zero-scratch-regs-6.c +++ b/gcc/testsuite/c-c++-common/zero-scratch-regs-6.c @@ -1,4 +1,5 @@ /* { dg-do run } */ +/* { dg-skip-if "not implemented" { ia64*-*-* } } */ /* { dg-options "-O2 -fzero-call-used-regs=all-gpr-arg" } */ #include "zero-scratch-regs-1.c" diff --git a/gcc/testsuite/c-c++-common/zero-scratch-regs-7.c b/gcc/testsuite/c-c++-common/zero-scratch-regs-7.c index 159f35c..2a4c8b2 100644 --- a/gcc/testsuite/c-c++-common/zero-scratch-regs-7.c +++ b/gcc/testsuite/c-c++-common/zero-scratch-regs-7.c @@ -1,4 +1,5 @@ /* { dg-do run } */ +/* { dg-skip-if "not implemented" { ia64*-*-* } } */ /* { dg-options "-O2 -fzero-call-used-regs=all-gpr" } */ #include "zero-scratch-regs-1.c" diff --git a/gcc/testsuite/c-c++-common/zero-scratch-regs-8.c b/gcc/testsuite/c-c++-common/zero-scratch-regs-8.c index f612a04..867c6bd 100644 --- a/gcc/testsuite/c-c++-common/zero-scratch-regs-8.c +++ b/gcc/testsuite/c-c++-common/zero-scratch-regs-8.c @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-skip-if "not implemented" { powerpc*-*-* } } */ +/* { dg-skip-if "not implemented" { ! { i?86*-*-* x86_64*-*-* sparc*-*-* aarch64*-*-* arm*-*-* nvptx*-*-* } } } */ /* { dg-options "-O2 -fzero-call-used-regs=all-arg" } */ #include "zero-scratch-regs-1.c" diff --git a/gcc/testsuite/c-c++-common/zero-scratch-regs-9.c b/gcc/testsuite/c-c++-common/zero-scratch-regs-9.c index 2c63a69..4b45d70 100644 --- a/gcc/testsuite/c-c++-common/zero-scratch-regs-9.c +++ b/gcc/testsuite/c-c++-common/zero-scratch-regs-9.c @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-skip-if "not implemented" { powerpc*-*-* } } */ +/* { dg-skip-if "not implemented" { ! { i?86*-*-* x86_64*-*-* sparc*-*-* aarch64*-*-* arm*-*-* nvptx*-*-* } } } */ /* { dg-options "-O2 -fzero-call-used-regs=all" } */ #include "zero-scratch-regs-1.c" -- cgit v1.1 From c001c194a2f73fb32461b597e91a35f9bbcf4414 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 31 Mar 2021 10:46:01 +0200 Subject: aarch64: Fix up *add3_poly_1 [PR99813] As mentioned in the PR, Uai constraint stands for aarch64_sve_scalar_inc_dec_immediate while Uav for aarch64_sve_addvl_addpl_immediate. Both *add3_aarch64 and *add3_poly_1 patterns use * return aarch64_output_sve_scalar_inc_dec (operands[2]); * return aarch64_output_sve_addvl_addpl (operands[2]); in that order, but the former with Uai,Uav order, while the latter with Uav,Uai instead. This patch swaps the constraints so that they match the output. Co-authored-by: Richard Sandiford 2021-03-31 Jakub Jelinek Richard Sandiford PR target/99813 * config/aarch64/aarch64.md (*add3_poly_1): Swap Uai and Uav constraints on operands[2] and similarly 0 and rk constraints on operands[1] corresponding to that. * g++.target/aarch64/sve/pr99813.C: New test. --- gcc/testsuite/g++.target/aarch64/sve/pr99813.C | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 gcc/testsuite/g++.target/aarch64/sve/pr99813.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.target/aarch64/sve/pr99813.C b/gcc/testsuite/g++.target/aarch64/sve/pr99813.C new file mode 100644 index 0000000..f98b17c --- /dev/null +++ b/gcc/testsuite/g++.target/aarch64/sve/pr99813.C @@ -0,0 +1,27 @@ +// PR target/99813 +/* { dg-do assemble { target aarch64_asm_sve_ok } } */ +/* { dg-options "-O3 -march=armv8.2-a+sve -fvect-cost-model=unlimited -fno-tree-dominator-opts -mtune=cortex-a72" } */ + +long a, b; +bool c[2][14][2][16], f[2][14][2][16]; +bool d; +char e[2][4][2][6]; +void g() { + a = 0; + for (int h = 0; h < 2; ++h) + for (int i = 0; i < 14; ++i) + for (int j = 0; j < 2; ++j) + for (int k = 0; k < 16; ++k) + c[h][i][j][k] = 0; + d = 0; + for (int h; h < 2; ++h) + for (int i = 0; i < 4; ++i) + for (int j = 0; j < 2; ++j) + for (int k = 0; k < 6; ++k) + e[h][i][j][k] = 6; + for (int h = 0; h < 2; ++h) + for (int i = 0; i < 14; ++i) + for (int j = 0; j < 2; ++j) + for (int k = 0; k < 16; ++k) + f[h][i][j][k] = b = 9; +} -- cgit v1.1 From 1393938e4c7dab9306cdce5a73d93b242fc246ec Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Wed, 31 Mar 2021 11:26:06 +0100 Subject: aarch64: Fix target alignment for SVE [PR98119] The vectoriser supports peeling for alignment using predication: we move back to the previous aligned boundary and make the skipped elements inactive in the first loop iteration. As it happens, the costs for existing CPUs give an equal cost to aligned and unaligned accesses, so this feature is rarely used. However, the PR shows that when the feature was forced on, we were still trying to align to a full-vector boundary even when using partial vectors. gcc/ PR target/98119 * config/aarch64/aarch64.c (aarch64_vectorize_preferred_vector_alignment): Query the size of the provided SVE vector; do not assume that all SVE vectors have the same size. gcc/testsuite/ PR target/98119 * gcc.target/aarch64/sve/pr98119.c: New test. --- gcc/testsuite/gcc.target/aarch64/sve/pr98119.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/pr98119.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr98119.c b/gcc/testsuite/gcc.target/aarch64/sve/pr98119.c new file mode 100644 index 0000000..da6208c --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/pr98119.c @@ -0,0 +1,13 @@ +/* { dg-options "-O3 -msve-vector-bits=512 -mtune=thunderx" } */ + +void +f (unsigned short *x) +{ + for (int i = 0; i < 1000; ++i) + x[i] += x[i - 16]; +} + +/* { dg-final { scan-assembler-not {\tubfx\t[wx][0-9]+, [wx][0-9]+, #?1, #?5\n} } } */ +/* { dg-final { scan-assembler-not {\tand\tx[0-9]+, x[0-9]+, #?-63\n} } } */ +/* { dg-final { scan-assembler {\tubfx\t[wx][0-9]+, [wx][0-9]+, #?1, #?4\n} } } */ +/* { dg-final { scan-assembler {\tand\tx[0-9]+, x[0-9]+, #?-31\n} } } */ -- cgit v1.1 From bf24f4ec73b65454ea0edcd6ab5616f04958d41e Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Thu, 21 Jan 2021 18:51:35 -0800 Subject: x86: Update memcpy/memset inline strategies for Ice Lake Simply memcpy and memset inline strategies to avoid branches for -mtune=icelake: 1. With MOVE_RATIO and CLEAR_RATIO == 17, GCC will use integer/vector load and store for up to 16 * 16 (256) bytes when the data size is fixed and known. 2. Inline only if data size is known to be <= 256. a. Use "rep movsb/stosb" with simple code sequence if the data size is a constant. b. Use loop if data size is not a constant. 3. Use memcpy/memset libray function if data size is unknown or > 256. On Ice Lake processor with -march=native -Ofast -flto, 1. Performance impacts of SPEC CPU 2017 rate are: 500.perlbench_r -0.93% 502.gcc_r 0.36% 505.mcf_r 0.31% 520.omnetpp_r -0.07% 523.xalancbmk_r -0.53% 525.x264_r -0.09% 531.deepsjeng_r -0.19% 541.leela_r 0.16% 548.exchange2_r 0.22% 557.xz_r -1.64% Geomean -0.24% 503.bwaves_r -0.01% 507.cactuBSSN_r 0.00% 508.namd_r 0.12% 510.parest_r 0.07% 511.povray_r 0.29% 519.lbm_r 0.00% 521.wrf_r -0.38% 526.blender_r 0.16% 527.cam4_r 0.18% 538.imagick_r 0.76% 544.nab_r -0.84% 549.fotonik3d_r -0.07% 554.roms_r -0.01% Geomean 0.02% 2. Significant impacts on eembc benchmarks are: eembc/nnet_test 9.90% eembc/mp2decoddata2 16.42% eembc/textv2data3 -4.86% eembc/qos 12.90% gcc/ * config/i386/i386-expand.c (expand_set_or_cpymem_via_rep): For TARGET_PREFER_KNOWN_REP_MOVSB_STOSB, don't convert QImode to SImode. (decide_alg): For TARGET_PREFER_KNOWN_REP_MOVSB_STOSB, use "rep movsb/stosb" only for known sizes. * config/i386/i386-options.c (processor_cost_table): Use Ice Lake cost for Cannon Lake, Ice Lake, Tiger Lake, Sapphire Rapids and Alder Lake. * config/i386/i386.h (TARGET_PREFER_KNOWN_REP_MOVSB_STOSB): New. * config/i386/x86-tune-costs.h (icelake_memcpy): New. (icelake_memset): Likewise. (icelake_cost): Likewise. * config/i386/x86-tune.def (X86_TUNE_PREFER_KNOWN_REP_MOVSB_STOSB): New. gcc/testsuite/ * gcc.target/i386/memcpy-strategy-5.c: New test. * gcc.target/i386/memcpy-strategy-6.c: Likewise. * gcc.target/i386/memcpy-strategy-7.c: Likewise. * gcc.target/i386/memcpy-strategy-8.c: Likewise. * gcc.target/i386/memset-strategy-3.c: Likewise. * gcc.target/i386/memset-strategy-4.c: Likewise. * gcc.target/i386/memset-strategy-5.c: Likewise. * gcc.target/i386/memset-strategy-6.c: Likewise. --- gcc/testsuite/gcc.target/i386/memcpy-strategy-5.c | 11 +++++++++++ gcc/testsuite/gcc.target/i386/memcpy-strategy-6.c | 18 ++++++++++++++++++ gcc/testsuite/gcc.target/i386/memcpy-strategy-7.c | 9 +++++++++ gcc/testsuite/gcc.target/i386/memcpy-strategy-8.c | 18 ++++++++++++++++++ gcc/testsuite/gcc.target/i386/memset-strategy-3.c | 17 +++++++++++++++++ gcc/testsuite/gcc.target/i386/memset-strategy-4.c | 17 +++++++++++++++++ gcc/testsuite/gcc.target/i386/memset-strategy-5.c | 11 +++++++++++ gcc/testsuite/gcc.target/i386/memset-strategy-6.c | 9 +++++++++ 8 files changed, 110 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/memcpy-strategy-5.c create mode 100644 gcc/testsuite/gcc.target/i386/memcpy-strategy-6.c create mode 100644 gcc/testsuite/gcc.target/i386/memcpy-strategy-7.c create mode 100644 gcc/testsuite/gcc.target/i386/memcpy-strategy-8.c create mode 100644 gcc/testsuite/gcc.target/i386/memset-strategy-3.c create mode 100644 gcc/testsuite/gcc.target/i386/memset-strategy-4.c create mode 100644 gcc/testsuite/gcc.target/i386/memset-strategy-5.c create mode 100644 gcc/testsuite/gcc.target/i386/memset-strategy-6.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/i386/memcpy-strategy-5.c b/gcc/testsuite/gcc.target/i386/memcpy-strategy-5.c new file mode 100644 index 0000000..83c333b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/memcpy-strategy-5.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -march=tigerlake -mno-sse" } */ +/* { dg-final { scan-assembler "jmp\tmemcpy" { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler "call\tmemcpy" { target ia32 } } } */ +/* { dg-final { scan-assembler-not "rep movsb" } } */ + +void +foo (char *dest, char *src) +{ + __builtin_memcpy (dest, src, 257); +} diff --git a/gcc/testsuite/gcc.target/i386/memcpy-strategy-6.c b/gcc/testsuite/gcc.target/i386/memcpy-strategy-6.c new file mode 100644 index 0000000..ed963de --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/memcpy-strategy-6.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mtune=generic" } */ +/* { dg-final { scan-assembler-not "jmp\tmemcpy" { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-not "call\tmemcpy" { target ia32 } } } */ +/* { dg-final { scan-assembler-not "rep movsb" } } */ + +typedef unsigned char e_u8; + +#define MAXBC 8 + +void MixColumn(e_u8 a[4][MAXBC], e_u8 BC) +{ + e_u8 b[4][MAXBC]; + int i, j; + + for(i = 0; i < 4; i++) + for(j = 0; j < BC; j++) a[i][j] = b[i][j]; +} diff --git a/gcc/testsuite/gcc.target/i386/memcpy-strategy-7.c b/gcc/testsuite/gcc.target/i386/memcpy-strategy-7.c new file mode 100644 index 0000000..be66d6b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/memcpy-strategy-7.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -march=tigerlake -mno-sse" } */ +/* { dg-final { scan-assembler "rep movsb" } } */ + +void +foo (char *dest, char *src) +{ + __builtin_memcpy (dest, src, 256); +} diff --git a/gcc/testsuite/gcc.target/i386/memcpy-strategy-8.c b/gcc/testsuite/gcc.target/i386/memcpy-strategy-8.c new file mode 100644 index 0000000..e8fe0a6 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/memcpy-strategy-8.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -march=tigerlake" } */ +/* { dg-final { scan-assembler-not "jmp\tmemcpy" { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-not "call\tmemcpy" { target ia32 } } } */ +/* { dg-final { scan-assembler-not "rep movsb" } } */ + +typedef unsigned char e_u8; + +#define MAXBC 8 + +void MixColumn(e_u8 a[4][MAXBC], e_u8 BC) +{ + e_u8 b[4][MAXBC]; + int i, j; + + for(i = 0; i < 4; i++) + for(j = 0; j < BC; j++) a[i][j] = b[i][j]; +} diff --git a/gcc/testsuite/gcc.target/i386/memset-strategy-3.c b/gcc/testsuite/gcc.target/i386/memset-strategy-3.c new file mode 100644 index 0000000..9ea1e1a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/memset-strategy-3.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mtune=generic" } */ +/* { dg-final { scan-assembler-not "jmp\tmemset" { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-not "call\tmemset" { target ia32 } } } */ +/* { dg-final { scan-assembler-not "rep stosb" } } */ + +typedef unsigned char e_u8; + +#define MAXBC 8 + +void MixColumn(e_u8 a[4][MAXBC], e_u8 BC) +{ + int i, j; + + for(i = 0; i < 4; i++) + for(j = 0; j < BC; j++) a[i][j] = 1; +} diff --git a/gcc/testsuite/gcc.target/i386/memset-strategy-4.c b/gcc/testsuite/gcc.target/i386/memset-strategy-4.c new file mode 100644 index 0000000..00d82f1 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/memset-strategy-4.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -march=tigerlake" } */ +/* { dg-final { scan-assembler-not "jmp\tmemset" { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-not "call\tmemset" { target ia32 } } } */ +/* { dg-final { scan-assembler-not "rep stosb" } } */ + +typedef unsigned char e_u8; + +#define MAXBC 8 + +void MixColumn(e_u8 a[4][MAXBC], e_u8 BC) +{ + int i, j; + + for(i = 0; i < 4; i++) + for(j = 0; j < BC; j++) a[i][j] = 1; +} diff --git a/gcc/testsuite/gcc.target/i386/memset-strategy-5.c b/gcc/testsuite/gcc.target/i386/memset-strategy-5.c new file mode 100644 index 0000000..dc1de8e --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/memset-strategy-5.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -march=tigerlake -mno-sse" } */ +/* { dg-final { scan-assembler "jmp\tmemset" { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler "call\tmemset" { target ia32 } } } */ +/* { dg-final { scan-assembler-not "rep stosb" } } */ + +void +foo (char *dest) +{ + __builtin_memset (dest, 0, 257); +} diff --git a/gcc/testsuite/gcc.target/i386/memset-strategy-6.c b/gcc/testsuite/gcc.target/i386/memset-strategy-6.c new file mode 100644 index 0000000..e51af3b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/memset-strategy-6.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -march=tigerlake -mno-sse" } */ +/* { dg-final { scan-assembler "rep stosb" } } */ + +void +foo (char *dest) +{ + __builtin_memset (dest, 0, 256); +} -- cgit v1.1 From 7c1d6e89994109e1b6efb5f13890be5586edeb75 Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Mon, 29 Mar 2021 12:41:08 +0000 Subject: arm: Fix mult autovectorization patterm for iwmmxt (PR target/99786) Similarly to other recently-added autovectorization patterns, mult has been erroneously enabled for iwmmxt. However, V4HI and V2SI modes are supported, so we make an exception for them. The new testcase is derived from gcc.dg/ubsan/pr79904.c, with additional modes added. I kept dg-do compile because 'assemble' results in error messages from the assembler, which are not related to this PR: Error: selected processor does not support `tmcrr wr0,r4,r5' in ARM mode Error: selected processor does not support `wstrd wr0,[r0]' in ARM mode Error: selected processor does not support `wldrd wr0,[r0]' in ARM mode Error: selected processor does not support `wldrd wr2,.L5' in ARM mode Error: selected processor does not support `wmulul wr0,wr0,wr2' in ARM mode Error: selected processor does not support `wstrd wr0,[r0]' in ARM mode Error: selected processor does not support `wldrd wr0,[r0]' in ARM mode Error: selected processor does not support `wldrd wr2,.L8' in ARM mode Error: selected processor does not support `wmulwl wr0,wr0,wr2' in ARM mode Error: selected processor does not support `wstrd wr0,[r0]' in ARM mode 2021-03-29 Christophe Lyon PR target/99786 gcc/ * config/arm/vec-common.md (mul3): Disable on iwMMXT, expect for V4HI and V2SI. gcc/testsuite/ * gcc.target/arm/pr99786.c: New test. --- gcc/testsuite/gcc.target/arm/pr99786.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 gcc/testsuite/gcc.target/arm/pr99786.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/arm/pr99786.c b/gcc/testsuite/gcc.target/arm/pr99786.c new file mode 100644 index 0000000..11d86f0 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pr99786.c @@ -0,0 +1,30 @@ +/* { dg-do compile } */ +/* { dg-skip-if "Test is specific to the iWMMXt" { arm*-*-* } { "-mcpu=*" } { "-mcpu=iwmmxt" } } */ +/* { dg-skip-if "Test is specific to the iWMMXt" { arm*-*-* } { "-mabi=*" } { "-mabi=iwmmxt" } } */ +/* { dg-skip-if "Test is specific to the iWMMXt" { arm*-*-* } { "-march=*" } { "-march=iwmmxt" } } */ +/* { dg-skip-if "Test is specific to ARM mode" { arm*-*-* } { "-mthumb" } { "" } } */ +/* { dg-require-effective-target arm32 } */ +/* { dg-require-effective-target arm_iwmmxt_ok } */ +/* { dg-options "-O3 -mcpu=iwmmxt" } */ + +typedef signed char V __attribute__((vector_size (8))); + +void +foo (V *a) +{ + *a = *a * 3; +} + +typedef signed short Vshort __attribute__((vector_size (8))); +void +foo_short (Vshort *a) +{ + *a = *a * 3; +} + +typedef signed int Vint __attribute__((vector_size (8))); +void +foo_int (Vint *a) +{ + *a = *a * 3; +} -- cgit v1.1 From 05de07136a8c288086def19fa7a6ed817e26c6aa Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Mon, 29 Mar 2021 11:36:41 +0000 Subject: testsuite/aarch64: Skip SLP diagnostic under ILP32 (PR target/96974) The vectorizer has a very different effect with -mabi=ilp32, and doesn't emit the expecte diagnostic, so this patch expects it only under lp64. 2021-03-29 Christophe Lyon gcc/testsuite/ PR target/96974 * g++.target/aarch64/sve/pr96974.C: Expect SLP diagnostic only under lp64. --- gcc/testsuite/g++.target/aarch64/sve/pr96974.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.target/aarch64/sve/pr96974.C b/gcc/testsuite/g++.target/aarch64/sve/pr96974.C index 363241d..54000f5 100644 --- a/gcc/testsuite/g++.target/aarch64/sve/pr96974.C +++ b/gcc/testsuite/g++.target/aarch64/sve/pr96974.C @@ -15,4 +15,4 @@ struct c { int coeffs[10]; } f; -/* { dg-final { scan-tree-dump "Not vectorized: Incompatible number of vector subparts between" "slp1" } } */ +/* { dg-final { scan-tree-dump "Not vectorized: Incompatible number of vector subparts between" "slp1" { target lp64 } } } */ -- cgit v1.1 From a2531859bf5bf6cf1f29c0dca85fd26e80904a5d Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 30 Mar 2021 20:31:18 -0400 Subject: c++: Alias template in pack expansion [PR99445] In this testcase, iterative_hash_template_arg checks alias_template_specialization_p to determine whether to treat a type as a dependent alias, and structural_comptypes checks dependent_alias_template_spec_p. Normally that difference isn't a problem because canonicalizing template arguments strips non-dependent aliases, but that wasn't happening for the pack expansion. Fixed thus. gcc/cp/ChangeLog: PR c++/99445 * tree.c (strip_typedefs): Handle TYPE_PACK_EXPANSION. gcc/testsuite/ChangeLog: PR c++/99445 * g++.dg/cpp0x/alias-decl-variadic1.C: New test. --- gcc/testsuite/g++.dg/cpp0x/alias-decl-variadic1.C | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/alias-decl-variadic1.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-variadic1.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-variadic1.C new file mode 100644 index 0000000..68b3a7f --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-variadic1.C @@ -0,0 +1,14 @@ +// PR c++/99445 +// { dg-do compile { target c++11 } } +// { dg-additional-options "-fchecking=2 --param=hash-table-verification-limit=1000" } + +template struct implicit_conversions; +template +using implicit_conversions_t = typename implicit_conversions::type; +template struct response_type; + +template +using type1 = response_type...>; + +template +using type2 = response_type::type...>; -- cgit v1.1 From 31199d95de1304e200554bbf98b2d8a6a7298bec Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Wed, 31 Mar 2021 10:39:24 -0600 Subject: PR middle-end/65182 - -Wuninitialized fails when pointer to variable later passed to function gcc/testsuite: PR middle-end/65182 * gcc.dg/uninit-pr65182.c: New test. --- gcc/testsuite/gcc.dg/uninit-pr65182.c | 44 +++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/uninit-pr65182.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/uninit-pr65182.c b/gcc/testsuite/gcc.dg/uninit-pr65182.c new file mode 100644 index 0000000..45b538d --- /dev/null +++ b/gcc/testsuite/gcc.dg/uninit-pr65182.c @@ -0,0 +1,44 @@ +/* PR middle-end/65182 - -Wuninitialized fails when pointer to variable + later passed to function + { dg-do compile } + { dg-options "-O0 -Wall" } */ + +void bar (int *a); + +int baz (void); + +__attribute__ ((noipa)) void foo_O0 (int *b) +{ + int a; + + if (a) // { dg-warning "\\\[-Wuninitialized" } + { + *b = 0; + return; + } + + bar (&a); + + a = baz (); + + *b = a + 2; +} + +#pragma GCC optimize ("2") + +__attribute__ ((noipa)) void foo_O2 (int *b) +{ + int a; + + if (a) // { dg-warning "\\\[-Wuninitialized" } + { + *b = 0; + return; + } + + bar (&a); + + a = baz (); + + *b = a + 3; +} -- cgit v1.1 From 1b5f74e8be4dd7abe5624ff60adceff19ca71bda Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Wed, 31 Mar 2021 19:34:00 +0100 Subject: Handle CONST_POLY_INTs in CONST_VECTORs [PR97141, PR98726] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR is caused by POLY_INT_CSTs being (necessarily) valid in tree-level VECTOR_CSTs but CONST_POLY_INTs not being valid in RTL CONST_VECTORs. I can't tell/remember how deliberate that was, but I'm guessing not very. In particular, valid_for_const_vector_p was added to guard against symbolic constants rather than CONST_POLY_INTs. I did briefly consider whether we should maintain the current status anyway. However, that would then require a way of constructing variable-length vectors from individiual elements if, say, we have: { [2, 2], [3, 2], [4, 2], … } So I'm chalking this up to an oversight. I think the intention (and certainly the natural thing) is to have the same rules for both trees and RTL. The SVE CONST_VECTOR code should already be set up to handle CONST_POLY_INTs. However, we need to add support for Advanced SIMD CONST_VECTORs that happen to contain SVE-based values. The patch does that by expanding such CONST_VECTORs in the same way as variable vectors. gcc/ PR rtl-optimization/97141 PR rtl-optimization/98726 * emit-rtl.c (valid_for_const_vector_p): Return true for CONST_POLY_INT_P. * rtx-vector-builder.h (rtx_vector_builder::step): Return a poly_wide_int instead of a wide_int. (rtx_vector_builder::apply_set): Take a poly_wide_int instead of a wide_int. * rtx-vector-builder.c (rtx_vector_builder::apply_set): Likewise. * config/aarch64/aarch64.c (aarch64_legitimate_constant_p): Return false for CONST_VECTORs that cannot be forced to memory. * config/aarch64/aarch64-simd.md (mov): If a CONST_VECTOR is too complex to force to memory, build it up from individual elements instead. gcc/testsuite/ PR rtl-optimization/97141 PR rtl-optimization/98726 * gcc.c-torture/compile/pr97141.c: New test. * gcc.c-torture/compile/pr98726.c: Likewise. * gcc.target/aarch64/sve/pr97141.c: Likewise. * gcc.target/aarch64/sve/pr98726.c: Likewise. --- gcc/testsuite/gcc.c-torture/compile/pr97141.c | 8 ++++++++ gcc/testsuite/gcc.c-torture/compile/pr98726.c | 7 +++++++ gcc/testsuite/gcc.target/aarch64/sve/pr97141.c | 10 ++++++++++ gcc/testsuite/gcc.target/aarch64/sve/pr98726.c | 9 +++++++++ 4 files changed, 34 insertions(+) create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr97141.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr98726.c create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/pr97141.c create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/pr98726.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.c-torture/compile/pr97141.c b/gcc/testsuite/gcc.c-torture/compile/pr97141.c new file mode 100644 index 0000000..1a9ff83 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr97141.c @@ -0,0 +1,8 @@ +int a; +short b, c; +short d(short e, short f) { return e + f; } +void g(void) { + a = -9; + for (; a != 51; a = d(a, 5)) + b |= c; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr98726.c b/gcc/testsuite/gcc.c-torture/compile/pr98726.c new file mode 100644 index 0000000..ce24b18 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr98726.c @@ -0,0 +1,7 @@ +int a, c; +char b; +int d() { + a = 0; + for (; a <= 21; a = (short)a + 1) + b &= c; +} diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr97141.c b/gcc/testsuite/gcc.target/aarch64/sve/pr97141.c new file mode 100644 index 0000000..942e4a4 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/pr97141.c @@ -0,0 +1,10 @@ +/* { dg-options "-O3" } */ + +int a; +short b, c; +short d(short e, short f) { return e + f; } +void g(void) { + a = -9; + for (; a != 51; a = d(a, 5)) + b |= c; +} diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr98726.c b/gcc/testsuite/gcc.target/aarch64/sve/pr98726.c new file mode 100644 index 0000000..2395cab --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/pr98726.c @@ -0,0 +1,9 @@ +/* { dg-options "-O3" } */ + +int a, c; +char b; +int d() { + a = 0; + for (; a <= 21; a = (short)a + 1) + b &= c; +} -- cgit v1.1 From b5c7accfb56a7347008f629be4c7344dd849b1b1 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Wed, 31 Mar 2021 19:34:01 +0100 Subject: data-ref: Tighten index-based alias checks [PR99726] create_intersect_range_checks_index tries to create a runtime alias check based on index comparisons. It looks through the access functions for the two DRs to find a SCEV for the loop that is being versioned and converts a DR_STEP-based check into an index-based check. However, there isn't any reliable sign information in the types, so the code expects the value of the IV step (when interpreted as signed) to be negative iff the DR_STEP (when interpreted as signed) is negative. r10-4762 added another assert related to this assumption and the assert fired for the testcase in the PR. The sign of the IV step didn't match the sign of the DR_STEP. I think this is actually showing what was previously a wrong-code bug. The signs didn't match because the DRs contained *two* access function SCEVs for the loop being versioned. It doesn't look like the code is set up to deal with this, since it checks each access function independently and treats it as the sole source of DR_STEP. The patch therefore moves the main condition out of the loop. This also has the advantage of not building a tree for one access function only to throw it away if we find an inner function that makes the comparison invalid. gcc/ PR tree-optimization/99726 * tree-data-ref.c (create_intersect_range_checks_index): Bail out if there is more than one access function SCEV for the loop being versioned. gcc/testsuite/ PR tree-optimization/99726 * gcc.target/i386/pr99726.c: New test. --- gcc/testsuite/gcc.target/i386/pr99726.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr99726.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/i386/pr99726.c b/gcc/testsuite/gcc.target/i386/pr99726.c new file mode 100644 index 0000000..ff19bca --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr99726.c @@ -0,0 +1,15 @@ +/* { dg-options "-flive-patching=inline-clone -mavx512f -O2 -floop-nest-optimize -ftree-loop-vectorize -ftrapv -m32" } */ + +extern int a[256][1024]; +int b; +long c, d; +unsigned int e; + +int +main () +{ + for (; e < d; e++) + for (unsigned j = 1; j < c; j++) + a[e][j] = b * a[e - 1][j + 1]; + return 0; +} -- cgit v1.1 From c778968339afd140380a46edbade054667c7dce2 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Wed, 31 Mar 2021 19:34:01 +0100 Subject: gimple-fold: Recompute ADDR_EXPR flags after folding a TMR [PR98268] The gimple verifier picked up that an ADDR_EXPR of a MEM_REF was not marked TREE_CONSTANT even though the address was in fact invariant. This came from folding a &TARGET_MEM_REF with constant operands to a &MEM_REF; &TARGET_MEM_REF is never treated as TREE_CONSTANT but &MEM_REF can be. gcc/ PR tree-optimization/98268 * gimple-fold.c (maybe_canonicalize_mem_ref_addr): Call recompute_tree_invariant_for_addr_expr after successfully folding a TARGET_MEM_REF that occurs inside an ADDR_EXPR. gcc/testsuite/ PR tree-optimization/98268 * gcc.target/aarch64/sve/pr98268-1.c: New test. * gcc.target/aarch64/sve/pr98268-2.c: Likewise. --- gcc/testsuite/gcc.target/aarch64/sve/pr98268-1.c | 11 +++++++++++ gcc/testsuite/gcc.target/aarch64/sve/pr98268-2.c | 10 ++++++++++ 2 files changed, 21 insertions(+) create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/pr98268-1.c create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/pr98268-2.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr98268-1.c b/gcc/testsuite/gcc.target/aarch64/sve/pr98268-1.c new file mode 100644 index 0000000..fdbe55e --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/pr98268-1.c @@ -0,0 +1,11 @@ +/* { dg-do link } */ +/* { dg-options "-flto -O -ftree-vectorize --param=aarch64-autovec-preference=3" } */ +/* { dg-additional-sources "pr98268-2.c" } */ + +short d, e; +void f(char, long*); +int main() { + long x; + f(-114, &x); + return d == e; +} diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr98268-2.c b/gcc/testsuite/gcc.target/aarch64/sve/pr98268-2.c new file mode 100644 index 0000000..de3b05d --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/pr98268-2.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-O -ftree-vectorize --param=aarch64-autovec-preference=3" } */ + +extern short d[], e[]; +void f(char a, long *b) { + for (int c = 0; c < a - 12; c++) { + d[c] = b[c]; + e[c] = 0; + } +} -- cgit v1.1 From e4bb1bd60a9fd1bed36092a990aa5fed5d45bfa6 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Mon, 29 Mar 2021 16:13:32 -0400 Subject: analyzer: avoid printing '' for SSA names [PR99771] We don't want to print '' in our diagnostics, but PR analyzer/99771 lists various cases where -fanalyzer does, due to using the SSA_NAME for a temporary when determining the best tree to use. This can happen in two ways: (a) ...when a better expression than the SSA_NAME could be built, but finding it requires traversing the relationships in the region_model in a graph-like way, rather than by considering individual svalues and regions. (b) ...when the only remaining user of the underlying svalue is the SSA_NAME, typically due to the diagnostic referring to a temporary. I've been experimenting with fixing (a), but don't have a good fix yet. In the meantime, this patch addresses (b) by detecting if we have the SSA_NAME for a temporary, and, for the cases where it's possible, reconstructing a tree by walking the def-stmts. This fixes various cases of (b) and ameliorates some cases of (a). gcc/analyzer/ChangeLog: PR analyzer/99771 * analyzer.cc (maybe_reconstruct_from_def_stmt): New. (fixup_tree_for_diagnostic_1): New. (fixup_tree_for_diagnostic): New. * analyzer.h (fixup_tree_for_diagnostic): New decl. * checker-path.cc (call_event::get_desc): Call fixup_tree_for_diagnostic and use it for the call_with_state call. (warning_event::get_desc): Likewise for the final_event and make_label_text calls. * engine.cc (impl_region_model_context::on_state_leak): Likewise for the on_leak and add_diagnostic calls. * region-model.cc (region_model::get_representative_tree): Likewise for the result. gcc/testsuite/ChangeLog: PR analyzer/99771 * gcc.dg/analyzer/data-model-10.c: Update expected output. * gcc.dg/analyzer/malloc-ipa-13.c: Likewise. * gcc.dg/analyzer/malloc-ipa-13a.c: New test. * gcc.dg/analyzer/pr99771-1.c: New test. --- gcc/testsuite/gcc.dg/analyzer/data-model-10.c | 3 +- gcc/testsuite/gcc.dg/analyzer/malloc-ipa-13.c | 3 +- gcc/testsuite/gcc.dg/analyzer/malloc-ipa-13a.c | 38 ++++++++++++++++ gcc/testsuite/gcc.dg/analyzer/pr99771-1.c | 63 ++++++++++++++++++++++++++ 4 files changed, 104 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/analyzer/malloc-ipa-13a.c create mode 100644 gcc/testsuite/gcc.dg/analyzer/pr99771-1.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-10.c b/gcc/testsuite/gcc.dg/analyzer/data-model-10.c index c261edc..04c9891 100644 --- a/gcc/testsuite/gcc.dg/analyzer/data-model-10.c +++ b/gcc/testsuite/gcc.dg/analyzer/data-model-10.c @@ -12,6 +12,7 @@ test (void) if (!new_table) return NULL; new_table->m_f = (char **)malloc(sizeof(char **)); - *new_table->m_f = NULL; /* { dg-warning "dereference of possibly-NULL ''" } */ // FIXME: something better than "unknown" here + *new_table->m_f = NULL; /* { dg-warning "dereference of possibly-NULL '\\*new_table.m_f'" } */ + /* { dg-message "'\\*new_table.m_f' could be NULL" "final event wording" { target *-*-* } .-1 } */ return new_table; } diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-ipa-13.c b/gcc/testsuite/gcc.dg/analyzer/malloc-ipa-13.c index 2e3d80e..a08386a 100644 --- a/gcc/testsuite/gcc.dg/analyzer/malloc-ipa-13.c +++ b/gcc/testsuite/gcc.dg/analyzer/malloc-ipa-13.c @@ -23,8 +23,7 @@ void test (struct foo f) do_stuff (); - calls_free (f.m_p); /* { dg-message "passing freed pointer '' in call to 'calls_free' from 'test'" } */ - // TODO: something better than '' + calls_free (f.m_p); /* { dg-message "passing freed pointer 'f\\.m_p' in call to 'calls_free' from 'test'" } */ do_stuff (); } diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-ipa-13a.c b/gcc/testsuite/gcc.dg/analyzer/malloc-ipa-13a.c new file mode 100644 index 0000000..d74ef59 --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/malloc-ipa-13a.c @@ -0,0 +1,38 @@ +/* { dg-additional-options "-fanalyzer-verbosity=1" } */ + +#include + +void +calls_free (void *victim) +{ + free (victim); /* { dg-warning "double-'free' of 'victim'" } */ +} + +extern void do_stuff (void); + +struct foo +{ + void *m_p; +}; + +static void * __attribute__((noinline)) +test_a (struct foo f) +{ + do_stuff (); + + calls_free (f.m_p); + + do_stuff (); + + return f.m_p; +} + +void test_b (void *p) +{ + void *q; + struct foo f; + f.m_p = p; + q = test_a (f); + calls_free (q); /* { dg-message "passing freed pointer 'q' in call to 'calls_free' from 'test_b'" } */ + do_stuff (); +} diff --git a/gcc/testsuite/gcc.dg/analyzer/pr99771-1.c b/gcc/testsuite/gcc.dg/analyzer/pr99771-1.c new file mode 100644 index 0000000..08449f9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/pr99771-1.c @@ -0,0 +1,63 @@ +/* Verify that we don't print "" in various diagnostics + (PR analyzer/99771). */ + +#include + +void test_1 (void) +{ + *(char*)malloc (1024) = 42; /* { dg-warning "dereference of possibly-NULL 'malloc\\(1024\\)'" } */ +} /* { dg-warning "leak of 'malloc\\(1024\\)'" "warning" } */ + /* { dg-message "'malloc\\(1024\\)' leaks here" "final event" { target *-*-* } .-1 } */ + +void test_2 (size_t n) +{ + *(char*)malloc (4 * n) = 42; /* { dg-warning "dereference of possibly-NULL 'malloc\\(n \\* 4\\)'" "warning" } */ + /* { dg-message "'malloc\\(n \\* 4\\)' could be NULL" "final event" { target *-*-* } .-1 } */ +} /* { dg-warning "leak of 'malloc\\(n \\* 4\\)'" "warning" } */ + /* { dg-message "'malloc\\(n \\* 4\\)' leaks here" "final event" { target *-*-* } .-1 } */ + +/* A compound example. */ + +void test_3 (size_t a, size_t b, size_t c) +{ + *(char*)malloc (a + (b * c)) = 42; /* { dg-warning "dereference of possibly-NULL 'malloc\\(a \\+ b \\* c\\)'" "warning" } */ + /* { dg-message "'malloc\\(a \\+ b \\* c\\)' could be NULL" "final event" { target *-*-* } .-1 } */ +} /* { dg-warning "leak of 'malloc\\(a \\+ b \\* c\\)'" "warning" } */ + /* { dg-message "'malloc\\(a \\+ b \\* c\\)' leaks here" "final event" { target *-*-* } .-1 } */ + +void test_4 (size_t a, size_t b, size_t c) +{ + *(char *)malloc (a ? b : c) = 42; /* { dg-warning "dereference of possibly-NULL 'malloc\\(\\)'" "warning" } */ + /* { dg-message "'malloc\\(\\)' could be NULL" "final event" { target *-*-* } .-1 } */ +} /* { dg-warning "leak of 'malloc\\(\\)'" "warning" } */ + /* { dg-message "'malloc\\(\\)' leaks here" "final event" { target *-*-* } .-1 } */ + +/* Unary operators. */ + +void test_5 (size_t a) +{ + *(char*)malloc (-a) = 42; /* { dg-warning "dereference of possibly-NULL 'malloc\\(-a\\)'" } */ +} /* { dg-warning "leak of 'malloc\\(-a\\)'" "warning" } */ + /* { dg-message "'malloc\\(-a\\)' leaks here" "final event" { target *-*-* } .-1 } */ + +void test_6 (size_t a) +{ + *(char*)malloc (~a) = 42; /* { dg-warning "dereference of possibly-NULL 'malloc\\(~a\\)'" } */ +} /* { dg-warning "leak of 'malloc\\(~a\\)'" "warning" } */ + /* { dg-message "'malloc\\(~a\\)' leaks here" "final event" { target *-*-* } .-1 } */ + +/* Field access. */ + +struct s7 { size_t sz; }; + +void test_7a(struct s7 s) +{ + *(char*)malloc (s.sz) = 42; /* { dg-warning "dereference of possibly-NULL 'malloc\\(s\\.sz\\)'" } */ +} /* { dg-warning "leak of 'malloc\\(s\\.sz\\)'" "warning" } */ + /* { dg-message "'malloc\\(s\\.sz\\)' leaks here" "final event" { target *-*-* } .-1 } */ + +void test_7b (struct s7 *s) +{ + *(char*)malloc (s->sz) = 42; /* { dg-warning "dereference of possibly-NULL 'malloc\\(\\*s\\.sz\\)'" } */ +} /* { dg-warning "leak of 'malloc\\(\\*s\\.sz\\)'" "warning" } */ + /* { dg-message "'malloc\\(\\*s\\.sz\\)' leaks here" "final event" { target *-*-* } .-1 } */ -- cgit v1.1 From 95d217ab52d31dc06fda42fc136dea165909e88b Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 1 Apr 2021 00:16:39 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 93 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b12e442..3523bf0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,96 @@ +2021-03-31 David Malcolm + + PR analyzer/99771 + * gcc.dg/analyzer/data-model-10.c: Update expected output. + * gcc.dg/analyzer/malloc-ipa-13.c: Likewise. + * gcc.dg/analyzer/malloc-ipa-13a.c: New test. + * gcc.dg/analyzer/pr99771-1.c: New test. + +2021-03-31 Richard Sandiford + + PR tree-optimization/98268 + * gcc.target/aarch64/sve/pr98268-1.c: New test. + * gcc.target/aarch64/sve/pr98268-2.c: Likewise. + +2021-03-31 Richard Sandiford + + PR tree-optimization/99726 + * gcc.target/i386/pr99726.c: New test. + +2021-03-31 Richard Sandiford + + PR rtl-optimization/97141 + PR rtl-optimization/98726 + * gcc.c-torture/compile/pr97141.c: New test. + * gcc.c-torture/compile/pr98726.c: Likewise. + * gcc.target/aarch64/sve/pr97141.c: Likewise. + * gcc.target/aarch64/sve/pr98726.c: Likewise. + +2021-03-31 Martin Sebor + + PR middle-end/65182 + * gcc.dg/uninit-pr65182.c: New test. + +2021-03-31 Jason Merrill + + PR c++/99445 + * g++.dg/cpp0x/alias-decl-variadic1.C: New test. + +2021-03-31 Christophe Lyon + + PR target/96974 + * g++.target/aarch64/sve/pr96974.C: Expect SLP diagnostic only + under lp64. + +2021-03-31 Christophe Lyon + + PR target/99786 + * gcc.target/arm/pr99786.c: New test. + +2021-03-31 H.J. Lu + + * gcc.target/i386/memcpy-strategy-5.c: New test. + * gcc.target/i386/memcpy-strategy-6.c: Likewise. + * gcc.target/i386/memcpy-strategy-7.c: Likewise. + * gcc.target/i386/memcpy-strategy-8.c: Likewise. + * gcc.target/i386/memset-strategy-3.c: Likewise. + * gcc.target/i386/memset-strategy-4.c: Likewise. + * gcc.target/i386/memset-strategy-5.c: Likewise. + * gcc.target/i386/memset-strategy-6.c: Likewise. + +2021-03-31 Richard Sandiford + + PR target/98119 + * gcc.target/aarch64/sve/pr98119.c: New test. + +2021-03-31 Jakub Jelinek + Richard Sandiford + + PR target/99813 + * g++.target/aarch64/sve/pr99813.C: New test. + +2021-03-31 Jakub Jelinek + + PR testsuite/97680 + * c-c++-common/zero-scratch-regs-6.c: Skip on ia64. + * c-c++-common/zero-scratch-regs-7.c: Likewise. + * c-c++-common/zero-scratch-regs-8.c: Change from dg-skip-if of + selected unsupported triplets to all targets but selected triplets + of supported targets. + * c-c++-common/zero-scratch-regs-9.c: Likewise. + * c-c++-common/zero-scratch-regs-10.c: Likewise. + * c-c++-common/zero-scratch-regs-11.c: Likewise. + +2021-03-31 Patrick Palka + + PR c++/88115 + * g++.dg/cpp0x/alignof7.C: Adjust expected mangling. + +2021-03-31 Patrick Palka + + PR c++/99815 + * g++.dg/cpp2a/concepts-placeholder5.C: New test. + 2021-03-30 David Malcolm * gcc.dg/analyzer/symbolic-1.c: Fix typo. -- cgit v1.1 From d7cef070bf43bfb3f3d77bac42eadea06c4b0281 Mon Sep 17 00:00:00 2001 From: Harald Anlauf Date: Thu, 1 Apr 2021 07:49:32 +0200 Subject: PR fortran/99840 - ICE in gfc_simplify_matmul, at fortran/simplify.c:4777 The simplification of the transposition of a constant array shall properly initialize and set the shape of the result. gcc/fortran/ChangeLog: PR fortran/99840 * simplify.c (gfc_simplify_transpose): Properly initialize resulting shape. gcc/testsuite/ChangeLog: PR fortran/99840 * gfortran.dg/transpose_5.f90: New test. --- gcc/testsuite/gfortran.dg/transpose_5.f90 | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/transpose_5.f90 (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gfortran.dg/transpose_5.f90 b/gcc/testsuite/gfortran.dg/transpose_5.f90 new file mode 100644 index 0000000..ed4b643 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/transpose_5.f90 @@ -0,0 +1,8 @@ +! { dg-do compile } +! { dg-options "-O2" } +! PR fortran/99840 - ICE in gfc_simplify_matmul, at fortran/simplify.c:4777 +program p + integer, parameter :: x(0,0) = 0 + integer :: y(0,0) + y = matmul (x, transpose(x)) +end -- cgit v1.1 From 19d71674616e6494a60432a2a28adcd762a6c877 Mon Sep 17 00:00:00 2001 From: Martin Jambor Date: Thu, 1 Apr 2021 10:12:23 +0200 Subject: sra: Fix bug in grp_write propagation (PR 97009) SRA represents parts of aggregates which are arrays accessed with unknown index as "unscalarizable regions." When there are two such regions one within another and the outer is only read whereas the inner is written to, SRA fails to propagate that write information across assignments. This means that a second aggregate can contain data while SRA thinks it does not and the pass can wrongly eliminate big chunks of assignment from that second aggregate into a third aggregate, which is what happens in PR 97009. Fixed by checking all children of unscalariable accesses for the grp_write flag. gcc/ChangeLog: 2021-03-31 Martin Jambor PR tree-optimization/97009 * tree-sra.c (access_or_its_child_written): New function. (propagate_subaccesses_from_rhs): Use it instead of a simple grp_write test. gcc/testsuite/ChangeLog: 2021-03-31 Martin Jambor PR tree-optimization/97009 * gcc.dg/tree-ssa/pr97009.c: New test. --- gcc/testsuite/gcc.dg/tree-ssa/pr97009.c | 66 +++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr97009.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr97009.c b/gcc/testsuite/gcc.dg/tree-ssa/pr97009.c new file mode 100644 index 0000000..741dbc2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr97009.c @@ -0,0 +1,66 @@ +/* { dg-do run } */ +/* { dg-options "-O1" } */ + +static int __attribute__((noipa)) +get_5 (void) +{ + return 5; +} + +static int __attribute__((noipa)) +verify_5 (int v) +{ + if (v != 5) + __builtin_abort (); +} + +struct T +{ + int w; + int a[4]; +}; + +struct S +{ + int v; + int x; + struct T t[2]; + char alotofstuff[128]; +}; + +volatile int vol; + +void __attribute__((noipa)) +consume_t (struct T t) +{ + vol = t.a[0]; +} + +int __attribute__((noipa)) +foo (int l1, int l2) +{ + struct S s1, s2, s3; + int i, j; + + s1.v = get_5 (); + for (i = 0; i < l1; i++) + { + for (j = 0; j < l2; j++) + s1.t[i].a[j] = get_5 (); + consume_t(s1.t[i]); + } + + s2 = s1; + + s3 = s2; + for (i = 0; i < l1; i++) + for (j = 0; j < l2; j++) + verify_5 (s3.t[i].a[j]); +} + +int +main (int argc, char *argv[]) +{ + foo (2, 4); + return 0; +} -- cgit v1.1 From b75c4e1384c021ca94fc8e8db8e517e802b820f3 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Thu, 1 Apr 2021 09:29:14 +0200 Subject: tree-optimization/99856 - fix overwideing pattern creation This fixes an omission of promoting a bit-precision required precision to a vector element precision. 2021-04-01 Richard Biener PR tree-optimization/99856 * tree-vect-patterns.c (vect_recog_over_widening_pattern): Promote precision to vector element precision. * gcc.dg/vect/pr99856.c: New testcase. --- gcc/testsuite/gcc.dg/vect/pr99856.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/vect/pr99856.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/vect/pr99856.c b/gcc/testsuite/gcc.dg/vect/pr99856.c new file mode 100644 index 0000000..e5d2a45 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr99856.c @@ -0,0 +1,33 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target vect_int } */ +/* { dg-require-effective-target vect_unpack } */ +/* { dg-require-effective-target vect_pack_trunc } */ + +#define SHIFTFORDIV255(a)\ + ((((a) >> 8) + a) >> 8) + +#define DIV255(a)\ + SHIFTFORDIV255(a + 0x80) + +typedef unsigned char uint8_t; + +void +opSourceOver_premul(uint8_t* restrict Rrgba, + const uint8_t* restrict Srgba, + const uint8_t* restrict Drgba, int len) +{ + Rrgba = __builtin_assume_aligned (Rrgba, __BIGGEST_ALIGNMENT__); + Srgba = __builtin_assume_aligned (Rrgba, __BIGGEST_ALIGNMENT__); + Drgba = __builtin_assume_aligned (Rrgba, __BIGGEST_ALIGNMENT__); + int i = 0; + for (; i < len*4; i += 4) + { + uint8_t Sa = Srgba[i + 3]; + Rrgba[i + 0] = DIV255(Srgba[i + 0] * 255 + Drgba[i + 0] * (255 - Sa)); + Rrgba[i + 1] = DIV255(Srgba[i + 1] * 255 + Drgba[i + 1] * (255 - Sa)); + Rrgba[i + 2] = DIV255(Srgba[i + 2] * 255 + Drgba[i + 2] * (255 - Sa)); + Rrgba[i + 3] = DIV255(Srgba[i + 3] * 255 + Drgba[i + 3] * (255 - Sa)); + } +} + +/* { dg-final { scan-tree-dump "vectorized 1 loops in function" "vect" } } */ -- cgit v1.1 From 5b9a65ecbeb22ef6dd3344baae97f85b645522e3 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 1 Apr 2021 10:51:03 +0200 Subject: bswap: Handle bswapping of pointers [PR96573] In GCC8/9 we used to optimize this into a bswap, but we no longer do. Handling byteswapping of pointers is easy, all we need is to allow them, for the __builtin_bswap* we already use TYPE_PRECISION to determine the precision and we cast the operand and result to the correct type if they aren't uselessly convertible to what the builtin expects. 2021-04-01 Jakub Jelinek PR tree-optimization/96573 * gimple-ssa-store-merging.c (init_symbolic_number): Handle also pointer types. * gcc.dg/pr96573.c: New test. --- gcc/testsuite/gcc.dg/pr96573.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr96573.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/pr96573.c b/gcc/testsuite/gcc.dg/pr96573.c new file mode 100644 index 0000000..3acf117 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr96573.c @@ -0,0 +1,20 @@ +/* PR tree-optimization/96573 */ +/* { dg-do compile { target { lp64 || ilp32 } } } */ +/* { dg-require-effective-target bswap } */ +/* { dg-options "-O3 -fdump-tree-optimized" } */ +/* { dg-final { scan-tree-dump "__builtin_bswap" "optimized" } } */ + +typedef __SIZE_TYPE__ size_t; + +void * +foo (void * const p) +{ + const size_t m = sizeof (p) - 1; + const unsigned char * const o = (unsigned char*) &p; + void *n; + unsigned char * const q = (unsigned char *) &n; + unsigned char i; + for (i = 0; i <= m; ++i) + q[m - i] = o[i]; + return n; +} -- cgit v1.1 From 3064fc21aa29d8e04b23c0b52dc4f67de1da6b2f Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Thu, 1 Apr 2021 12:11:39 +0200 Subject: Add testcase for PR98265 gcc/testsuite/ChangeLog: 2021-04-01 Jan Hubicka PR ipa/98265 * gcc.dg/tree-ssa/pr98265.C: New test. --- gcc/testsuite/gcc.dg/tree-ssa/pr98265.C | 348 ++++++++++++++++++++++++++++++++ 1 file changed, 348 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr98265.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr98265.C b/gcc/testsuite/gcc.dg/tree-ssa/pr98265.C new file mode 100644 index 0000000..9c798e6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr98265.C @@ -0,0 +1,348 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ +extern void __assert_fail(const char*, const char*, int, const char*); +namespace Eigen { +enum { AutoAlign }; +template +struct conditional; +template +struct conditional { + typedef Else type; +}; +template +struct remove_reference { + typedef T type; +}; +struct is_arithmetic { + enum { value }; +}; +template +struct traits; +template +struct traits : traits {}; +template +struct evaluator; +template +struct EigenBase; +template +class PlainObjectBase; +template +class Matrix; +template +class MatrixBase; +template +class CwiseNullaryOp; +template +class CwiseBinaryOp; +template +struct scalar_constant_op; +template +struct size_at_compile_time { + enum { ret = _Rows }; +}; +struct ref_selector { + typedef const Matrix& type; +}; +template +struct dense_xpr_base { + typedef MatrixBase type; +}; +template ::XprKind> +struct generic_xpr_base { + typedef typename dense_xpr_base::type type; +}; +template +struct plain_constant_type { + ; + typedef CwiseNullaryOp, + Matrix::ColsAtCompileTime, + traits::MaxRowsAtCompileTime, + traits::MaxColsAtCompileTime>> + type; +}; +struct scalar_product_op { + float operator()(float a, float b) { return a * b; } +}; +template +struct scalar_constant_op { + scalar_constant_op(float other) : m_other(other) {} + float operator()() { return m_other; } + float m_other; +}; +struct assign_op { + void assignCoeff(float& a, float b) { a = b; } +}; +template +class DenseCoeffsBase : public EigenBase { + public: + typedef typename traits::Scalar Scalar; + typedef + typename conditional::type CoeffReturnType; +}; +template +class DenseBase : public DenseCoeffsBase { + public: + enum { + RowsAtCompileTime = traits::RowsAtCompileTime, + SizeAtCompileTime = size_at_compile_time::ret, + MaxSizeAtCompileTime + }; +}; +template +class MatrixBase : public DenseBase { + public: + using DenseBase::derived; + template + CwiseBinaryOp::type> + operator*(T& scalar) { + return CwiseBinaryOp::type>( + derived(), typename plain_constant_type::type(derived().rows(), + 0, scalar)); + } +}; +template +struct EigenBase { + const Derived& derived() const { return *static_cast(this); } + Derived& const_cast_derived() const { + return *static_cast(const_cast(this)); + } +}; +template +struct binary_evaluator; +template +struct evaluator : evaluator { + evaluator(const T& xpr) : evaluator(xpr) {} +}; +template +struct evaluator { + typedef Derived PlainObjectType; + typedef typename PlainObjectType::Scalar Scalar; + evaluator(const PlainObjectType& m) : m_data(m.data()) {} + typename PlainObjectType::CoeffReturnType coeff(long row, long) { + return m_data[row]; + } + Scalar& coeffRef(long row, long) { return const_cast(m_data)[row]; } + const Scalar* m_data; +}; +template +struct evaluator> + : evaluator>> { + typedef Matrix XprType; + evaluator(const XprType& m) : evaluator>(m) {} +}; +struct nullary_wrapper { + template + float operator()(scalar_constant_op op, IndexType, IndexType) const { + return op(); + } +}; +template +struct evaluator> { + typedef CwiseNullaryOp XprType; + evaluator(XprType n) : m_functor(n.functor()) {} + template + typename XprType::CoeffReturnType coeff(IndexType row, IndexType col) { + return m_wrapper(m_functor, row, col); + } + NullaryOp m_functor; + nullary_wrapper m_wrapper; +}; +template +struct evaluator> + : binary_evaluator> { + evaluator(CwiseBinaryOp xpr) + : binary_evaluator>(xpr) {} +}; +template +struct binary_evaluator> { + typedef CwiseBinaryOp XprType; + binary_evaluator(XprType xpr) : m_lhsImpl(xpr.lhs()), m_rhsImpl(xpr.rhs()) {} + typename XprType::CoeffReturnType coeff(long row, long col) { + return m_functor(m_lhsImpl.coeff(row, col), m_rhsImpl.coeff(row, col)); + } + BinaryOp m_functor; + evaluator m_lhsImpl; + evaluator m_rhsImpl; +}; +template +struct copy_using_evaluator_DefaultTraversal_CompleteUnrolling { + enum { outer, inner = Index }; + static void run(Kernel kernel) { + kernel.assignCoeffByOuterInner(outer, inner); + copy_using_evaluator_DefaultTraversal_CompleteUnrolling::run(kernel); + } +}; +template +struct copy_using_evaluator_DefaultTraversal_CompleteUnrolling { + static void run(Kernel) {} +}; +template +struct dense_assignment_loop { + static void run(Kernel kernel) { + typedef typename Kernel::DstEvaluatorType::XprType DstXprType; + enum { size = DstXprType::SizeAtCompileTime, alignedSize = 0 }; + copy_using_evaluator_DefaultTraversal_CompleteUnrolling::run(kernel); + } +}; +template +class generic_dense_assignment_kernel { + typedef typename DstEvaluatorTypeT::XprType DstXprType; + + public: + typedef DstEvaluatorTypeT DstEvaluatorType; + typedef SrcEvaluatorTypeT SrcEvaluatorType; + generic_dense_assignment_kernel(DstEvaluatorType dst, SrcEvaluatorType src, + Functor, DstXprType& dstExpr) + : m_dst(dst), m_src(src), m_dstExpr(dstExpr) {} + long assignCoeff_col; + void assignCoeffByOuterInner(long, long inner) { + long __trans_tmp_1 = inner; + m_functor.assignCoeff(m_dst.coeffRef(__trans_tmp_1, assignCoeff_col), + m_src.coeff(__trans_tmp_1, assignCoeff_col)); + } + DstEvaluatorType m_dst; + SrcEvaluatorType m_src; + Functor m_functor; + DstXprType& m_dstExpr; +}; +template +void call_dense_assignment_loop(DstXprType& dst, SrcXprType src, Functor func) { + typedef evaluator DstEvaluatorType; + typedef evaluator SrcEvaluatorType; + SrcEvaluatorType srcEvaluator(src); + DstEvaluatorType dstEvaluator(dst); + typedef generic_dense_assignment_kernel + Kernel; + Kernel kernel(dstEvaluator, srcEvaluator, func, dst.const_cast_derived()); + dense_assignment_loop::run(kernel); +} +template +void call_assignment_no_alias(Dst& dst, Src src, Func func) { + enum { NeedToTranspose }; + typename conditional::type actualDst(dst); + CwiseBinaryOp, + const CwiseNullaryOp, + const Matrix>> + __trans_tmp_4 = src; + call_dense_assignment_loop(actualDst, __trans_tmp_4, func); +} +template +struct plain_array { + float array[Size]; +}; +template +class DenseStorage { + plain_array m_data; + + public: + DenseStorage() {} + DenseStorage(const DenseStorage&); + static long rows() { return _Rows; } + const float* data() const { return m_data.array; } + float* data() { return m_data.array; } +}; +template +class PlainObjectBase : public dense_xpr_base::type { + public: + typedef typename dense_xpr_base::type Base; + typedef typename traits::Scalar Scalar; + DenseStorage m_storage; + long rows() const { return m_storage.rows(); } + const Scalar* data() const { return m_storage.data(); } + PlainObjectBase() {} + template + PlainObjectBase(const DenseBase& other) { + _set_noalias(other); + } + template + void _set_noalias(const DenseBase& other) { + call_assignment_no_alias(this->derived(), other.derived(), assign_op()); + } +}; +template +struct traits> { + typedef _Scalar Scalar; + typedef int XprKind; + enum { + RowsAtCompileTime = _Rows, + ColsAtCompileTime, + MaxRowsAtCompileTime, + MaxColsAtCompileTime, + }; +}; +template +class Matrix + : public PlainObjectBase< + Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>> { + public: + typedef PlainObjectBase Base; + typedef typename traits::Scalar Scalar; + Matrix(Scalar& x, Scalar& y, Scalar& z) { + m_storage.data()[0] = x; + m_storage.data()[1] = y; + m_storage.data()[2] = z; + } + template + Matrix(const EigenBase& other) : Base(other.derived()) {} + using Base::m_storage; +}; +template +struct traits> { + typedef typename traits::XprKind XprKind; + enum { RowsAtCompileTime }; + typedef float Scalar; +}; +template +class CwiseBinaryOpImpl; +template +class CwiseBinaryOp : public CwiseBinaryOpImpl { + public: + typedef ref_selector::type LhsNested; + typedef RhsType RhsNested; + CwiseBinaryOp(const Matrix& aLhs, RhsType& aRhs) + : m_lhs(aLhs), m_rhs(aRhs) {} + remove_reference::type& lhs() { return m_lhs; } + typename remove_reference::type& rhs() { return m_rhs; } + LhsNested m_lhs; + RhsNested m_rhs; +}; +template +class CwiseBinaryOpImpl + : public generic_xpr_base, + const CwiseNullaryOp, + const Matrix>>>::type {}; +template +struct traits> + : traits {}; +template +class CwiseNullaryOp + : public dense_xpr_base>::type { + public: + CwiseNullaryOp(long rows, long, scalar_constant_op func) + : m_functor(func) { + rows ? void() : __assert_fail("", "", 1, __PRETTY_FUNCTION__); + } + scalar_constant_op functor() { return m_functor; } + scalar_constant_op m_functor; +}; +} // namespace Eigen +Eigen::Matrix should_inline(float x, float y, float z, + float scale) { + return Eigen::Matrix(x, y, z) * scale; +} + +// We should inline everything to should_inline + +/* { dg-final { scan-tree-dump-times "Function" "optimized" } } */ -- cgit v1.1 From 584731ecedf09c2c067913c4af9ed0a30cf19e8d Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Thu, 1 Apr 2021 05:25:53 -0700 Subject: c++: inter-cluster import order [PR 99283] I finally managed to reduce the testcase without hitting other bugs. This problem is caused by discovering a duplicate in the middle of reading in the entity in question. I had thougt the import seeding at the beginning of a cluster prevented that, but it is insufficient. Specifically an earlier cluster in the same module can cause the import of a duplicate. Although clusters within a module are well-ordered, there is no ordering between clusters of one module and clusters of another module. And thus we can get duplicate declaration loops. This prevents the problem by also seeding references to earlier clusters in the same module. As the FIXME notes, it is sufficient to reference a single entity in any particular earlier cluster, plus, we also could determine the implicit dependencies and prune that seeding even further. I do not do that -- it decrease the loading that will happen, but would reduce the serialization size. As ever, let's get correctness first. PR c++/99283 gcc/cp/ * module.cc (trees_out::decl_node): Adjust importedness reference assert. (module_state::intercluster_seed): New. Seed both imports and inter-cluster references. Broken out of ... (module_state::write_cluster): ... here. Call it. gcc/testsuite/ * g++.dg/modules/pr99283-6.h: New. * g++.dg/modules/pr99283-6_a.H: New. * g++.dg/modules/pr99283-6_b.H: New. * g++.dg/modules/pr99283-6_c.C: New. * g++.dg/modules/hdr-init-1_c.C: Adjust scan. * g++.dg/modules/indirect-3_c.C: Adjust scan. * g++.dg/modules/indirect-4_c.C: Adjust scan. * g++.dg/modules/lambda-3_b.C: Adjust scan. * g++.dg/modules/late-ret-3_c.C: Adjust scan. * g++.dg/modules/pr99425-1_b.H: Adjust scan. * g++.dg/modules/pr99425-1_c.C: Adjust scan. --- gcc/testsuite/g++.dg/modules/hdr-init-1_c.C | 4 +- gcc/testsuite/g++.dg/modules/indirect-3_c.C | 2 +- gcc/testsuite/g++.dg/modules/indirect-4_c.C | 2 +- gcc/testsuite/g++.dg/modules/lambda-3_b.C | 6 +- gcc/testsuite/g++.dg/modules/late-ret-3_c.C | 2 +- gcc/testsuite/g++.dg/modules/pr99283-6.h | 23 ++++ gcc/testsuite/g++.dg/modules/pr99283-6_a.H | 33 ++++++ gcc/testsuite/g++.dg/modules/pr99283-6_b.H | 164 ++++++++++++++++++++++++++++ gcc/testsuite/g++.dg/modules/pr99283-6_c.C | 10 ++ gcc/testsuite/g++.dg/modules/pr99425-1_b.H | 2 +- gcc/testsuite/g++.dg/modules/pr99425-1_c.C | 4 +- 11 files changed, 241 insertions(+), 11 deletions(-) create mode 100644 gcc/testsuite/g++.dg/modules/pr99283-6.h create mode 100644 gcc/testsuite/g++.dg/modules/pr99283-6_a.H create mode 100644 gcc/testsuite/g++.dg/modules/pr99283-6_b.H create mode 100644 gcc/testsuite/g++.dg/modules/pr99283-6_c.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/modules/hdr-init-1_c.C b/gcc/testsuite/g++.dg/modules/hdr-init-1_c.C index efcc485..2a103c3 100644 --- a/gcc/testsuite/g++.dg/modules/hdr-init-1_c.C +++ b/gcc/testsuite/g++.dg/modules/hdr-init-1_c.C @@ -17,8 +17,8 @@ int main () // { dg-final { scan-lang-dump-times {Reading 1 initializers} 2 module } } -// { dg-final { scan-lang-dump {Read:-1's named merge key \(new\) var_decl:'::var'} module } } +// { dg-final { scan-lang-dump {Read:-[0-9]*'s named merge key \(new\) var_decl:'::var'} module } } // { dg-final { scan-lang-dump-times {Reading definition var_decl '::var@[^\n]*/hdr-init-1_a.H:1'} 2 module } } -// { dg-final { scan-lang-dump {Read:-1's named merge key \(matched\) var_decl:'::var'} module } } +// { dg-final { scan-lang-dump {Read:-[0-9]*'s named merge key \(matched\) var_decl:'::var'} module } } diff --git a/gcc/testsuite/g++.dg/modules/indirect-3_c.C b/gcc/testsuite/g++.dg/modules/indirect-3_c.C index 9c5cb23..ec2fc76 100644 --- a/gcc/testsuite/g++.dg/modules/indirect-3_c.C +++ b/gcc/testsuite/g++.dg/modules/indirect-3_c.C @@ -19,6 +19,6 @@ int main () // { dg-final { scan-lang-dump-not {Instantiation:-[0-9]* function_decl:'::foo::X@foo:.::frob@.()<0x0>'} module } } // { dg-final { scan-lang-dump {Lazily binding '::bar@bar:.::toto'@'bar' section:} module } } -// { dg-final { scan-lang-dump {>Loading entity foo\[1\] section:1} module } } +// { dg-final { scan-lang-dump {>Loading entity foo\[.\] section:1} module } } // { dg-final { scan-lang-dump {Imported:-[0-9]* template_decl:'::foo@foo:.::template TPL@foo:.'@foo} module } } // { dg-final { scan-lang-dump {Reading definition type_decl '::foo@foo:.::TPL@bar:.<0x0>'} module } } diff --git a/gcc/testsuite/g++.dg/modules/indirect-4_c.C b/gcc/testsuite/g++.dg/modules/indirect-4_c.C index 7efcc11..d55a221 100644 --- a/gcc/testsuite/g++.dg/modules/indirect-4_c.C +++ b/gcc/testsuite/g++.dg/modules/indirect-4_c.C @@ -10,7 +10,7 @@ int main () } // { dg-final { scan-lang-dump {Lazily binding '::bar@bar:.::quux'@'bar' section:} module } } -// { dg-final { scan-lang-dump {>Loading entity foo\[2\] section:1} module } } +// { dg-final { scan-lang-dump {>Loading entity foo\[.\] section:1} module } } // { dg-final { scan-lang-dump {Imported:-[0-9]* template_decl:'::foo@foo:.::template TPL@foo:.'@foo} module } } // { dg-final { scan-lang-dump {Reading definition function_decl '::foo@foo:.::TPL@bar:.<0x1>::frob@bar:.<0x2>'} module } } diff --git a/gcc/testsuite/g++.dg/modules/lambda-3_b.C b/gcc/testsuite/g++.dg/modules/lambda-3_b.C index 25a418b..17afd96 100644 --- a/gcc/testsuite/g++.dg/modules/lambda-3_b.C +++ b/gcc/testsuite/g++.dg/modules/lambda-3_b.C @@ -4,6 +4,6 @@ import "lambda-3_a.H"; // { dg-final { scan-lang-dump-not {merge key \(new\)} module } } -// { dg-final { scan-lang-dump {Read -1\[0\] matched attached decl '::template ._anon_0<#unnamed#>'} module } } -// { dg-final { scan-lang-dump {Read -1\[0\] matched attached decl '::._anon_2'} module } } -// { dg-final { scan-lang-dump {Read -1\[0\] matched attached decl '::._anon_1'} module } } +// { dg-final { scan-lang-dump {Read -[0-9]*\[0\] matched attached decl '::template ._anon_0<#unnamed#>'} module } } +// { dg-final { scan-lang-dump {Read -[0-9]*\[0\] matched attached decl '::._anon_2'} module } } +// { dg-final { scan-lang-dump {Read -[0-9]*\[0\] matched attached decl '::._anon_1'} module } } diff --git a/gcc/testsuite/g++.dg/modules/late-ret-3_c.C b/gcc/testsuite/g++.dg/modules/late-ret-3_c.C index fae9565..8ab23a9 100644 --- a/gcc/testsuite/g++.dg/modules/late-ret-3_c.C +++ b/gcc/testsuite/g++.dg/modules/late-ret-3_c.C @@ -19,4 +19,4 @@ int main () return 0; } -// { dg-final { scan-lang-dump {Read:-1's named merge key \(matched\) template_decl:'::template Foo'\n Deduping '::template Foo@[^\n]*/late-ret-3_a.H:.'\n} module } } +// { dg-final { scan-lang-dump {Read:-[0-9]*'s named merge key \(matched\) template_decl:'::template Foo'\n Deduping '::template Foo@[^\n]*/late-ret-3_a.H:.'\n} module } } diff --git a/gcc/testsuite/g++.dg/modules/pr99283-6.h b/gcc/testsuite/g++.dg/modules/pr99283-6.h new file mode 100644 index 0000000..383b66c --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr99283-6.h @@ -0,0 +1,23 @@ +template +struct conditional; + +template struct incrementable_traits; + +template +struct __iter_traits_impl; + +class __max_diff_type; + +template +concept weakly_incrementable + = __is_same (__iter_traits_impl<_Iter, incrementable_traits<_Iter>>, + __max_diff_type); + +template +class reverse_iterator +{ +public: + using iterator_concept + = typename conditional, + int, int>::type; +}; diff --git a/gcc/testsuite/g++.dg/modules/pr99283-6_a.H b/gcc/testsuite/g++.dg/modules/pr99283-6_a.H new file mode 100644 index 0000000..176ad9e --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr99283-6_a.H @@ -0,0 +1,33 @@ +// { dg-additional-options {-std=c++2a -fmodule-header} } +// { dg-module-cmi {} + +#include "pr99283-6.h" + +template +constexpr bool + operator<(const reverse_iterator<_IteratorL>& __x, + const reverse_iterator<_IteratorR>& __y); + +template + struct numeric_limits; + +class __max_size_type +{ +public: + template + constexpr + __max_size_type(_Tp __i) noexcept + : _M_val(__i), _M_msb(__i < 0) + { } + + using __rep = __UINT64_TYPE__; +private: + __rep _M_val = 0; + unsigned _M_msb:1 = 0; +}; + +class __max_diff_type +{ +private: + __max_size_type _M_rep = 0; +}; diff --git a/gcc/testsuite/g++.dg/modules/pr99283-6_b.H b/gcc/testsuite/g++.dg/modules/pr99283-6_b.H new file mode 100644 index 0000000..123f353 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr99283-6_b.H @@ -0,0 +1,164 @@ +// { dg-additional-options {-std=c++2a -fmodule-header} } +// { dg-module-cmi {} + +#include "pr99283-6.h" + +template +void __addressof(_Tp& __r) ; + +template +struct integral_constant +{ + static constexpr _Tp value = __v; +}; + +template +constexpr _Tp integral_constant<_Tp, __v>::value; + +typedef integral_constant true_type; +typedef integral_constant false_type; + +template +struct __and_ + : public conditional<_B1::value, _B2, _B1>::type +{ }; + +template +struct is_convertible + : public true_type +{ }; + +template +struct enable_if +{ }; + +template +struct enable_if +{ typedef _Tp type; }; + +template +using __enable_if_t = typename enable_if<_Cond, _Tp>::type; + +template +using _Require = __enable_if_t<__and_::value>; + +template +struct conditional +{ typedef _Iftrue type; }; + +template struct iterator_traits; + + +template +constexpr bool + operator!=(const reverse_iterator<_IteratorL>& __x, + const reverse_iterator<_IteratorR>& __y); + +typedef __INT64_TYPE__ int64_t; +typedef int64_t intmax_t; + +template +struct ratio +{ +}; + +namespace chrono +{ +template +struct duration; + +template +constexpr _ToDur + duration_cast(const duration<_Rep>& __d) +{ + typedef typename _ToDur::rep __to_rep; + return _ToDur(static_cast<__to_rep>(static_cast(__d.count()))); +} + +template +struct duration +{ + +public: + using rep = _Rep; + + constexpr duration() = default; + + duration(const duration&) = default; + + template, + true_type>> + constexpr explicit duration(const _Rep2& __rep) + : __r (__rep) {} + + ~duration() = default; + duration& operator=(const duration&) = default; + + rep count() const; + +private: + rep __r; +}; + +using seconds = duration; + +template +struct time_point +{ + typedef _Dur duration; + + duration time_since_epoch() const; + +private: + duration __d; +}; + +struct system_clock +{ + typedef chrono::seconds duration; + + typedef chrono::time_point time_point; + + static void + to_time_t(const time_point& __t) noexcept + { + duration_cast + (__t.time_since_epoch()).count(); + } +}; + +} + +template +class allocator; + +template +constexpr void + __destroy(_ForwardIterator __first, _ForwardIterator __last) +{ + for (; __first != __last; ++__first) + __addressof (*__first); +} + +template +struct allocator_traits +{ +private: + template + static constexpr void + _S_destroy(_Alloc2&, _Tp* __p, ...) + noexcept + { + __destroy(__p); + } +}; + +template +struct allocator_traits> +{ + using value_type = _Tp; + using pointer = _Tp*; +}; + +import "pr99283-6_a.H"; diff --git a/gcc/testsuite/g++.dg/modules/pr99283-6_c.C b/gcc/testsuite/g++.dg/modules/pr99283-6_c.C new file mode 100644 index 0000000..9492554 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr99283-6_c.C @@ -0,0 +1,10 @@ +// { dg-additional-options {-std=c++2a -fmodules-ts} } + +import "pr99283-6_b.H"; + +template +struct __allocated_ptr +{ + using value_type = allocator_traits<_Alloc>; +}; + diff --git a/gcc/testsuite/g++.dg/modules/pr99425-1_b.H b/gcc/testsuite/g++.dg/modules/pr99425-1_b.H index 98303a0..53d28b4 100644 --- a/gcc/testsuite/g++.dg/modules/pr99425-1_b.H +++ b/gcc/testsuite/g++.dg/modules/pr99425-1_b.H @@ -15,5 +15,5 @@ inline void widget (Cont parm) ssize (parm); } -// { dg-final { scan-lang-dump {Read:-[0-9]*'s alias spec merge key \(new\) type_decl:'::make_signed_t'\n ... Read:-[0-9]*'s type spec merge key \(new\) type_decl:'::make_signed'\n Read:-1's named merge key \(matched\) template_decl:'::template ssize'} module } } +// { dg-final { scan-lang-dump {Read:-[0-9]*'s alias spec merge key \(new\) type_decl:'::make_signed_t'\n ... Read:-[0-9]*'s type spec merge key \(new\) type_decl:'::make_signed'\n Read:-[0-9]*'s named merge key \(matched\) template_decl:'::template ssize'} module } } diff --git a/gcc/testsuite/g++.dg/modules/pr99425-1_c.C b/gcc/testsuite/g++.dg/modules/pr99425-1_c.C index 28ef3a1..77a35a8 100644 --- a/gcc/testsuite/g++.dg/modules/pr99425-1_c.C +++ b/gcc/testsuite/g++.dg/modules/pr99425-1_c.C @@ -7,5 +7,5 @@ void frob (Cont parm) ssize (parm); } -// { dg-final { scan-lang-dump {Read:-1's named merge key \(new\) template_decl:'::template ssize'} module } } -// { dg-final { scan-lang-dump {Read:-1's named merge key \(matched\) template_decl:'::template ssize'} module } } +// { dg-final { scan-lang-dump {Read:-[0-9]*'s named merge key \(new\) template_decl:'::template ssize'} module } } +// { dg-final { scan-lang-dump {Read:-[0-9]*'s named merge key \(matched\) template_decl:'::template ssize'} module } } -- cgit v1.1 From 5f00df5925082c7b66da91270f2ed29bf4818c93 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 31 Mar 2021 17:48:50 -0400 Subject: c++: Add ABI version for PR98481 fix The PR98481 fix corrects an ABI regression in GCC 10, but we don't want to introduce an ABI change in the middle of the GCC 10 cycle. This patch introduces ABI v15 for the fix, which will be available but not default in GCC 10.3; the broken behavior remains in ABI v14. Compatibility aliases will not be generated for this change. gcc/ChangeLog: PR c++/98481 * common.opt: Document v15 and v16. gcc/c-family/ChangeLog: PR c++/98481 * c-opts.c (c_common_post_options): Bump latest_abi_version. gcc/cp/ChangeLog: PR c++/98481 * mangle.c (write_expression): Adjust. * class.c (find_abi_tags_r): Disable PR98481 fix for ABI v14. (mark_abi_tags_r): Likewise. gcc/testsuite/ChangeLog: PR c++/98481 * g++.dg/abi/abi-tag24a.C: New test. * g++.dg/abi/macro0.C: Adjust expected value. --- gcc/testsuite/g++.dg/abi/abi-tag24a.C | 18 ++++++++++++++++++ gcc/testsuite/g++.dg/abi/macro0.C | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/abi/abi-tag24a.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/abi/abi-tag24a.C b/gcc/testsuite/g++.dg/abi/abi-tag24a.C new file mode 100644 index 0000000..83f930d --- /dev/null +++ b/gcc/testsuite/g++.dg/abi/abi-tag24a.C @@ -0,0 +1,18 @@ +// PR c++/98481 +// { dg-do compile { target c++11 } } +// { dg-additional-options -fabi-version=14 } +inline namespace N __attribute ((__abi_tag__ ("myabi"))) +{ + struct A {}; +} +template +struct B { typedef int size_type; }; +struct S1 { B::size_type foo () const { return 1; } }; +struct S2 { B::size_type foo () const; }; +int S2::foo () const { return 2; } +int (S1::*f1) () const = &S1::foo; +int (S2::*f2) () const = &S2::foo; + +// { dg-final { scan-assembler-not "_ZNK2S13fooEv" } } +// { dg-final { scan-assembler "_ZNK2S23fooEv" } } +// { dg-final { scan-assembler "_ZNK2S13fooB5myabiEv" } } diff --git a/gcc/testsuite/g++.dg/abi/macro0.C b/gcc/testsuite/g++.dg/abi/macro0.C index 7c3c170..f25f291 100644 --- a/gcc/testsuite/g++.dg/abi/macro0.C +++ b/gcc/testsuite/g++.dg/abi/macro0.C @@ -1,6 +1,6 @@ // This testcase will need to be kept in sync with c_common_post_options. // { dg-options "-fabi-version=0" } -#if __GXX_ABI_VERSION != 1015 +#if __GXX_ABI_VERSION != 1016 #error "Incorrect value of __GXX_ABI_VERSION" #endif -- cgit v1.1 From 0cf4813202f19768e31666f6aa82bde4dce4065a Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 1 Apr 2021 15:17:40 -0400 Subject: c++: variadic lambda noexcept-specifier [PR99583] The tree-walk looking for parameter packs didn't find this one because we weren't stepping into TYPE_RAISES_EXCEPTIONS. gcc/cp/ChangeLog: PR c++/99583 PR c++/99584 * tree.c (cp_walk_subtrees) [FUNCTION_TYPE]: Walk into TYPE_RAISES_EXCEPTIONS. gcc/testsuite/ChangeLog: PR c++/99583 * g++.dg/cpp0x/lambda/lambda-variadic12.C: New test. --- gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic12.C | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic12.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic12.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic12.C new file mode 100644 index 0000000..6746157 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic12.C @@ -0,0 +1,9 @@ +// PR c++/99583 +// { dg-do compile { target c++11 } } + +void f(...); + +template +void g() { + f([]() noexcept(B) {} ...); +} -- cgit v1.1 From 6a60ffc297b9d4903543a25538e62e7fb39420a9 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Thu, 1 Apr 2021 10:42:43 -0400 Subject: c++: GC collects live data when synthesizing operator== [PR99831] Here we crash in reshape_init because we're accessing ggc_freed & poisoned data: since r277865 in defaulted_late_check we call synthesize_method here: if (kind == sfk_comparison) { /* If the function was declared constexpr, check that the definition qualifies. Otherwise we can define the function lazily. */ if (DECL_DECLARED_CONSTEXPR_P (fn) && !DECL_INITIAL (fn)) synthesize_method (fn); return; } which in this test triggers when we're processing the string<"a">{} in the static_assert. First, we create a CONSTRUCTOR for the "{}" in cp_parser_functional_cast, then we call finish_compound_literal which calls complete_type and that results in garbage collection, which then frees the CONSTRUCTOR {} we created when parsing the braced-list in string<"a">{} -- at this point, it's not referenced by anything. (That's not the case for 'type' in finish_compound_literal: the symbol table contains a node for operator==, so ggc_mark_roots goes and marks the fn decl, its type, its arguments etc., as used, so we don't collect it.) We could just bump function_depth around the new call to synthesize_method to prevent GC. gcc/cp/ChangeLog: PR c++/99831 * method.c (defaulted_late_check): ++ and -- function_depth around the call to synthesize_method. * pt.c: Remove the saved_trees global. gcc/testsuite/ChangeLog: PR c++/99831 * g++.dg/other/gc6.C: New test. --- gcc/testsuite/g++.dg/other/gc6.C | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 gcc/testsuite/g++.dg/other/gc6.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/other/gc6.C b/gcc/testsuite/g++.dg/other/gc6.C new file mode 100644 index 0000000..ff45dd3 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/gc6.C @@ -0,0 +1,16 @@ +// PR c++/99831 +// { dg-do compile { target c++20 } } +// { dg-options "--param ggc-min-heapsize=0 --param ggc-min-expand=0" } + +template struct S { + constexpr S(const char (&str)[N]) : value{} { } + char value[N]; +}; +template struct string { + constexpr bool operator==(const string &) const = default; +}; +template void operator+(string) { + char value[1]; + S{value}; +} +static_assert(string<"a">{} == string<"a">{}); -- cgit v1.1 From f1607029aea3043f7bd4f86c005e0997795f5ffd Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 2 Apr 2021 00:16:26 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 56 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3523bf0..de21a1d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,59 @@ +2021-04-01 Marek Polacek + + PR c++/99831 + * g++.dg/other/gc6.C: New test. + +2021-04-01 Jason Merrill + + PR c++/99583 + * g++.dg/cpp0x/lambda/lambda-variadic12.C: New test. + +2021-04-01 Jason Merrill + + PR c++/98481 + * g++.dg/abi/abi-tag24a.C: New test. + * g++.dg/abi/macro0.C: Adjust expected value. + +2021-04-01 Nathan Sidwell + + PR c++/99283 + * g++.dg/modules/pr99283-6.h: New. + * g++.dg/modules/pr99283-6_a.H: New. + * g++.dg/modules/pr99283-6_b.H: New. + * g++.dg/modules/pr99283-6_c.C: New. + * g++.dg/modules/hdr-init-1_c.C: Adjust scan. + * g++.dg/modules/indirect-3_c.C: Adjust scan. + * g++.dg/modules/indirect-4_c.C: Adjust scan. + * g++.dg/modules/lambda-3_b.C: Adjust scan. + * g++.dg/modules/late-ret-3_c.C: Adjust scan. + * g++.dg/modules/pr99425-1_b.H: Adjust scan. + * g++.dg/modules/pr99425-1_c.C: Adjust scan. + +2021-04-01 Jan Hubicka + + PR ipa/98265 + * gcc.dg/tree-ssa/pr98265.C: New test. + +2021-04-01 Jakub Jelinek + + PR tree-optimization/96573 + * gcc.dg/pr96573.c: New test. + +2021-04-01 Richard Biener + + PR tree-optimization/99856 + * gcc.dg/vect/pr99856.c: New testcase. + +2021-04-01 Martin Jambor + + PR tree-optimization/97009 + * gcc.dg/tree-ssa/pr97009.c: New test. + +2021-04-01 Harald Anlauf + + PR fortran/99840 + * gfortran.dg/transpose_5.f90: New test. + 2021-03-31 David Malcolm PR analyzer/99771 -- cgit v1.1 From e53c0696113cced90561e79ade27445f6c0926d0 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 2 Apr 2021 10:07:50 +0200 Subject: testsuite: Fix up gcc.target/i386/pr99726.c test [PR99726] -m32 shouldn't be used in gcc.target/i386/ testcases, people do test with -m32/-m64 to get 32-bit compilation tested. And, -floop-nest-optimize is a graphite optimization, so might not be enabled in all gcc builds. 2021-04-02 Jakub Jelinek PR tree-optimization/99726 * gcc.target/i386/pr99726.c: Remove -m32 from dg-options. Move -floop-nest-optimize to dg-additional-options guarded on fgraphite effective target. --- gcc/testsuite/gcc.target/i386/pr99726.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/i386/pr99726.c b/gcc/testsuite/gcc.target/i386/pr99726.c index ff19bca..98ccce6 100644 --- a/gcc/testsuite/gcc.target/i386/pr99726.c +++ b/gcc/testsuite/gcc.target/i386/pr99726.c @@ -1,4 +1,5 @@ -/* { dg-options "-flive-patching=inline-clone -mavx512f -O2 -floop-nest-optimize -ftree-loop-vectorize -ftrapv -m32" } */ +/* { dg-options "-flive-patching=inline-clone -mavx512f -O2 -ftree-loop-vectorize -ftrapv" } */ +/* { dg-additional-options "-floop-nest-optimize" { target fgraphite } } */ extern int a[256][1024]; int b; -- cgit v1.1 From f1f7e54fb30295966da20d7e63ca25e42d2790b8 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Fri, 2 Apr 2021 10:44:08 +0200 Subject: Skip couple of Go tests on 32-bit SPARC Since they are already skipped on other 32-bit architectures. gcc/testsuite/ * go.test/test/fixedbugs/issue6036.go: Skip on sparc. * go.test/test/fixedbugs/issue22200b.go: Likewise. --- gcc/testsuite/go.test/test/fixedbugs/issue22200b.go | 2 +- gcc/testsuite/go.test/test/fixedbugs/issue6036.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue22200b.go b/gcc/testsuite/go.test/test/fixedbugs/issue22200b.go index ce20923..5c2d7ca 100644 --- a/gcc/testsuite/go.test/test/fixedbugs/issue22200b.go +++ b/gcc/testsuite/go.test/test/fixedbugs/issue22200b.go @@ -4,7 +4,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !386,!amd64p32,!arm,!mips,!mipsle +// +build !386,!amd64p32,!arm,!mips,!mipsle,!sparc package p diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue6036.go b/gcc/testsuite/go.test/test/fixedbugs/issue6036.go index 8ebef5a..0bac74d 100644 --- a/gcc/testsuite/go.test/test/fixedbugs/issue6036.go +++ b/gcc/testsuite/go.test/test/fixedbugs/issue6036.go @@ -1,4 +1,4 @@ -// +build !386,!arm,!mips,!mipsle,!amd64p32 +// +build !386,!arm,!mips,!mipsle,!amd64p32,!sparc // compile // Copyright 2013 The Go Authors. All rights reserved. -- cgit v1.1 From f4e05eebd6aac6118cbd9e0a04c011b6ed682826 Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Fri, 2 Apr 2021 06:28:29 -0700 Subject: c++: header unit purview [PR 99283] This case occurs due to some equivocation about module_purview. Header-unit building is treated as a module-purview, but we should not treat entities imported from that as module purview. (header units were not a thing when I started). The testcase didn't understand we had a local textual definition, but it was (incorrectly) marked as module-purview, because we'd read in a declaration from a header unit too. gcc/cp/ * cp-tree.h (lang_decl_base): Correct module flag comment. * module.cc (trees_in::assert_definition): Break out not_tmpl var. (trees_out::lang_decl_bools): Do not write purview for header units. gcc/testsuite/ * g++.dg/modules/pr99283-6_d.H: New. * g++.dg/modules/pr99283-7-swap.h: New. * g++.dg/modules/pr99283-7-traits.h: New. * g++.dg/modules/pr99283-7_a.H: New. * g++.dg/modules/pr99283-7_b.H: New. * g++.dg/modules/pr99283-7_c.C: New. * g++.dg/modules/pr99283-7_d.H: New. --- gcc/testsuite/g++.dg/modules/pr99283-6_d.H | 10 +++ gcc/testsuite/g++.dg/modules/pr99283-7-swap.h | 17 +++++ gcc/testsuite/g++.dg/modules/pr99283-7-traits.h | 41 +++++++++++ gcc/testsuite/g++.dg/modules/pr99283-7_a.H | 97 +++++++++++++++++++++++++ gcc/testsuite/g++.dg/modules/pr99283-7_b.H | 4 + gcc/testsuite/g++.dg/modules/pr99283-7_c.C | 8 ++ gcc/testsuite/g++.dg/modules/pr99283-7_d.H | 8 ++ 7 files changed, 185 insertions(+) create mode 100644 gcc/testsuite/g++.dg/modules/pr99283-6_d.H create mode 100644 gcc/testsuite/g++.dg/modules/pr99283-7-swap.h create mode 100644 gcc/testsuite/g++.dg/modules/pr99283-7-traits.h create mode 100644 gcc/testsuite/g++.dg/modules/pr99283-7_a.H create mode 100644 gcc/testsuite/g++.dg/modules/pr99283-7_b.H create mode 100644 gcc/testsuite/g++.dg/modules/pr99283-7_c.C create mode 100644 gcc/testsuite/g++.dg/modules/pr99283-7_d.H (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/modules/pr99283-6_d.H b/gcc/testsuite/g++.dg/modules/pr99283-6_d.H new file mode 100644 index 0000000..e811471 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr99283-6_d.H @@ -0,0 +1,10 @@ +// { dg-additional-options {-std=c++2a -fmodule-header} } + +import "pr99283-6_b.H"; + +template +struct __allocated_ptr +{ + using value_type = allocator_traits<_Alloc>; +}; + diff --git a/gcc/testsuite/g++.dg/modules/pr99283-7-swap.h b/gcc/testsuite/g++.dg/modules/pr99283-7-swap.h new file mode 100644 index 0000000..d725fea --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr99283-7-swap.h @@ -0,0 +1,17 @@ +template +constexpr typename remove_reference<_Tp>::type&& + move(_Tp&& __t) noexcept; + +template +constexpr inline +typename enable_if<__and_<__not_<__is_tuple_like<_Tp>>, + is_move_constructible<_Tp>, + is_move_assignable<_Tp>>::value>::type + swap(_Tp& __a, _Tp& __b) + noexcept(__and_, + is_nothrow_move_assignable<_Tp>>::value) +{ + _Tp __tmp = move(__a); + __a = move(__b); + __b = move(__tmp); +} diff --git a/gcc/testsuite/g++.dg/modules/pr99283-7-traits.h b/gcc/testsuite/g++.dg/modules/pr99283-7-traits.h new file mode 100644 index 0000000..8f6bce0 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr99283-7-traits.h @@ -0,0 +1,41 @@ +template +struct __and_; + +template +struct __not_; + +template +struct is_move_constructible; + +template +struct is_nothrow_move_constructible; + +template +struct is_move_assignable; + +template +struct is_nothrow_move_assignable; + +template +struct remove_reference; + +template +struct enable_if; + +template +using __enable_if_t = typename enable_if<_Cond, _Tp>::type; + +template +using _Require = __enable_if_t<__and_<_Cond...>::value>; + +template +struct __is_tuple_like; + +template +constexpr inline + _Require<__not_<__is_tuple_like<_Tp>>, + is_move_constructible<_Tp>, + is_move_assignable<_Tp>> +swap(_Tp&, _Tp&) + noexcept(__and_, + is_nothrow_move_assignable<_Tp>>::value); diff --git a/gcc/testsuite/g++.dg/modules/pr99283-7_a.H b/gcc/testsuite/g++.dg/modules/pr99283-7_a.H new file mode 100644 index 0000000..b52d44d --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr99283-7_a.H @@ -0,0 +1,97 @@ +// PR 99283, +// { dg-additional-options "-std=c++2a -fmodule-header" } +// { dg-module-cmi {} } + +#include "pr99283-7-traits.h" + +template +struct char_traits; + +template> +class basic_string; + +typedef basic_string string; + +template +struct integral_constant +{ + static constexpr _Tp value = __v; + typedef _Tp value_type; + typedef integral_constant<_Tp, __v> type; + constexpr operator value_type() const noexcept { return value; } + constexpr value_type operator()() const noexcept { return value; } +}; + +template +constexpr _Tp integral_constant<_Tp, __v>::value; + +typedef integral_constant true_type; + +typedef integral_constant false_type; + +template +using __bool_constant = integral_constant; + +template +_Up __declval(int); + +template +_Tp __declval(long); + +template +auto declval() noexcept -> decltype(__declval<_Tp>(0)); + +struct __do_is_nothrow_swappable_impl +{ + template + static __bool_constant< + noexcept(swap(declval<_Tp&>(), declval<_Tp&>())) + > __test(int); +}; + + + +template +struct __is_nothrow_swappable_impl + : public __do_is_nothrow_swappable_impl +{ + typedef decltype(__test<_Tp>(0)) type; +}; + +template +struct __is_nothrow_swappable + : public __is_nothrow_swappable_impl<_Tp>::type +{ }; + +#include "pr99283-7-swap.h" + +class partial_ordering +{ +public: + friend constexpr bool + operator==(partial_ordering, partial_ordering) noexcept = default; +}; + +class strong_ordering +{ +public: + constexpr operator partial_ordering() const noexcept; +}; + +template +struct pair +{ + constexpr void + swap(pair& __p) + noexcept(__is_nothrow_swappable<_T1>::value); +}; + +template +inline constexpr bool + operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y); + +template +struct char_traits +{ + using comparison_category = strong_ordering; +}; diff --git a/gcc/testsuite/g++.dg/modules/pr99283-7_b.H b/gcc/testsuite/g++.dg/modules/pr99283-7_b.H new file mode 100644 index 0000000..50c780e --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr99283-7_b.H @@ -0,0 +1,4 @@ +// { dg-additional-options "-std=c++2a -fmodule-header" } +// { dg-module-cmi {} } + +#include "pr99283-7-traits.h" diff --git a/gcc/testsuite/g++.dg/modules/pr99283-7_c.C b/gcc/testsuite/g++.dg/modules/pr99283-7_c.C new file mode 100644 index 0000000..195bc68 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr99283-7_c.C @@ -0,0 +1,8 @@ +// { dg-additional-options "-std=c++2a -fmodules-ts" } +import "pr99283-7_b.H"; + +#include "pr99283-7-swap.h" + +import "pr99283-7_a.H"; + +void Xlocale(const string& __s); diff --git a/gcc/testsuite/g++.dg/modules/pr99283-7_d.H b/gcc/testsuite/g++.dg/modules/pr99283-7_d.H new file mode 100644 index 0000000..ef4934b --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr99283-7_d.H @@ -0,0 +1,8 @@ +// { dg-additional-options "-std=c++2a -fmodule-header" } +import "pr99283-7_b.H"; + +#include "pr99283-7-swap.h" + +import "pr99283-7_a.H"; + +void Xlocale(const string& __s); -- cgit v1.1 From 2a26351b598242c2fbce95d2a0baacce0084aec6 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 2 Apr 2021 11:05:46 -0400 Subject: c++: lambda pack init-capture within generic lambda We represent the type of a pack init-capture as auto... with packs from the initializer stuck into PACK_EXPANSION_PARAMETER_PACKS so that expanding it produces the right number of elements. But when partially instantiating the auto..., we were changing PACK_EXPANSION_PARAMETER_PACKS to refer to only the auto itself. Fixed thus. gcc/cp/ChangeLog: PR c++/97938 * cp-tree.h (PACK_EXPANSION_AUTO_P): New. * lambda.c (add_capture): Set it. * pt.c (tsubst_pack_expansion): Handle it. gcc/testsuite/ChangeLog: PR c++/97938 * g++.dg/cpp2a/lambda-pack-init6.C: New test. --- gcc/testsuite/g++.dg/cpp2a/lambda-pack-init6.C | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp2a/lambda-pack-init6.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp2a/lambda-pack-init6.C b/gcc/testsuite/g++.dg/cpp2a/lambda-pack-init6.C new file mode 100644 index 0000000..3ee500e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/lambda-pack-init6.C @@ -0,0 +1,27 @@ +// PR c++/97938 +// { dg-do compile { target c++20 } } + +template +int sink(Args&&... args) { return 2; } + +auto fwd1(const auto&&... ts1) { + return + [...ts1 = ts1] { + return sink(ts1...); + }(); +} + +template +auto fwd2(const T1& t1) { + return + [] (auto&&... ts1) { + return + [...ts1 = ts1] { + return sink(ts1...); + }(); + }(); +} + +int main() { + return fwd1() + fwd2(1); +} -- cgit v1.1 From cf25e27faef75e265e659f39ef6b7d0f1695dfeb Mon Sep 17 00:00:00 2001 From: Patrick Palka Date: Fri, 2 Apr 2021 19:47:09 -0400 Subject: c++: Refine check for CTAD placeholder [PR99586] In the below testcase, during finish_compound_literal for A{}, type_uses_auto finds and returns the CTAD placeholder for B{V}, which tricks us into attempting CTAD on A{} and leads to bogus errors. AFAICT 'type' will always be a bare 'auto' in the CTAD case so we don't need to look deeply to find it; checking template_placeholder_p instead should suffice here. gcc/cp/ChangeLog: PR c++/99586 * semantics.c (finish_compound_literal): Check template_placeholder_p instead of type_uses_auto. gcc/testsuite/ChangeLog: PR c++/99586 * g++.dg/cpp2a/nontype-class42.C: New test. --- gcc/testsuite/g++.dg/cpp2a/nontype-class42.C | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp2a/nontype-class42.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-class42.C b/gcc/testsuite/g++.dg/cpp2a/nontype-class42.C new file mode 100644 index 0000000..c2e04b2 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/nontype-class42.C @@ -0,0 +1,8 @@ +// PR c++/99586 +// { dg-do compile { target c++20 } } + +template +struct B { constexpr B(T); }; + +template struct A{}; +template auto a = A{}; -- cgit v1.1 From 260caabe10cde0158b87968a3bac85575301dafa Mon Sep 17 00:00:00 2001 From: Patrick Palka Date: Fri, 2 Apr 2021 19:46:24 -0400 Subject: c++: placeholder type constraint inside range-for [PR99869] In the testcase below, during ahead-of-time deduction of a constrained auto inside a range-based for loop, we trip over an assert within do_auto_deduction which expects the deduction context to be adc_return_type or adc_variable_type, but do_range_for_auto_deduction calls do_auto_deduction with the context defaulted to adc_unspecified. We could safely relax the assert to also accept adc_unspecified, but it seems the deduction context should really be adc_variable_type here. gcc/cp/ChangeLog: PR c++/99869 * parser.c (do_range_for_auto_deduction): Pass adc_variable_type to do_auto_deduction. gcc/testsuite/ChangeLog: PR c++/99869 * g++.dg/cpp2a/concepts-placeholder6.C: New test. --- gcc/testsuite/g++.dg/cpp2a/concepts-placeholder6.C | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp2a/concepts-placeholder6.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-placeholder6.C b/gcc/testsuite/g++.dg/cpp2a/concepts-placeholder6.C new file mode 100644 index 0000000..fe1e392 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/concepts-placeholder6.C @@ -0,0 +1,10 @@ +// PR c++/99869 +// { dg-do compile { target c++20 } } + +template concept same_as = __is_same(T, U); + +template +void f() { + for (same_as auto c : "") {} // { dg-error "constraint" } + for (same_as auto c : "") {} +} -- cgit v1.1 From b7c1f3d66cfc171bc4e779068530101fb2f197f1 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 3 Apr 2021 00:16:28 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index de21a1d..da72ee3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,40 @@ +2021-04-02 Patrick Palka + + PR c++/99869 + * g++.dg/cpp2a/concepts-placeholder6.C: New test. + +2021-04-02 Patrick Palka + + PR c++/99586 + * g++.dg/cpp2a/nontype-class42.C: New test. + +2021-04-02 Jason Merrill + + PR c++/97938 + * g++.dg/cpp2a/lambda-pack-init6.C: New test. + +2021-04-02 Nathan Sidwell + + * g++.dg/modules/pr99283-6_d.H: New. + * g++.dg/modules/pr99283-7-swap.h: New. + * g++.dg/modules/pr99283-7-traits.h: New. + * g++.dg/modules/pr99283-7_a.H: New. + * g++.dg/modules/pr99283-7_b.H: New. + * g++.dg/modules/pr99283-7_c.C: New. + * g++.dg/modules/pr99283-7_d.H: New. + +2021-04-02 Eric Botcazou + + * go.test/test/fixedbugs/issue6036.go: Skip on sparc. + * go.test/test/fixedbugs/issue22200b.go: Likewise. + +2021-04-02 Jakub Jelinek + + PR tree-optimization/99726 + * gcc.target/i386/pr99726.c: Remove -m32 from dg-options. Move + -floop-nest-optimize to dg-additional-options guarded on fgraphite + effective target. + 2021-04-01 Marek Polacek PR c++/99831 -- cgit v1.1 From 23be03a0f243a084a0fe03d0b96a3d045e1a2b65 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 2 Apr 2021 14:49:15 -0400 Subject: c++: dependent attribute on parameter [PR97900] We were copying attributes from the template to the instantiation without considering that they might be dependent. To make sure that the new parms have the appropriate properties for the code pattern, let's just regenerate them. gcc/cp/ChangeLog: PR c++/97900 * pt.c (regenerate_decl_from_template): tsubst_decl the parms. gcc/testsuite/ChangeLog: PR c++/97900 * g++.dg/ext/vector40.C: New test. --- gcc/testsuite/g++.dg/ext/vector40.C | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 gcc/testsuite/g++.dg/ext/vector40.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/ext/vector40.C b/gcc/testsuite/g++.dg/ext/vector40.C new file mode 100644 index 0000000..885afb0 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/vector40.C @@ -0,0 +1,10 @@ +// PR c++/97900 + +template +T test(T __attribute__((vector_size(2 * sizeof(T)))) vec) { + return vec[0] + vec[1]; +} +typedef int v2si __attribute__((vector_size(2 * sizeof(int)))); +int run(v2si vec) { + return test(vec); +} -- cgit v1.1 From 7c3ba2145ceddb0fd7f85fbf27f8db81896527d1 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 2 Apr 2021 17:07:12 -0400 Subject: c++: PMF template parm and noexcept [PR90664] The constexpr code only wants to preserve PTRMEM_CST in conversions if the conversions are only qualification conversions; dropping noexcept counts as a qualification adjustment in overload resolution, so let's include it here. gcc/cp/ChangeLog: PR c++/90664 * cvt.c (can_convert_qual): Check fnptr_conv_p. gcc/testsuite/ChangeLog: PR c++/90664 * g++.dg/cpp1z/noexcept-type24.C: New test. --- gcc/testsuite/g++.dg/cpp1z/noexcept-type24.C | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1z/noexcept-type24.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp1z/noexcept-type24.C b/gcc/testsuite/g++.dg/cpp1z/noexcept-type24.C new file mode 100644 index 0000000..df16ea7 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/noexcept-type24.C @@ -0,0 +1,22 @@ +// PR c++/90664 +// { dg-do compile { target c++11 } } + +template struct OpM; + +template +struct OpM +{}; + +class Class { +public: + int address() noexcept { return 0; } + void address(int) noexcept {} +}; + +struct Sk { + template Sk(R (C::*p)()) { + typedef OpM OP; + } +}; + +Sk sk(static_cast(&Class::address)); -- cgit v1.1 From 04771106cda8dca2c8b975fd4648933679455b8f Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Sat, 3 Apr 2021 01:07:36 -0400 Subject: c++: NRV in lambda in template [PR91217] tsubst_lambda_expr was producing a function with two blocks that claimed to be the outermost block in the function body, one from the call to start_lambda_function in tsubst_lambda_expr, and one from tsubsting the block added by start_lambda_function when we first parsed the lambda. This messed with the named return value optimization, which only works for variables in the outermost block. gcc/cp/ChangeLog: PR c++/91217 * pt.c (tsubst_lambda_expr): Skip the body block from DECL_SAVED_TREE. gcc/testsuite/ChangeLog: PR c++/91217 * g++.dg/opt/nrv20.C: New test. --- gcc/testsuite/g++.dg/opt/nrv20.C | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 gcc/testsuite/g++.dg/opt/nrv20.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/opt/nrv20.C b/gcc/testsuite/g++.dg/opt/nrv20.C new file mode 100644 index 0000000..ade0c28 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/nrv20.C @@ -0,0 +1,20 @@ +// PR c++/91217 +// { dg-do compile { target c++11 } } +// { dg-additional-options -fdump-tree-gimple } +// { dg-final { scan-tree-dump-not " = a" "gimple" } } + +struct A +{ + int ar[42]; +}; + +template +A f() +{ + return [] { A a; return a; }(); +} + +int main() +{ + f(); +} -- cgit v1.1 From b680b9049737198d010e49cf434704c6a6ed2b3f Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Sat, 3 Apr 2021 10:03:15 +0200 Subject: rs6000: Avoid -fpatchable-function-entry* regressions on powerpc64 be [PR98125] The SECTION_LINK_ORDER changes broke powerpc64-linux ELFv1. Seems that the assembler/linker relies on the symbol mentioned for the "awo" section to be in the same section as the symbols mentioned in the relocations in that section (i.e. labels for the patchable area in this case). That is the case for most targets, including powerpc-linux 32-bit or powerpc64 ELFv2 (that one has -fpatchable-function-entry* support broken for other reasons and it doesn't seem to be a regression). But it doesn't work on powerpc64-linux ELFv1. We emit: .section ".opd","aw" .align 3 _Z3foov: .quad .L._Z3foov,.TOC.@tocbase,0 .previous .type _Z3foov, @function .L._Z3foov: .section __patchable_function_entries,"awo",@progbits,_Z3foov .align 3 .8byte .LPFE1 .section .text._Z3foov,"axG",@progbits,_Z3foov,comdat .LPFE1: nop .LFB0: .cfi_startproc and because _Z3foov is in the .opd section rather than the function text section, it doesn't work. I'm afraid I don't know what exactly should be done, whether e.g. it could use .section __patchable_function_entries,"awo",@progbits,.L._Z3foov instead, or whether the linker should be changed to handle it as is, or something else. But because we have a P1 regression that didn't see useful progress over the 4 months since it has been filed and we don't really have much time, below is an attempt to do a targetted reversion of H.J's patch, basically act as if HAVE_GAS_SECTION_LINK_ORDER is never true for powerpc64-linux ELFv1, but for 32-bit or 64-bit ELFv2 keep working as is. This would give us time to resolve it for GCC 12 properly. 2021-04-03 Jakub Jelinek PR testsuite/98125 * targhooks.h (default_print_patchable_function_entry_1): Declare. * targhooks.c (default_print_patchable_function_entry_1): New function, copied from default_print_patchable_function_entry with an added flags argument. (default_print_patchable_function_entry): Rewritten into a small wrapper around default_print_patchable_function_entry_1. * config/rs6000/rs6000.c (TARGET_ASM_PRINT_PATCHABLE_FUNCTION_ENTRY): Redefine. (rs6000_print_patchable_function_entry): New function. * g++.dg/pr93195a.C: Skip on powerpc*-*-* 64-bit. --- gcc/testsuite/g++.dg/pr93195a.C | 1 + 1 file changed, 1 insertion(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/pr93195a.C b/gcc/testsuite/g++.dg/pr93195a.C index 26d265d..b14f1b3 100644 --- a/gcc/testsuite/g++.dg/pr93195a.C +++ b/gcc/testsuite/g++.dg/pr93195a.C @@ -1,4 +1,5 @@ /* { dg-do link { target { ! { nvptx*-*-* visium-*-* } } } } */ +/* { dg-skip-if "not supported" { { powerpc*-*-* } && lp64 } } */ // { dg-require-effective-target o_flag_in_section } /* { dg-options "-O0 -fpatchable-function-entry=1" } */ /* { dg-additional-options "-fno-pie" { target sparc*-*-* } } */ -- cgit v1.1 From 9c7473688e78dc41fd4312a983453df195dd7786 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Sat, 3 Apr 2021 10:07:09 +0200 Subject: dse: Fix up hard reg conflict checking in replace_read [PR99863] Since PR37922 fix RTL DSE has hard register conflict checking in replace_read, so that if the replacement sequence sets (or typically just clobbers) some hard register (usually condition codes) we verify that hard register is not live. Unfortunately, it compares the hard reg set clobbered/set by the sequence (regs_set) against the currently live hard register set, but it then emits the insn sequence not at the current insn position, but before store_insn->insn. So, we should not compare against the current live hard register set, but against the hard register live set at the point of the store insn. Fortunately, we already have that remembered in store_insn->fixed_regs_live. In addition to bootstrapping/regtesting this patch on x86_64-linux and i686-linux, I've also added statistics gathering and it seems the only place where we end up rejecting the replace_read is the newly added testcase (the PR37922 is no longer effective at that) and fixed_regs_live has been always non-NULL at the if (store_insn->fixed_regs_live) spot. Rather than having there an assert, I chose to just keep regs_set as is, which means in that hypothetical case where fixed_regs_live wouldn't be computed for some store we'd still accept sequences that don't clobber/set any hard registers and just punt on those that clobber/set those. 2021-04-03 Jakub Jelinek PR rtl-optimization/99863 * dse.c (replace_read): Drop regs_live argument. Instead of regs_live, use store_insn->fixed_regs_live if non-NULL, otherwise punt if insns sequence clobbers or sets any hard registers. * gcc.target/i386/pr99863.c: New test. --- gcc/testsuite/gcc.target/i386/pr99863.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr99863.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/i386/pr99863.c b/gcc/testsuite/gcc.target/i386/pr99863.c new file mode 100644 index 0000000..3d9d405 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr99863.c @@ -0,0 +1,33 @@ +/* PR rtl-optimization/99863 */ +/* { dg-do run } */ +/* { dg-options "-O -fno-tree-forwprop -mno-sse2 -Wno-psabi" } */ + +typedef unsigned char __attribute__((__vector_size__ (8))) A; +typedef unsigned char __attribute__((__vector_size__ (32))) B; +typedef unsigned char __attribute__((__vector_size__ (64))) C; +typedef unsigned int __attribute__((__vector_size__ (32))) D; +typedef unsigned int __attribute__((__vector_size__ (64))) E; +typedef unsigned long long F; + +D a; +A b; + +A +foo (E x, F y) +{ + D c = (y <= 0) * a; + x *= (0 < y); + C d = (C) x; + B e = ((union { C a; B b[2];}) d).b[0] + (B) c; + A f = ((union { B a; A b[4];}) e).b[0] + (A) b; + return f; +} + +int +main () +{ + F x = (F) foo ((E) { 3 }, 5); + if (x != 3) + __builtin_abort (); + return 0; +} -- cgit v1.1 From a40015780f8cc49476741b6914bd5ee97bd10f1d Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Sat, 3 Apr 2021 10:08:08 +0200 Subject: bswap: Fix up bswap_view_convert after the recent change [PR99882] Martin reported that my recent change to allow pointer types in bswap broke valgrind. The bswap_view_convert function used for the initialization of vector CONSTRUCTOR from the identity or byte-swapped pieces unfortunately didn't handle pointer types. The following patch handles it there. 2021-04-03 Jakub Jelinek PR tree-optimization/99882 * gimple-ssa-store-merging.c (bswap_view_convert): Handle val with pointer type. * gcc.dg/pr99882.c: New test. --- gcc/testsuite/gcc.dg/pr99882.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr99882.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/pr99882.c b/gcc/testsuite/gcc.dg/pr99882.c new file mode 100644 index 0000000..ebc074f --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr99882.c @@ -0,0 +1,37 @@ +/* PR tree-optimization/99882 */ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +void +foo (char *p, void *q) +{ + __INTPTR_TYPE__ i = (__INTPTR_TYPE__) q; + p[2] = i; + i >>= 8; + p[3] = i; + i >>= 8; + p[4] = i; + i >>= 8; + p[5] = i; + i >>= 8; + p[6] = i; + i >>= 8; + p[7] = i; + i >>= 8; + p[8] = i; + i >>= 8; + p[9] = i; +} + +void +bar (char *p, void *q) +{ + __INTPTR_TYPE__ i = (__INTPTR_TYPE__) q; + p[2] = i; + i >>= 8; + p[3] = i; + i >>= 8; + p[4] = i; + i >>= 8; + p[5] = i; +} -- cgit v1.1 From fc27115d6107f219e6f3dc610c99210005fe9dc5 Mon Sep 17 00:00:00 2001 From: Paul Thomas Date: Sat, 3 Apr 2021 12:49:50 +0100 Subject: Fortran: Fix ICE on wrong code [PR99818]. 2021-04-03 Paul Thomas gcc/fortran/ChangeLog PR fortran/99818 * interface.c (compare_parameter): The codimension attribute is applied to the _data field of class formal arguments. gcc/testsuite/ChangeLog PR fortran/99818 * gfortran.dg/coarray_48.f90: New test. --- gcc/testsuite/gfortran.dg/coarray_48.f90 | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/coarray_48.f90 (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gfortran.dg/coarray_48.f90 b/gcc/testsuite/gfortran.dg/coarray_48.f90 new file mode 100644 index 0000000..adec014 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/coarray_48.f90 @@ -0,0 +1,24 @@ +! { dg-do compile } +! { dg-options "-fcoarray=lib" } +! +! Fix for P99818 in which wrong code caused an ICE. +! +! Contributed by Gerhard Steinmetz +! +module m + type t + integer :: a + contains + procedure :: s + end type +contains + subroutine s(x) + class(t) :: x[*] + end +end +program p + use m + associate (y => t(1)) + call y%s ! { dg-error "must be a coarray" } + end associate +end -- cgit v1.1 From a809d8a737da1ccebcd93065fc57fc0f4d94894a Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Fri, 2 Apr 2021 17:11:32 -0400 Subject: c++: GC during late parsing collects live data [PR91416] Coming back to : This is a crash that points to a GC problem. Consider this test: __attribute__ ((unused)) struct S { S() { } } s; We're parsing a simple-declaration. While parsing the decl specs, we parse the attribute, which means creating a TREE_LIST using ggc_alloc_*. A function body is a complete-class context so when parsing the member-specification of this class-specifier, we parse the bodies of the functions we'd queued in cp_parser_late_parsing_for_member. This then leads to this call chain: cp_parser_function_definition_after_declarator -> expand_or_defer_fn -> expand_or_defer_fn_1 -> maybe_clone_body -> expand_or_defer_fn -> cgraph_node::finalize_function -> ggc_collect. In this test, the ggc_collect call collects the TREE_LIST we had allocated, and a crash duly ensues. I couldn't do what Richard suggested, that is, attach the attribute list to struct S, because we don't pass decl_specs from cp_parser_type_specifier down to cp_parser_class_specifier. Therefore I've attempted to do "push the decl_specifiers onto a vec that is a GC root", except I couldn't really push the decl_specifiers, because first I'd have to mark cp_decl_specifier_seq with GTY(()) and even that wouldn't be enough for me to be able to create static GTY(()) vec But here we only care about cp_decl_specifier_seq::attributes, so the patch is just this. I've also extended the test so now we test a nested class too. gcc/cp/ChangeLog: PR c++/91416 * parser.c: Create a GC root for attributes in a decl specifier. (cp_parser_type_specifier): Push/pop ->attributes onto/from it. gcc/testsuite/ChangeLog: PR c++/91416 * g++.dg/other/gc7.C: New test. --- gcc/testsuite/g++.dg/other/gc7.C | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 gcc/testsuite/g++.dg/other/gc7.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/other/gc7.C b/gcc/testsuite/g++.dg/other/gc7.C new file mode 100644 index 0000000..ab436ba --- /dev/null +++ b/gcc/testsuite/g++.dg/other/gc7.C @@ -0,0 +1,16 @@ +// PR c++/91416 - GC during late parsing collects live data. +// { dg-do compile } +// { dg-options "--param ggc-min-heapsize=0 --param ggc-min-expand=0" } + +__attribute__ ((unused)) struct S { + S() { } +} s; + +__attribute__ ((unused)) struct X { + void fn () + { + __attribute__ ((unused)) struct N { + N() { } + } n; + } +} x; -- cgit v1.1 From 5bba3415ec251820ba0c9533aef1bef919dfbfdd Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Sat, 3 Apr 2021 19:54:37 -0300 Subject: silence expected psabi warning in ipa-sra-19 on ppc-vxworks The default CPU for our ppc-vx7r2 toolchain has no support for altivec or vsx, so an ABI without vector support is selected. The selected calling conventions do not cover passing or returning vector types, so -Wpsabi warns about such uses. powerpc-ibm-aix* already silences these warnings with -Wno-psabi; this patch extends that to powerpc-wrs-vxworks* too. for gcc/testsuite/ChangeLog * gcc.dg/ipa/ipa-sra-19.c: Extend -Wno-psabi to ppc-vx7r2. --- gcc/testsuite/gcc.dg/ipa/ipa-sra-19.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-sra-19.c b/gcc/testsuite/gcc.dg/ipa/ipa-sra-19.c index 8f3bb5d..c34c89e 100644 --- a/gcc/testsuite/gcc.dg/ipa/ipa-sra-19.c +++ b/gcc/testsuite/gcc.dg/ipa/ipa-sra-19.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O2" } */ /* { dg-additional-options "-msse2" { target ia32 } } */ -/* { dg-additional-options "-Wno-psabi" { target powerpc-ibm-aix* } } */ +/* { dg-additional-options "-Wno-psabi" { target powerpc-ibm-aix* powerpc-wrs-vxworks* } } */ typedef int __attribute__((__vector_size__(16))) vectype; -- cgit v1.1 From ba0f6902666430e5d065a92b3d5292cba91813d3 Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Sat, 3 Apr 2021 19:54:39 -0300 Subject: initialize pr94314-3.C counter The int counter in the main loop was uninitialized, so we might end up looping a very large number of times before completing successfully. I suspect that was unintended, so I'm adding a zero initializer. for gcc/testsuite/ChangeLog * g++.dg/pr94314-3.C: Zero-initialize main loop counter. --- gcc/testsuite/g++.dg/pr94314-3.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/pr94314-3.C b/gcc/testsuite/g++.dg/pr94314-3.C index 846a5d6..3160418 100644 --- a/gcc/testsuite/g++.dg/pr94314-3.C +++ b/gcc/testsuite/g++.dg/pr94314-3.C @@ -38,7 +38,7 @@ volatile int c = 1; int main () { - for (int i; i < c; i++) + for (int i = 0; i < c; i++) { idx = 0; delete new B; -- cgit v1.1 From 5a0aa603b2452dca48ad86d97d4b918187d259fc Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Fri, 2 Apr 2021 13:29:22 +0200 Subject: d: Merge upstream dmd 3b808e838, druntime 483bc129, phobos f89dc217a D front-end changes: - Explicit package visibility attribute is now always applied to introducing scopes. - Added `__traits(totype, string)' to convert mangled type string to an existing type. - Printf-like and scanf-like functions are now detected by prefixing them with `pragma(printf)' for printf-like functions or `pragma(scanf)' for scanf-like functions. - Added `__c_wchar_t', `__c_complex_float', `__c_complex_double', and `__c_complex_real' types for interfacing with C and C++. - Template alias parameters can now be instantiated with basic types, such as `int` or `void function()`. - Mixins can now be used as types in the form `mixin(string) var'. - Mixin expressions can take an argument list, same as `pragma(msg)'. - Implement DIP1034, add `typeof(*null)' types to represent `noreturn'. - `pragma(msg)' can print expressions of type `void'. - It is now an error to use private variables selectively imported from other modules. Due to a bug, some imported private members were visible from other modules, violating the specification. - Added new syntax to declare an alias to a function type using the `alias' syntax based on the assignment operator. - Function literals can now return a value by reference. Phobos changes: - Synchronize C bindings with the latest port fixes in upstream druntime. - Added alias for a `noreturn' type in object.d - Make use of the new `pragma(printf)' and `pragma(scanf)' pragmas, fix all code that got flagged as being incorrect. - Fixed code that relied on bugs in the D import package system. Reviewed-on: https://github.com/dlang/dmd/pull/12339 https://github.com/dlang/druntime/pull/3422 https://github.com/dlang/phobos/pull/7932 gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 3b808e838. * Make-lang.in (D_FRONTEND_OBJS): Add d/chkformat.o. * d-codegen.cc (build_struct_literal): Handle special enums. * d-convert.cc (convert_expr): Handle noreturn type. (convert_for_condition): Likewise. * d-target.cc (Target::_init): Set type for wchar_t. (TargetCPP::derivedClassOffset): New method. (Target::libraryObjectMonitors): New method. * decl.cc (get_symbol_decl): Set TREE_THIS_VOLATILE for functions of type noreturn. * toir.cc (IRVisitor::visit (ReturnStatement *)): Handle returning noreturn types. * types.cc (TypeVisitor::visit (TypeNoreturn *)): New method. (TypeVisitor::visit (TypeEnum *)): Handle special enums. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime 483bc129. * libdruntime/Makefile.am (DRUNTIME_DSOURCES_DARWIN): Add core/sys/darwin/fcntl.d. (DRUNTIME_DSOURCES_OPENBSD): Add core/sys/openbsd/unistd.d. (DRUNTIME_DSOURCES_WINDOWS): Add core/sys/windows/stdc/malloc.d. * libdruntime/Makefile.in: Regenerate. * src/MERGE: Merge upstream phobos f89dc217a. * src/Makefile.am (PHOBOS_DSOURCES): Add std/regex/internal/tests2.d. * src/Makefile.in: Regenerate. * testsuite/libphobos.exceptions/chain.d: Fix format arguments. * testsuite/libphobos.exceptions/line_trace.d: Likewise. --- gcc/testsuite/gdc.test/compilable/bug20796.d | 2 + gcc/testsuite/gdc.test/compilable/cppmangle.d | 18 +++ gcc/testsuite/gdc.test/compilable/ddocunittest.d | 1 + .../extra-files/serenity7190/core/Controller.d | 8 +- .../gdc.test/compilable/extra-files/test20280a.d | 12 ++ gcc/testsuite/gdc.test/compilable/fix21585.d | 24 ++++ gcc/testsuite/gdc.test/compilable/fix21647.d | 30 +++++ gcc/testsuite/gdc.test/compilable/ice10598.d | 3 - .../gdc.test/compilable/imports/ice10598a.d | 5 - .../gdc.test/compilable/imports/ice10598b.d | 3 - .../gdc.test/compilable/imports/issue21614a.d | 22 ++++ .../gdc.test/compilable/imports/pkg20537/package.d | 0 .../gdc.test/compilable/imports/test17991a/a.d | 0 .../compilable/imports/test17991a/package.d | 0 .../gdc.test/compilable/imports/test20151a/b/c/c.d | 0 .../gdc.test/compilable/imports/test20530a.d | 0 .../gdc.test/compilable/imports/test21501b.d | 7 ++ .../gdc.test/compilable/imports/test21501c.d | 4 + gcc/testsuite/gdc.test/compilable/issue16020.d | 39 ++++++ gcc/testsuite/gdc.test/compilable/issue21614.d | 10 ++ gcc/testsuite/gdc.test/compilable/issue21726.d | 2 + gcc/testsuite/gdc.test/compilable/mixintype.d | 55 ++++++++ gcc/testsuite/gdc.test/compilable/mixintype2.d | 68 ++++++++++ gcc/testsuite/gdc.test/compilable/noreturn1.d | 21 ++++ .../compilable/protection/issue20796/package.d | 5 + .../protection/issue21726/format/package.d | 7 ++ .../compilable/protection/issue21726/package.d | 1 + .../compilable/protection/issue21726/typecons.d | 6 + gcc/testsuite/gdc.test/compilable/test16002.d | 3 + gcc/testsuite/gdc.test/compilable/test17991.d | 3 + gcc/testsuite/gdc.test/compilable/test19292.d | 15 +++ gcc/testsuite/gdc.test/compilable/test20151a.d | 3 + gcc/testsuite/gdc.test/compilable/test20280.d | 8 ++ gcc/testsuite/gdc.test/compilable/test20530.d | 46 +++++++ gcc/testsuite/gdc.test/compilable/test20537.d | 10 ++ gcc/testsuite/gdc.test/compilable/test20692.d | 18 +++ gcc/testsuite/gdc.test/compilable/test21501a.d | 19 +++ gcc/testsuite/gdc.test/compilable/test9029.d | 39 ++++++ gcc/testsuite/gdc.test/fail_compilation/bug15613.d | 18 +++ gcc/testsuite/gdc.test/fail_compilation/bug16165.d | 18 +++ gcc/testsuite/gdc.test/fail_compilation/bug9631.d | 100 +++++++++++++++ .../gdc.test/fail_compilation/chkformat.d | 139 +++++++++++++++++++++ .../gdc.test/fail_compilation/cppmangle.d | 2 +- .../gdc.test/fail_compilation/diag11819b.d | 2 +- .../gdc.test/fail_compilation/diag13082.d | 6 +- .../gdc.test/fail_compilation/diag16271.d | 12 ++ gcc/testsuite/gdc.test/fail_compilation/diag8101.d | 47 +++---- .../gdc.test/fail_compilation/diag8101b.d | 17 +-- gcc/testsuite/gdc.test/fail_compilation/diag9420.d | 3 +- .../gdc.test/fail_compilation/fail11038.d | 17 +++ .../gdc.test/fail_compilation/fail11445.d | 2 +- .../gdc.test/fail_compilation/fail15361.d | 8 ++ .../gdc.test/fail_compilation/fail15896.d | 18 +++ .../gdc.test/fail_compilation/fail17630.d | 15 +++ .../gdc.test/fail_compilation/fail18219.d | 20 +++ .../gdc.test/fail_compilation/fail19107.d | 21 ++++ gcc/testsuite/gdc.test/fail_compilation/fail263.d | 3 +- gcc/testsuite/gdc.test/fail_compilation/fail3.d | 3 +- gcc/testsuite/gdc.test/fail_compilation/fail322.d | 7 +- gcc/testsuite/gdc.test/fail_compilation/fail332.d | 45 ++++++- gcc/testsuite/gdc.test/fail_compilation/fail347.d | 2 +- gcc/testsuite/gdc.test/fail_compilation/fail53.d | 3 +- gcc/testsuite/gdc.test/fail_compilation/fail55.d | 3 +- gcc/testsuite/gdc.test/fail_compilation/fail79.d | 2 +- gcc/testsuite/gdc.test/fail_compilation/fail99.d | 3 +- gcc/testsuite/gdc.test/fail_compilation/fix21585.d | 19 +++ gcc/testsuite/gdc.test/fail_compilation/format.d | 44 +++++++ gcc/testsuite/gdc.test/fail_compilation/ice10598.d | 10 ++ gcc/testsuite/gdc.test/fail_compilation/ice10922.d | 3 +- gcc/testsuite/gdc.test/fail_compilation/ice12497.d | 18 --- gcc/testsuite/gdc.test/fail_compilation/ice12501.d | 8 +- gcc/testsuite/gdc.test/fail_compilation/ice14907.d | 22 ++++ gcc/testsuite/gdc.test/fail_compilation/ice14923.d | 5 +- gcc/testsuite/gdc.test/fail_compilation/ice8255.d | 5 +- gcc/testsuite/gdc.test/fail_compilation/ice9540.d | 5 +- .../gdc.test/fail_compilation/imports/a17630.d | 3 + .../gdc.test/fail_compilation/imports/a18219.d | 6 + .../gdc.test/fail_compilation/imports/b17630.d | 3 + .../gdc.test/fail_compilation/imports/b18219.d | 15 +++ .../gdc.test/fail_compilation/imports/ice10598a.d | 5 + .../gdc.test/fail_compilation/imports/ice10598b.d | 3 + .../gdc.test/fail_compilation/imports/imp15896.d | 4 + .../gdc.test/fail_compilation/imports/test21651b.d | 3 + .../gdc.test/fail_compilation/issue16020.d | 13 ++ .../gdc.test/fail_compilation/mixintype2.d | 16 +++ .../gdc.test/fail_compilation/test16002.d | 15 --- .../gdc.test/fail_compilation/test21651.d | 11 ++ .../gdc.test/fail_compilation/warn12809.d | 41 ++++++ gcc/testsuite/gdc.test/runnable/funclit.d | 61 +++++++++ gcc/testsuite/gdc.test/runnable/mangle.d | 6 + gcc/testsuite/gdc.test/runnable/noreturn1.d | 74 +++++++++++ gcc/testsuite/gdc.test/runnable_cxx/cppa.d | 29 +++-- .../gdc.test/runnable_cxx/extra-files/cppb.cpp | 4 + .../runnable_cxx/extra-files/test21515.cpp | 82 ++++++++++++ gcc/testsuite/gdc.test/runnable_cxx/test21515.d | 104 +++++++++++++++ 95 files changed, 1580 insertions(+), 110 deletions(-) create mode 100644 gcc/testsuite/gdc.test/compilable/bug20796.d create mode 100644 gcc/testsuite/gdc.test/compilable/extra-files/test20280a.d create mode 100644 gcc/testsuite/gdc.test/compilable/fix21585.d create mode 100644 gcc/testsuite/gdc.test/compilable/fix21647.d delete mode 100644 gcc/testsuite/gdc.test/compilable/ice10598.d delete mode 100644 gcc/testsuite/gdc.test/compilable/imports/ice10598a.d delete mode 100644 gcc/testsuite/gdc.test/compilable/imports/ice10598b.d create mode 100644 gcc/testsuite/gdc.test/compilable/imports/issue21614a.d create mode 100644 gcc/testsuite/gdc.test/compilable/imports/pkg20537/package.d create mode 100644 gcc/testsuite/gdc.test/compilable/imports/test17991a/a.d create mode 100644 gcc/testsuite/gdc.test/compilable/imports/test17991a/package.d create mode 100644 gcc/testsuite/gdc.test/compilable/imports/test20151a/b/c/c.d create mode 100644 gcc/testsuite/gdc.test/compilable/imports/test20530a.d create mode 100644 gcc/testsuite/gdc.test/compilable/imports/test21501b.d create mode 100644 gcc/testsuite/gdc.test/compilable/imports/test21501c.d create mode 100644 gcc/testsuite/gdc.test/compilable/issue16020.d create mode 100644 gcc/testsuite/gdc.test/compilable/issue21614.d create mode 100644 gcc/testsuite/gdc.test/compilable/issue21726.d create mode 100644 gcc/testsuite/gdc.test/compilable/mixintype.d create mode 100644 gcc/testsuite/gdc.test/compilable/mixintype2.d create mode 100644 gcc/testsuite/gdc.test/compilable/noreturn1.d create mode 100644 gcc/testsuite/gdc.test/compilable/protection/issue20796/package.d create mode 100644 gcc/testsuite/gdc.test/compilable/protection/issue21726/format/package.d create mode 100644 gcc/testsuite/gdc.test/compilable/protection/issue21726/package.d create mode 100644 gcc/testsuite/gdc.test/compilable/protection/issue21726/typecons.d create mode 100644 gcc/testsuite/gdc.test/compilable/test17991.d create mode 100644 gcc/testsuite/gdc.test/compilable/test19292.d create mode 100644 gcc/testsuite/gdc.test/compilable/test20151a.d create mode 100644 gcc/testsuite/gdc.test/compilable/test20280.d create mode 100644 gcc/testsuite/gdc.test/compilable/test20530.d create mode 100644 gcc/testsuite/gdc.test/compilable/test20537.d create mode 100644 gcc/testsuite/gdc.test/compilable/test20692.d create mode 100644 gcc/testsuite/gdc.test/compilable/test21501a.d create mode 100644 gcc/testsuite/gdc.test/compilable/test9029.d create mode 100644 gcc/testsuite/gdc.test/fail_compilation/bug15613.d create mode 100644 gcc/testsuite/gdc.test/fail_compilation/bug16165.d create mode 100644 gcc/testsuite/gdc.test/fail_compilation/bug9631.d create mode 100644 gcc/testsuite/gdc.test/fail_compilation/chkformat.d create mode 100644 gcc/testsuite/gdc.test/fail_compilation/diag16271.d create mode 100644 gcc/testsuite/gdc.test/fail_compilation/fail11038.d create mode 100644 gcc/testsuite/gdc.test/fail_compilation/fail15361.d create mode 100644 gcc/testsuite/gdc.test/fail_compilation/fail15896.d create mode 100644 gcc/testsuite/gdc.test/fail_compilation/fail17630.d create mode 100644 gcc/testsuite/gdc.test/fail_compilation/fail18219.d create mode 100644 gcc/testsuite/gdc.test/fail_compilation/fail19107.d create mode 100644 gcc/testsuite/gdc.test/fail_compilation/fix21585.d create mode 100644 gcc/testsuite/gdc.test/fail_compilation/format.d create mode 100644 gcc/testsuite/gdc.test/fail_compilation/ice10598.d delete mode 100644 gcc/testsuite/gdc.test/fail_compilation/ice12497.d create mode 100644 gcc/testsuite/gdc.test/fail_compilation/ice14907.d create mode 100644 gcc/testsuite/gdc.test/fail_compilation/imports/a17630.d create mode 100644 gcc/testsuite/gdc.test/fail_compilation/imports/a18219.d create mode 100644 gcc/testsuite/gdc.test/fail_compilation/imports/b17630.d create mode 100644 gcc/testsuite/gdc.test/fail_compilation/imports/b18219.d create mode 100644 gcc/testsuite/gdc.test/fail_compilation/imports/ice10598a.d create mode 100644 gcc/testsuite/gdc.test/fail_compilation/imports/ice10598b.d create mode 100644 gcc/testsuite/gdc.test/fail_compilation/imports/imp15896.d create mode 100644 gcc/testsuite/gdc.test/fail_compilation/imports/test21651b.d create mode 100644 gcc/testsuite/gdc.test/fail_compilation/issue16020.d create mode 100644 gcc/testsuite/gdc.test/fail_compilation/mixintype2.d delete mode 100644 gcc/testsuite/gdc.test/fail_compilation/test16002.d create mode 100644 gcc/testsuite/gdc.test/fail_compilation/test21651.d create mode 100644 gcc/testsuite/gdc.test/runnable/noreturn1.d create mode 100644 gcc/testsuite/gdc.test/runnable_cxx/extra-files/test21515.cpp create mode 100644 gcc/testsuite/gdc.test/runnable_cxx/test21515.d (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gdc.test/compilable/bug20796.d b/gcc/testsuite/gdc.test/compilable/bug20796.d new file mode 100644 index 0000000..00d00c8 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/bug20796.d @@ -0,0 +1,2 @@ +// EXTRA_SOURCES: protection/issue20796/package.d +// https://issues.dlang.org/show_bug.cgi?id=20796 diff --git a/gcc/testsuite/gdc.test/compilable/cppmangle.d b/gcc/testsuite/gdc.test/compilable/cppmangle.d index 7fcd41a..954a9be 100644 --- a/gcc/testsuite/gdc.test/compilable/cppmangle.d +++ b/gcc/testsuite/gdc.test/compilable/cppmangle.d @@ -372,3 +372,21 @@ version (Posix) static assert(T.boo.mangleof == "_ZN1T3booE"); } +/*****************************************/ + +alias noreturn = typeof(*null); + +extern (C++) +{ + alias fpcpp = noreturn function(); + int funccpp(fpcpp); + + version (Posix) + static assert(funccpp.mangleof == "_Z7funccppPFvvE"); + + version (Win32) + static assert(funccpp.mangleof == "?funccpp@@YAHP6AXXZ@Z"); + + version (Win64) + static assert(funccpp.mangleof == "?funccpp@@YAHP6AXXZ@Z"); +} diff --git a/gcc/testsuite/gdc.test/compilable/ddocunittest.d b/gcc/testsuite/gdc.test/compilable/ddocunittest.d index 940ef1c..8c691b6 100644 --- a/gcc/testsuite/gdc.test/compilable/ddocunittest.d +++ b/gcc/testsuite/gdc.test/compilable/ddocunittest.d @@ -357,6 +357,7 @@ auto redBlackTree(bool allowDuplicates, E)(E[] elems...) } /// ditto auto redBlackTree(alias less, E)(E[] elems...) +if (__traits(compiles, (E a, E b) => mixin(less))) { return 3; } diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/serenity7190/core/Controller.d b/gcc/testsuite/gdc.test/compilable/extra-files/serenity7190/core/Controller.d index 9ade317..62de518 100644 --- a/gcc/testsuite/gdc.test/compilable/extra-files/serenity7190/core/Controller.d +++ b/gcc/testsuite/gdc.test/compilable/extra-files/serenity7190/core/Controller.d @@ -3,6 +3,12 @@ class Controller { enum _s_pkg = __traits(parent, __traits(parent, __traits(parent, T))).stringof["package ".length .. $]; enum _s_model = T.stringof[0 .. $-`Controller`.length] ~ `Model`; + + import serenity7190.core.Model; + // expands to "import example7190.models.HomeModel;" + mixin(q{import } ~ _s_pkg ~ q{.models.} ~ _s_model ~ q{;}); + + // "enum _ = is(example7190.models.HomeModel.HomeModel : serenity7190.core.Model.Model);" mixin(q{enum _ = is(} ~ _s_pkg ~ q{.models.} ~ _s_model ~ q{.} ~ _s_model ~ q{ : serenity7190.core.Model.Model);}); } -} \ No newline at end of file +} diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/test20280a.d b/gcc/testsuite/gdc.test/compilable/extra-files/test20280a.d new file mode 100644 index 0000000..edb40954 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/extra-files/test20280a.d @@ -0,0 +1,12 @@ +module test20280a; + +struct Alpha(uint _) +{ + import test20280a; +} + +struct Foxtrot(uint _) +{ + alias Attributes = Alpha!10; + enum A = 10; +} diff --git a/gcc/testsuite/gdc.test/compilable/fix21585.d b/gcc/testsuite/gdc.test/compilable/fix21585.d new file mode 100644 index 0000000..a83fb89 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/fix21585.d @@ -0,0 +1,24 @@ +/* TEST_OUTPUT: +--- +i int +d double +Pi int* +--- +*/ + +pragma(msg, 1.mangleof, " ", __traits(toType, 1.mangleof)); +pragma(msg, (1.0).mangleof, " ", __traits(toType, (1.0).mangleof)); +pragma(msg, (int*).mangleof, " ", __traits(toType, (int*).mangleof)); + +template Type(T) { alias Type = T; } + +Type!(__traits(toType, 1.mangleof)) j = 3; + +alias T = Type!(__traits(toType, 1.mangleof)); +static assert(is(T == int)); + +__traits(toType, "i") x = 7; + +static assert(is(Type!(__traits(toType, 1.mangleof)) == int)); +static assert(is(Type!(__traits(toType, (1.0).mangleof)) == double)); +static assert(is(Type!(__traits(toType, (int*).mangleof)) == int*)); diff --git a/gcc/testsuite/gdc.test/compilable/fix21647.d b/gcc/testsuite/gdc.test/compilable/fix21647.d new file mode 100644 index 0000000..c129fa0 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/fix21647.d @@ -0,0 +1,30 @@ +/* +REQUIRED_ARGS: +TEST_OUTPUT: +--- +cast(void)0 +cast(void)0 +void +cast(void)0 +cast(void)0 +cast(void)0 +void +--- +*/ + + +// https://issues.dlang.org/show_bug.cgi?id=21647 + +void foo() { return cast(void)1; } + +void main(){} + +alias V = void; + +void test1() { pragma(msg, foo()); } +void test2() { pragma(msg, main()); } +void test3() { pragma(msg, V); } + +pragma(msg, foo()); +pragma(msg, main()); +pragma(msg, V); diff --git a/gcc/testsuite/gdc.test/compilable/ice10598.d b/gcc/testsuite/gdc.test/compilable/ice10598.d deleted file mode 100644 index 58a7c3b..0000000 --- a/gcc/testsuite/gdc.test/compilable/ice10598.d +++ /dev/null @@ -1,3 +0,0 @@ -// EXTRA_SOURCES: imports/ice10598a.d imports/ice10598b.d - -void main() {} diff --git a/gcc/testsuite/gdc.test/compilable/imports/ice10598a.d b/gcc/testsuite/gdc.test/compilable/imports/ice10598a.d deleted file mode 100644 index b0e9c3b..0000000 --- a/gcc/testsuite/gdc.test/compilable/imports/ice10598a.d +++ /dev/null @@ -1,5 +0,0 @@ -module imports.ice10598a; - -template TypeTuple(TL...) { alias TL TypeTuple; } - -alias TypeTuple!(__traits(getMember, imports.ice10598b, (__traits(allMembers, imports.ice10598b)[1])))[0] notImportedType; diff --git a/gcc/testsuite/gdc.test/compilable/imports/ice10598b.d b/gcc/testsuite/gdc.test/compilable/imports/ice10598b.d deleted file mode 100644 index de50787..0000000 --- a/gcc/testsuite/gdc.test/compilable/imports/ice10598b.d +++ /dev/null @@ -1,3 +0,0 @@ -module imports.ice10598b; - -struct LocalType {} diff --git a/gcc/testsuite/gdc.test/compilable/imports/issue21614a.d b/gcc/testsuite/gdc.test/compilable/imports/issue21614a.d new file mode 100644 index 0000000..ee3c9eb --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/imports/issue21614a.d @@ -0,0 +1,22 @@ +module imports.issue21614a; + +struct FormatSpec(Char) +{ + import imports.issue21614a; +} + +template Tuple(Specs...) +{ + struct Tuple + { + alias spec = FormatSpec!char(); + this(Specs) + { + } + } +} + +auto findRoot(T)(T) +{ + return Tuple!(T)(); +} diff --git a/gcc/testsuite/gdc.test/compilable/imports/pkg20537/package.d b/gcc/testsuite/gdc.test/compilable/imports/pkg20537/package.d new file mode 100644 index 0000000..e69de29 diff --git a/gcc/testsuite/gdc.test/compilable/imports/test17991a/a.d b/gcc/testsuite/gdc.test/compilable/imports/test17991a/a.d new file mode 100644 index 0000000..e69de29 diff --git a/gcc/testsuite/gdc.test/compilable/imports/test17991a/package.d b/gcc/testsuite/gdc.test/compilable/imports/test17991a/package.d new file mode 100644 index 0000000..e69de29 diff --git a/gcc/testsuite/gdc.test/compilable/imports/test20151a/b/c/c.d b/gcc/testsuite/gdc.test/compilable/imports/test20151a/b/c/c.d new file mode 100644 index 0000000..e69de29 diff --git a/gcc/testsuite/gdc.test/compilable/imports/test20530a.d b/gcc/testsuite/gdc.test/compilable/imports/test20530a.d new file mode 100644 index 0000000..e69de29 diff --git a/gcc/testsuite/gdc.test/compilable/imports/test21501b.d b/gcc/testsuite/gdc.test/compilable/imports/test21501b.d new file mode 100644 index 0000000..c1f8fab --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/imports/test21501b.d @@ -0,0 +1,7 @@ +module imports.test21501b; +import test21501a; + +struct B +{ + A data; +} diff --git a/gcc/testsuite/gdc.test/compilable/imports/test21501c.d b/gcc/testsuite/gdc.test/compilable/imports/test21501c.d new file mode 100644 index 0000000..cc1f95f --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/imports/test21501c.d @@ -0,0 +1,4 @@ +module imports.test21501c; + +alias C = int; +const D = 1; diff --git a/gcc/testsuite/gdc.test/compilable/issue16020.d b/gcc/testsuite/gdc.test/compilable/issue16020.d new file mode 100644 index 0000000..cfd078c --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/issue16020.d @@ -0,0 +1,39 @@ +module issue16020; + +alias F1 = const(int)(); const(int) f1(){return 42;} +static assert (is(F1 == typeof(f1))); + +alias F2 = float(float); float f2(float p){return p;} +static assert (is(F2 == typeof(f2))); + +alias F3 = void(); void f3(){} +static assert (is(F3 == typeof(f3))); + +alias void F41() @safe; +alias F42 = void() @safe; +alias F43 = @safe void(); +static assert (is(F41 == F42)); +static assert (is(F43 == F42)); + +alias void F51() @system; +alias F52 = void() @safe; +static assert (!is(F51 == F52)); + +alias F61 = int() const shared; +alias int F62() const shared ; +alias F63 = const shared int(); +static assert (is(F61 == F62)); +static assert (is(F63 == F62)); + +alias F71 = int() immutable inout; +alias int F72() immutable inout; +alias F73 = immutable inout int(); +static assert (is(F71 == F72)); +static assert (is(F73 == F72)); + +alias FunTemplate(T) = void(T t); +alias Specialized = FunTemplate!int; +alias Compared = void(int); +static assert(is(Specialized == Compared)); + +void main() {} diff --git a/gcc/testsuite/gdc.test/compilable/issue21614.d b/gcc/testsuite/gdc.test/compilable/issue21614.d new file mode 100644 index 0000000..1843fe6 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/issue21614.d @@ -0,0 +1,10 @@ +// EXTRA_FILES: imports/issue21614a.d +// REQUIRED_ARGS: -i + +// https://issues.dlang.org/show_bug.cgi?id=21614 + +void logmdigammaInverse(real y) +{ + import imports.issue21614a; + findRoot(y); +} diff --git a/gcc/testsuite/gdc.test/compilable/issue21726.d b/gcc/testsuite/gdc.test/compilable/issue21726.d new file mode 100644 index 0000000..c8a8675 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/issue21726.d @@ -0,0 +1,2 @@ +// EXTRA_SOURCES: protection/issue21726/typecons.d +// https://issues.dlang.org/show_bug.cgi?id=21726 diff --git a/gcc/testsuite/gdc.test/compilable/mixintype.d b/gcc/testsuite/gdc.test/compilable/mixintype.d new file mode 100644 index 0000000..abbf85a --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/mixintype.d @@ -0,0 +1,55 @@ + +alias Int = mixin("int"); +alias Lint = mixin("Int"); + +int test1(mixin("int")* p) +{ + mixin("int")[] a; + mixin("int[]") b; + mixin("int[] c;"); + mixin("*p = c[0];"); + *p = mixin("c[0]"); + return *p + a[0] + b[0] + c[0]; +} + +/******************************************/ + +void test2() +{ + auto a = __traits(allMembers, mixin(__MODULE__)); +} + +/*****************************************/ + +void test3() +{ + char val; + int mod; + enum b = __traits(compiles, mixin("*cast(int*)&val + mod")); + static assert(b == true); +} + +/********************************************/ + + +struct S +{ + int fielda; + int fieldb; +} + +template Foo4(alias T) +{ + enum Foo4 = true; +} + +void test4() +{ + S sa; + auto a = Foo4!( __traits(getMember,sa,"fielda") ); + + S sb; + enum getStuff = q{ __traits(getMember,sb,"fieldb") }; + auto b = Foo4!(mixin(getStuff)); +} + diff --git a/gcc/testsuite/gdc.test/compilable/mixintype2.d b/gcc/testsuite/gdc.test/compilable/mixintype2.d new file mode 100644 index 0000000..43803df --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/mixintype2.d @@ -0,0 +1,68 @@ + +alias fun = mixin("(){}"); + +void test1() +{ + int x = 1; + static immutable c = 2; + + fun(); + foo!(mixin("int"))(); + foo!(mixin("long*"))(); + foo!(mixin("ST!(int, S.T)"))(); + foo!(mixin(ST!(int, S.T)))(); + + int[mixin("string")] a1; + int[mixin("5")] a2; + int[mixin("c")] a3; + int[] v1 = new int[mixin("3")]; + auto v2 = new int[mixin("x")]; + + mixin(q{__traits(getMember, S, "T")}) ftv; + + alias T = int*; + static assert(__traits(compiles, mixin("int"))); + static assert(__traits(compiles, mixin(q{int[mixin("string")]}))); + static assert(__traits(compiles, mixin(q{int[mixin("2")]}))); + static assert(__traits(compiles, mixin(T))); + static assert(__traits(compiles, mixin("int*"))); + static assert(__traits(compiles, mixin(typeof(0)))); +} + +struct S { alias T = float*; } + +struct ST(X,Y) {} + +void foo(alias t)() {} + +/**************************************************/ +// https://issues.dlang.org/show_bug.cgi?id=21074 + +alias Byte = ubyte; +alias Byte2(A) = ubyte; +alias T0 = mixin(q{const(Byte)})*; +alias T1 = mixin(q{const(Byte[1])})*; +alias T2 = mixin(q{const(Byte2!int)})*; +alias T3 = mixin(q{const(mixin(Byte2!int))})*; +alias T4 = mixin(q{const(mixin("__traits(getMember, S, \"T\")"))})*; +alias T5 = const(mixin(q{Byte}))*; +alias T6 = const(mixin(q{immutable(Byte)}))*; +alias T7 = const(mixin(q{shared(Byte)}))*; +alias T8 = const(mixin(q{Byte*})); + +// the following tests now work +static assert(is(T0 == const(ubyte)*)); +static assert(is(T1 == const(ubyte[1])*)); +static assert(is(T2 == const(ubyte)*)); +static assert(is(T3 == const(ubyte)*)); +static assert(is(T4 == const(float*)*)); +static assert(is(T5 == const(ubyte)*)); +static assert(is(T6 == immutable(ubyte)*)); +static assert(is(T7 == const(shared(ubyte))*)); +static assert(is(T8 == const(ubyte*))); + +// this doesn't work but I'll file a new issue +/* +alias T8 = mixin(q{immutable(__traits(getMember, S, "T"))})*; +static assert(is(T8 == immutable(float*)*)); +*/ diff --git a/gcc/testsuite/gdc.test/compilable/noreturn1.d b/gcc/testsuite/gdc.test/compilable/noreturn1.d new file mode 100644 index 0000000..e21adc4 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/noreturn1.d @@ -0,0 +1,21 @@ +/* +TEST_OUTPUT: +--- +noreturn +--- +*/ + +alias noreturn = typeof(*null); +pragma(msg, noreturn); + +noreturn exits(int* p) { *p = 3; } + +noreturn exit(); + +int test1(int i) +{ + if (exit()) + return i + 1; + return i - 1; +} + diff --git a/gcc/testsuite/gdc.test/compilable/protection/issue20796/package.d b/gcc/testsuite/gdc.test/compilable/protection/issue20796/package.d new file mode 100644 index 0000000..d0b5f5a --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/protection/issue20796/package.d @@ -0,0 +1,5 @@ +module issue20796; + +package(issue20796) void foo() +{ +} diff --git a/gcc/testsuite/gdc.test/compilable/protection/issue21726/format/package.d b/gcc/testsuite/gdc.test/compilable/protection/issue21726/format/package.d new file mode 100644 index 0000000..e0f6ba7 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/protection/issue21726/format/package.d @@ -0,0 +1,7 @@ +module protection.issue21726.format; + +package(protection.issue21726.format): + +package(protection.issue21726) int issuePkgSym; +package(protection) int protectionPkgSym(); +int formatPkgSym; diff --git a/gcc/testsuite/gdc.test/compilable/protection/issue21726/package.d b/gcc/testsuite/gdc.test/compilable/protection/issue21726/package.d new file mode 100644 index 0000000..f8986c9 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/protection/issue21726/package.d @@ -0,0 +1 @@ +module protection.issue21726; diff --git a/gcc/testsuite/gdc.test/compilable/protection/issue21726/typecons.d b/gcc/testsuite/gdc.test/compilable/protection/issue21726/typecons.d new file mode 100644 index 0000000..faed95e --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/protection/issue21726/typecons.d @@ -0,0 +1,6 @@ +module protection.issue21726.typecons; + +import protection.issue21726.format : issuePkgSym; +import protection.issue21726.format : protectionPkgSym; +static assert(!__traits(compiles, + { import protection.issue21726.format : formatPkgSym; })); diff --git a/gcc/testsuite/gdc.test/compilable/test16002.d b/gcc/testsuite/gdc.test/compilable/test16002.d index f3303c0..f7b4c2e 100644 --- a/gcc/testsuite/gdc.test/compilable/test16002.d +++ b/gcc/testsuite/gdc.test/compilable/test16002.d @@ -22,3 +22,6 @@ static assert(is(b == module)); // This is supposed to work even though we haven't directly imported imports.pkgmodule. static assert(is(imports.pkgmodule == module)); static assert(!is(MyStruct == module)); + +static assert(!is(imports.nonexistent == package)); +static assert(!is(imports.nonexistent == module)); diff --git a/gcc/testsuite/gdc.test/compilable/test17991.d b/gcc/testsuite/gdc.test/compilable/test17991.d new file mode 100644 index 0000000..8bc9fa9 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test17991.d @@ -0,0 +1,3 @@ +// https://issues.dlang.org/show_bug.cgi?id=17991 +// EXTRA_FILES: imports/test17991a/package.d imports/test17991a/a.d +import imports.test17991a, imports.test17991a.a; diff --git a/gcc/testsuite/gdc.test/compilable/test19292.d b/gcc/testsuite/gdc.test/compilable/test19292.d new file mode 100644 index 0000000..8122851 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test19292.d @@ -0,0 +1,15 @@ +// https://issues.dlang.org/show_bug.cgi?id=19292 + +mixin("enum a = ", 87, ";"); +static assert(a == 87); + +int test() +{ + mixin("enum x = ", 7, ";"); + return mixin("1", x, 2U); +} + +void testit() +{ + static assert(test() == 172); +} diff --git a/gcc/testsuite/gdc.test/compilable/test20151a.d b/gcc/testsuite/gdc.test/compilable/test20151a.d new file mode 100644 index 0000000..d9ae28f --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test20151a.d @@ -0,0 +1,3 @@ +// EXTRA_FILES: imports/test20151a/b/c/c.d +module imports.test20151a; +import imports.test20151a.b.c.c; diff --git a/gcc/testsuite/gdc.test/compilable/test20280.d b/gcc/testsuite/gdc.test/compilable/test20280.d new file mode 100644 index 0000000..76a1082 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test20280.d @@ -0,0 +1,8 @@ +// PERMUTE_ARGS: +// REQUIRED_ARGS: -Icompilable/extra-files +// EXTRA_FILES: extra-files/test20280a.d +module test20280; + +import test20280a; + +alias Charlie = Foxtrot!(0); diff --git a/gcc/testsuite/gdc.test/compilable/test20530.d b/gcc/testsuite/gdc.test/compilable/test20530.d new file mode 100644 index 0000000..be80dbb --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test20530.d @@ -0,0 +1,46 @@ +// EXTRA_FILES: imports/test20530a.d imports/plainpackage/plainmodule.d imports/pkgmodule/package.d imports/pkgmodule/plainmodule.d +module mod; +static assert(is(mod == module)); +static assert(is(mixin("mod") == module)); +static assert(!is(mod == package)); +static assert(!is(mixin("mod") == package)); + +import imports.test20530a; +static assert(is(imports == package)); +static assert(is(mixin("imports") == package)); +static assert(!is(imports == module)); +static assert(!is(mixin("imports") == module)); + +import imports.plainpackage.plainmodule; +import imports.pkgmodule.plainmodule; + +struct MyStruct; + +alias a = mixin("imports.plainpackage"); +alias b = mixin("imports.pkgmodule.plainmodule"); + +static assert(is(mixin("imports.plainpackage") == package)); +static assert(is(mixin("a") == package)); +static assert(!is(mixin("imports.plainpackage.plainmodule") == package)); +static assert(!is(mixin("b") == package)); +static assert(is(mixin("imports.pkgmodule") == package)); +mixin("static assert(is(imports.pkgmodule == package));"); + +static assert(!is(mixin("MyStruct") == package)); + +static assert(!is(mixin("imports.plainpackage") == module)); +static assert(!is(mixin("a") == module)); +static assert(is(mixin("imports.plainpackage.plainmodule") == module)); +static assert(is(mixin("b") == module)); +static assert(is(mixin("imports.pkgmodule") == module)); +mixin("static assert(is(imports.pkgmodule == module));"); + +static assert(!is(mixin("MyStruct") == module)); + +static assert(!is(mixin("imports.nonexistent") == package)); +static assert(!is(mixin("imports.nonexistent") == module)); + +// this won't work due to mixin argument .stringof expansion, +// it will expand to mixin(package imports.pkgmodule). Issue 20519. +//static assert(is(mixin(imports.pkgmodule) == package)); +//static assert(is(mixin(imports.pkgmodule) == module)); diff --git a/gcc/testsuite/gdc.test/compilable/test20537.d b/gcc/testsuite/gdc.test/compilable/test20537.d new file mode 100644 index 0000000..f2d05d2 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test20537.d @@ -0,0 +1,10 @@ +// REQUIRED_ARGS: -Icompilable/imports +// EXTRA_FILES: imports/pkg20537/package.d +import pkg20537; + +static assert(is(pkg20537 == module)); +static assert(__traits(isModule, pkg20537)); +static assert(is(mixin("pkg20537") == module)); +static assert(is(pkg20537 == package)); +static assert(__traits(isPackage, pkg20537)); +static assert(is(mixin("pkg20537") == package)); diff --git a/gcc/testsuite/gdc.test/compilable/test20692.d b/gcc/testsuite/gdc.test/compilable/test20692.d new file mode 100644 index 0000000..2d67211 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test20692.d @@ -0,0 +1,18 @@ +// https://issues.dlang.org/show_bug.cgi?id=20692 + +struct S() { + void fun() { + gun(""); + } + void gun(T)(T) { + alias buggy = bug; + } +} + +alias X = S!(); + +void main() { + X().gun(0); +} + +alias bug = __traits(getMember, X, "fun"); diff --git a/gcc/testsuite/gdc.test/compilable/test21501a.d b/gcc/testsuite/gdc.test/compilable/test21501a.d new file mode 100644 index 0000000..096fd51 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test21501a.d @@ -0,0 +1,19 @@ +// EXTRA_SOURCES: imports/test21501b.d imports/test21501c.d +// https://issues.dlang.org/show_bug.cgi?id=21501 + +module test21501a; +import imports.test21501b; +import imports.test21501c; + +alias Identity(alias T) = T; + +struct A +{ + alias a = imports.test21501c.C; + const int b = imports.test21501c.D; // fixed + alias c = Identity!(mixin(q{imports.test21501c.C})); // fixed + const int d = Identity!(mixin(q{imports.test21501c.D})); // fixed + + static assert(is(a == c) && is(a == int)); + static assert(b == d && b == 1); +} diff --git a/gcc/testsuite/gdc.test/compilable/test9029.d b/gcc/testsuite/gdc.test/compilable/test9029.d new file mode 100644 index 0000000..bbbd98a --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test9029.d @@ -0,0 +1,39 @@ +// https://issues.dlang.org/show_bug.cgi?id=9029 +enum NameOf(alias S) = S.stringof; + +static assert(NameOf!int == "int"); + +enum BothMatch(alias S) = "alias"; +enum BothMatch(T) = "type"; + +void foo9029() { } + +struct Struct { } + +static assert(BothMatch!int == "type"); +static assert(BothMatch!(void function()) == "type"); +static assert(BothMatch!BothMatch == "alias"); +static assert(BothMatch!Struct == "type"); +static assert(BothMatch!foo9029 == "alias"); +static assert(BothMatch!5 == "alias"); + +// https://issues.dlang.org/show_bug.cgi?id=19884 +mixin template genCtEvaluate() +{ + void evaluate(alias op)() { } +} +struct S +{ + mixin genCtEvaluate!() mixinEval; + alias evaluate = mixinEval.evaluate; + void evaluate() { } +} +alias List(Ops...) = Ops; +void main() +{ + S g; + foreach (op; List!(0)) + { + g.evaluate!op(); + } +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/bug15613.d b/gcc/testsuite/gdc.test/fail_compilation/bug15613.d new file mode 100644 index 0000000..e8072fd --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/bug15613.d @@ -0,0 +1,18 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/bug15613.d(16): Error: function `bug15613.f(int...)` is not callable using argument types `(typeof(null))` +fail_compilation/bug15613.d(16): cannot pass argument `null` of type `typeof(null)` to parameter `int...` +fail_compilation/bug15613.d(17): Error: function `bug15613.g(Object, ...)` is not callable using argument types `(int)` +fail_compilation/bug15613.d(17): cannot pass argument `8` of type `int` to parameter `Object` +--- +*/ + +void f(int...); +void g(Object, ...); + +void main() +{ + f(null); + g(8); +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/bug16165.d b/gcc/testsuite/gdc.test/fail_compilation/bug16165.d new file mode 100644 index 0000000..fdfbf73 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/bug16165.d @@ -0,0 +1,18 @@ +void f(int x, Object y); + +void g() +{ + Object o; + f(o, o, 404); + f(5, 6, 404); +} + +/* +TEST_OUTPUT: +--- +fail_compilation/bug16165.d(6): Error: function `bug16165.f(int x, Object y)` is not callable using argument types `(Object, Object, int)` +fail_compilation/bug16165.d(6): cannot pass argument `o` of type `object.Object` to parameter `int x` +fail_compilation/bug16165.d(7): Error: function `bug16165.f(int x, Object y)` is not callable using argument types `(int, int, int)` +fail_compilation/bug16165.d(7): cannot pass argument `6` of type `int` to parameter `Object y` +--- + */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/bug9631.d b/gcc/testsuite/gdc.test/fail_compilation/bug9631.d new file mode 100644 index 0000000..852eaae --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/bug9631.d @@ -0,0 +1,100 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/bug9631.d(20): Error: cannot implicitly convert expression `F()` of type `bug9631.T1!().F` to `bug9631.T2!().F` +--- +*/ + +template T1() +{ + struct F { } +} + +template T2() +{ + struct F { } +} + +void main() +{ + T2!().F x = T1!().F(); +} + +/* +TEST_OUTPUT: +--- +fail_compilation/bug9631.d(41): Error: incompatible types for ((x) == (y)): 'bug9631.S' and 'bug9631.tem! +).S' +--- +*/ + +struct S { char c; } + +template tem() +{ + struct S { int i; } +} + +void equal() +{ + S x; + auto y = tem!().S(); + bool b = x == y; +} + +/* +TEST_OUTPUT: +--- +fail_compilation/bug9631.d(79): Error: function `bug9631.arg.f(int i, S s)` is not callable using argumen + types `(int, S)` +fail_compilation/bug9631.d(79): cannot pass argument `y` of type `bug9631.tem!().S` to parameter ` +ug9631.S s` +fail_compilation/bug9631.d(80): Error: function literal `__lambda2(S s)` is not callable using argument t +pes `(S)` +fail_compilation/bug9631.d(80): cannot pass argument `x` of type `bug9631.S` to parameter `bug9631 +tem!().S s` +fail_compilation/bug9631.d(86): Error: constructor `bug9631.arg.A.this(S _param_0)` is not callable using +argument types `(S)` +fail_compilation/bug9631.d(86): cannot pass argument `S(0)` of type `bug9631.tem!().S` to paramete + `bug9631.S _param_0` +--- +*/ +void arg() +{ + S x; + tem!().S y; + + void f(int i, S s); + f(4, y); + (tem!().S s){}(x); + + struct A + { + this(S){} + } + A(tem!().S()); +} + +/* +TEST_OUTPUT: +--- +fail_compilation/bug9631.d(106): Error: function `bug9631.targ.ft!().ft(S _param_0)` is not callable using argument types `(S)` +fail_compilation/bug9631.d(106): cannot pass argument `x` of type `bug9631.S` to parameter `bug9631.tem!().S _param_0` +fail_compilation/bug9631.d(107): Error: template `bug9631.targ.ft` cannot deduce function from argument types `!()(S)`, candidates are: +fail_compilation/bug9631.d(105): `bug9631.targ.ft()(tem!().S)` +fail_compilation/bug9631.d(109): Error: template `bug9631.targ.ft2` cannot deduce function from argument types `!()(S, int)`, candidates are: +fail_compilation/bug9631.d(108): `bug9631.targ.ft2(T)(S, T)` +--- +*/ +void targ() +{ + S x; + tem!().S y; + + void ft()(tem!().S){} + ft!()(x); + ft(x); + void ft2(T)(S, T){} + ft2(y, 1); +} + diff --git a/gcc/testsuite/gdc.test/fail_compilation/chkformat.d b/gcc/testsuite/gdc.test/fail_compilation/chkformat.d new file mode 100644 index 0000000..7451b3f --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/chkformat.d @@ -0,0 +1,139 @@ +/* +REQUIRED_ARGS: -de +TEST_OUTPUT: +--- +fail_compilation/chkformat.d(101): Deprecation: width argument `0L` for format specification `"%*.*d"` must be `int`, not `long` +fail_compilation/chkformat.d(101): Deprecation: precision argument `1L` for format specification `"%*.*d"` must be `int`, not `long` +fail_compilation/chkformat.d(101): Deprecation: argument `2L` for format specification `"%*.*d"` must be `int`, not `long` +fail_compilation/chkformat.d(104): Deprecation: argument `4` for format specification `"%lld"` must be `long`, not `int` +fail_compilation/chkformat.d(105): Deprecation: argument `5` for format specification `"%jd"` must be `core.stdc.stdint.intmax_t`, not `int` +fail_compilation/chkformat.d(106): Deprecation: argument `6.0` for format specification `"%zd"` must be `size_t`, not `double` +fail_compilation/chkformat.d(107): Deprecation: argument `7.0` for format specification `"%td"` must be `ptrdiff_t`, not `double` +fail_compilation/chkformat.d(108): Deprecation: argument `8.0L` for format specification `"%g"` must be `double`, not `real` +fail_compilation/chkformat.d(109): Deprecation: argument `9.0` for format specification `"%Lg"` must be `real`, not `double` +fail_compilation/chkformat.d(110): Deprecation: argument `10` for format specification `"%p"` must be `void*`, not `int` +fail_compilation/chkformat.d(111): Deprecation: argument `& u` for format specification `"%n"` must be `int*`, not `uint*` +fail_compilation/chkformat.d(113): Deprecation: argument `& u` for format specification `"%lln"` must be `long*`, not `int*` +fail_compilation/chkformat.d(114): Deprecation: argument `& u` for format specification `"%hn"` must be `short*`, not `int*` +fail_compilation/chkformat.d(115): Deprecation: argument `& u` for format specification `"%hhn"` must be `byte*`, not `int*` +fail_compilation/chkformat.d(116): Deprecation: argument `16L` for format specification `"%c"` must be `char`, not `long` +fail_compilation/chkformat.d(117): Deprecation: argument `17L` for format specification `"%c"` must be `char`, not `long` +fail_compilation/chkformat.d(118): Deprecation: argument `& u` for format specification `"%s"` must be `char*`, not `int*` +fail_compilation/chkformat.d(119): Deprecation: argument `& u` for format specification `"%ls"` must be `wchar_t*`, not `int*` +fail_compilation/chkformat.d(201): Deprecation: argument `0L` for format specification `"%d"` must be `int*`, not `long` +fail_compilation/chkformat.d(202): Deprecation: more format specifiers than 1 arguments +fail_compilation/chkformat.d(203): Deprecation: argument `0L` for format specification `"%d"` must be `int*`, not `long` +fail_compilation/chkformat.d(204): Deprecation: argument `0L` for format specification `"%3u"` must be `uint*`, not `long` +fail_compilation/chkformat.d(205): Deprecation: argument `u` for format specification `"%200u"` must be `uint*`, not `uint` +fail_compilation/chkformat.d(206): Deprecation: argument `3.0` for format specification `"%hhd"` must be `byte*`, not `double` +fail_compilation/chkformat.d(207): Deprecation: argument `4` for format specification `"%hd"` must be `short*`, not `int` +fail_compilation/chkformat.d(209): Deprecation: argument `4` for format specification `"%lld"` must be `long*`, not `int` +fail_compilation/chkformat.d(210): Deprecation: argument `5` for format specification `"%jd"` must be `core.stdc.stdint.intmax_t*`, not `int` +fail_compilation/chkformat.d(211): Deprecation: argument `6.0` for format specification `"%zd"` must be `size_t*`, not `double` +fail_compilation/chkformat.d(212): Deprecation: argument `7.0` for format specification `"%td"` must be `ptrdiff_t*`, not `double` +fail_compilation/chkformat.d(213): Deprecation: format specifier `"%Ld"` is invalid +fail_compilation/chkformat.d(214): Deprecation: argument `0` for format specification `"%u"` must be `uint*`, not `int` +fail_compilation/chkformat.d(215): Deprecation: argument `0` for format specification `"%hhu"` must be `ubyte*`, not `int` +fail_compilation/chkformat.d(216): Deprecation: argument `0` for format specification `"%hu"` must be `ushort*`, not `int` +fail_compilation/chkformat.d(218): Deprecation: argument `0` for format specification `"%llu"` must be `ulong*`, not `int` +fail_compilation/chkformat.d(219): Deprecation: argument `0` for format specification `"%ju"` must be `ulong*`, not `int` +fail_compilation/chkformat.d(220): Deprecation: argument `0` for format specification `"%zu"` must be `size_t*`, not `int` +fail_compilation/chkformat.d(221): Deprecation: argument `0` for format specification `"%tu"` must be `ptrdiff_t*`, not `int` +fail_compilation/chkformat.d(222): Deprecation: argument `8.0L` for format specification `"%g"` must be `float*`, not `real` +fail_compilation/chkformat.d(223): Deprecation: argument `8.0L` for format specification `"%lg"` must be `double*`, not `real` +fail_compilation/chkformat.d(224): Deprecation: argument `9.0` for format specification `"%Lg"` must be `real*`, not `double` +fail_compilation/chkformat.d(225): Deprecation: argument `& u` for format specification `"%s"` must be `char*`, not `int*` +fail_compilation/chkformat.d(226): Deprecation: argument `& u` for format specification `"%ls"` must be `wchar_t*`, not `int*` +fail_compilation/chkformat.d(227): Deprecation: argument `v` for format specification `"%p"` must be `void**`, not `void*` +fail_compilation/chkformat.d(228): Deprecation: argument `& u` for format specification `"%n"` must be `int*`, not `ushort*` +fail_compilation/chkformat.d(229): Deprecation: argument `& u` for format specification `"%hhn"` must be `byte*`, not `int*` +fail_compilation/chkformat.d(230): Deprecation: format specifier `"%[n"` is invalid +fail_compilation/chkformat.d(231): Deprecation: format specifier `"%]"` is invalid +fail_compilation/chkformat.d(232): Deprecation: argument `& u` for format specification `"%90s"` must be `char*`, not `int*` +fail_compilation/chkformat.d(233): Deprecation: argument `0L` for format specification `"%d"` must be `int*`, not `long` +fail_compilation/chkformat.d(234): Deprecation: argument `0L` for format specification `"%d"` must be `int*`, not `long` +--- +*/ + + +import core.stdc.stdio; + +#line 100 + +void test1() { printf("%*.*d\n", 0L, 1L, 2L); } +//void test2() { } +//void test3() { printf("%ld\n", 3.0); } +void test4() { printf("%lld\n", 4); } +void test5() { printf("%jd\n", 5); } +void test6() { printf("%zd\n", 6.0); } +void test7() { printf("%td\n", 7.0); } +void test8() { printf("%g\n", 8.0L); } +void test9() { printf("%Lg\n", 9.0); } +void test10() { printf("%p\n", 10); } +void test11() { uint u; printf("%n\n", &u); } +//void test12() { ushort u; printf("%ln\n", &u); } +void test13() { int u; printf("%lln\n", &u); } +void test14() { int u; printf("%hn\n", &u); } +void test15() { int u; printf("%hhn\n", &u); } +void test16() { printf("%c\n", 16L); } +void test17() { printf("%c\n", 17L); } +void test18() { int u; printf("%s\n", &u); } +void test19() { int u; printf("%ls\n", &u); } +//void test20() { int u; char[] s; sprintf(&s[0], "%d\n", &u); } +//void test21() { int u; fprintf(null, "%d\n", &u); } + +#line 200 + +void test31() { scanf("%d\n", 0L); } +void test32() { int i; scanf("%d %d\n", &i); } +void test33() { scanf("%d%*c\n", 0L); } +void test34() { scanf("%3u\n", 0L); } +void test35() { uint u; scanf("%200u%*s\n", u); } +void test36() { scanf("%hhd\n", 3.0); } +void test37() { scanf("%hd\n", 4); } +//void test38() { scanf("%ld\n", 3.0); } +void test39() { scanf("%lld\n", 4); } +void test40() { scanf("%jd\n", 5); } +void test41() { scanf("%zd\n", 6.0); } +void test42() { scanf("%td\n", 7.0); } +void test43() { scanf("%Ld\n", 0); } +void test44() { scanf("%u\n", 0); } +void test45() { scanf("%hhu\n", 0); } +void test46() { scanf("%hu\n", 0); } +//void test47() { scanf("%lu\n", 0); } +void test48() { scanf("%llu\n", 0); } +void test49() { scanf("%ju\n", 0); } +void test50() { scanf("%zu\n", 0); } +void test51() { scanf("%tu\n", 0); } +void test52() { scanf("%g\n", 8.0L); } +void test53() { scanf("%lg\n", 8.0L); } +void test54() { scanf("%Lg\n", 9.0); } +void test55() { int u; scanf("%s\n", &u); } +void test56() { int u; scanf("%ls\n", &u); } +void test57() { void* v; scanf("%p\n", v); } +void test58() { ushort u; scanf("%n\n", &u); } +void test59() { int u; scanf("%hhn\n", &u); } +void test60() { int u; scanf("%[n", &u); } +void test61() { int u; scanf("%]\n", &u); } +void test62() { int u; scanf("%90s\n", &u); } +void test63() { sscanf("1234", "%d\n", 0L); } +void test64() { fscanf(null, "%d\n", 0L); } + +/* TEST_OUTPUT: +--- +fail_compilation/chkformat.d(301): Deprecation: format specifier `"%K"` is invalid +fail_compilation/chkformat.d(302): Deprecation: format specifier `"%Q"` is invalid +--- +*/ + +import core.stdc.stdarg; + +#line 300 + +void test301() { va_list vargs; vprintf("%K", vargs); } +void test302() { va_list vargs; vscanf("%Q", vargs); } + +// TODO - C++ 11 only: +//void test() { vscanf(); } +//void test() { vfscanf(); } +//void test() { vsscanf(); } diff --git a/gcc/testsuite/gdc.test/fail_compilation/cppmangle.d b/gcc/testsuite/gdc.test/fail_compilation/cppmangle.d index b8b2f03..ca9ed9a 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/cppmangle.d +++ b/gcc/testsuite/gdc.test/fail_compilation/cppmangle.d @@ -2,7 +2,7 @@ TEST_OUTPUT: --- fail_compilation/cppmangle.d(10): Error: invalid zero length C++ namespace -fail_compilation/cppmangle.d(14): Error: expected valid identifer for C++ namespace but got `0num` +fail_compilation/cppmangle.d(14): Error: expected valid identifier for C++ namespace but got `0num` fail_compilation/cppmangle.d(18): Error: string expected following `,` for C++ namespace, not `)` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag11819b.d b/gcc/testsuite/gdc.test/fail_compilation/diag11819b.d index 2280691..a5d6a14 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/diag11819b.d +++ b/gcc/testsuite/gdc.test/fail_compilation/diag11819b.d @@ -14,7 +14,7 @@ fail_compilation/diag11819b.d(37): Error: unrecognized trait `AllMembers`, did y fail_compilation/diag11819b.d(38): Error: unrecognized trait `DerivedMembers`, did you mean `derivedMembers`? fail_compilation/diag11819b.d(39): Error: unrecognized trait `IsSame`, did you mean `isSame`? fail_compilation/diag11819b.d(40): Error: unrecognized trait `Compiles`, did you mean `compiles`? -fail_compilation/diag11819b.d(41): Error: unrecognized trait `Parameters`, did you mean `parameters`? +fail_compilation/diag11819b.d(41): Error: unrecognized trait `Parameters` fail_compilation/diag11819b.d(42): Error: unrecognized trait `GetAliasThis`, did you mean `getAliasThis`? fail_compilation/diag11819b.d(43): Error: unrecognized trait `GetAttributes`, did you mean `getAttributes`? fail_compilation/diag11819b.d(44): Error: unrecognized trait `GetFunctionAttributes`, did you mean `getFunctionAttributes`? diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag13082.d b/gcc/testsuite/gdc.test/fail_compilation/diag13082.d index 13259ce..7360a3df6 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/diag13082.d +++ b/gcc/testsuite/gdc.test/fail_compilation/diag13082.d @@ -1,8 +1,10 @@ /* TEST_OUTPUT: --- -fail_compilation/diag13082.d(22): Error: constructor diag13082.C.this (int a) is not callable using argument types (string) -fail_compilation/diag13082.d(23): Error: constructor diag13082.S.this (int a) is not callable using argument types (string) +fail_compilation/diag13082.d(24): Error: constructor `diag13082.C.this(int a)` is not callable using argument types `(string)` +fail_compilation/diag13082.d(24): cannot pass argument `b` of type `string` to parameter `int a` +fail_compilation/diag13082.d(25): Error: constructor `diag13082.S.this(int a)` is not callable using argument types `(string)` +fail_compilation/diag13082.d(25): cannot pass argument `b` of type `string` to parameter `int a` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag16271.d b/gcc/testsuite/gdc.test/fail_compilation/diag16271.d new file mode 100644 index 0000000..b85dc8d --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/diag16271.d @@ -0,0 +1,12 @@ +/* +TEST_OUTPUT +--- +fail_compilation/diag16271.d(10): Error: found `x` when expecting function literal following `ref` +--- +*/ + +void main() +{ + auto fun = ref x; +} + diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag8101.d b/gcc/testsuite/gdc.test/fail_compilation/diag8101.d index 6fc3809..3b2401a 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/diag8101.d +++ b/gcc/testsuite/gdc.test/fail_compilation/diag8101.d @@ -1,29 +1,30 @@ /* TEST_OUTPUT: --- -fail_compilation/diag8101.d(56): Error: function diag8101.f_0 (int) is not callable using argument types () -fail_compilation/diag8101.d(57): Error: none of the overloads of 'f_1' are callable using argument types (), candidates are: -fail_compilation/diag8101.d(32): diag8101.f_1(int) -fail_compilation/diag8101.d(33): diag8101.f_1(int, int) -fail_compilation/diag8101.d(58): Error: none of the overloads of 'f_2' are callable using argument types (), candidates are: -fail_compilation/diag8101.d(35): diag8101.f_2(int) -fail_compilation/diag8101.d(36): diag8101.f_2(int, int) -fail_compilation/diag8101.d(37): diag8101.f_2(int, int, int) -fail_compilation/diag8101.d(38): diag8101.f_2(int, int, int, int) -fail_compilation/diag8101.d(39): diag8101.f_2(int, int, int, int, int) -fail_compilation/diag8101.d(58): ... (1 more, -v to show) ... -fail_compilation/diag8101.d(60): Error: template diag8101.t_0 cannot deduce function from argument types !()(), candidates are: -fail_compilation/diag8101.d(42): diag8101.t_0(T1)() -fail_compilation/diag8101.d(61): Error: template diag8101.t_1 cannot deduce function from argument types !()(), candidates are: -fail_compilation/diag8101.d(44): diag8101.t_1(T1)() -fail_compilation/diag8101.d(45): diag8101.t_1(T1, T2)() -fail_compilation/diag8101.d(62): Error: template diag8101.t_2 cannot deduce function from argument types !()(), candidates are: -fail_compilation/diag8101.d(47): diag8101.t_2(T1)() -fail_compilation/diag8101.d(48): diag8101.t_2(T1, T2)() -fail_compilation/diag8101.d(49): diag8101.t_2(T1, T2, T3)() -fail_compilation/diag8101.d(50): diag8101.t_2(T1, T2, T3, T4)() -fail_compilation/diag8101.d(51): diag8101.t_2(T1, T2, T3, T4, T5)() -fail_compilation/diag8101.d(62): ... (1 more, -v to show) ... +fail_compilation/diag8101.d(57): Error: function `diag8101.f_0(int)` is not callable using argument types `()` +fail_compilation/diag8101.d(57): missing argument for parameter #1: `int` +fail_compilation/diag8101.d(58): Error: none of the overloads of `f_1` are callable using argument types `()`, candidates are: +fail_compilation/diag8101.d(33): `diag8101.f_1(int)` +fail_compilation/diag8101.d(34): `diag8101.f_1(int, int)` +fail_compilation/diag8101.d(59): Error: none of the overloads of `f_2` are callable using argument types `()`, candidates are: +fail_compilation/diag8101.d(36): `diag8101.f_2(int)` +fail_compilation/diag8101.d(37): `diag8101.f_2(int, int)` +fail_compilation/diag8101.d(38): `diag8101.f_2(int, int, int)` +fail_compilation/diag8101.d(39): `diag8101.f_2(int, int, int, int)` +fail_compilation/diag8101.d(40): `diag8101.f_2(int, int, int, int, int)` +fail_compilation/diag8101.d(59): ... (1 more, -v to show) ... +fail_compilation/diag8101.d(61): Error: template `diag8101.t_0` cannot deduce function from argument types `!()()`, candidates are: +fail_compilation/diag8101.d(43): `diag8101.t_0(T1)()` +fail_compilation/diag8101.d(62): Error: template `diag8101.t_1` cannot deduce function from argument types `!()()`, candidates are: +fail_compilation/diag8101.d(45): `diag8101.t_1(T1)()` +fail_compilation/diag8101.d(46): `diag8101.t_1(T1, T2)()` +fail_compilation/diag8101.d(63): Error: template `diag8101.t_2` cannot deduce function from argument types `!()()`, candidates are: +fail_compilation/diag8101.d(48): `diag8101.t_2(T1)()` +fail_compilation/diag8101.d(49): `diag8101.t_2(T1, T2)()` +fail_compilation/diag8101.d(50): `diag8101.t_2(T1, T2, T3)()` +fail_compilation/diag8101.d(51): `diag8101.t_2(T1, T2, T3, T4)()` +fail_compilation/diag8101.d(52): `diag8101.t_2(T1, T2, T3, T4, T5)()` +fail_compilation/diag8101.d(63): ... (1 more, -v to show) ... --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag8101b.d b/gcc/testsuite/gdc.test/fail_compilation/diag8101b.d index a3baa27..228ba16 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/diag8101b.d +++ b/gcc/testsuite/gdc.test/fail_compilation/diag8101b.d @@ -1,14 +1,15 @@ /* TEST_OUTPUT: --- -fail_compilation/diag8101b.d(26): Error: none of the overloads of 'foo' are callable using argument types (double), candidates are: -fail_compilation/diag8101b.d(17): diag8101b.S.foo(int _param_0) -fail_compilation/diag8101b.d(18): diag8101b.S.foo(int _param_0, int _param_1) -fail_compilation/diag8101b.d(28): Error: function diag8101b.S.bar (int _param_0) is not callable using argument types (double) -fail_compilation/diag8101b.d(31): Error: none of the overloads of 'foo' are callable using a const object, candidates are: -fail_compilation/diag8101b.d(17): diag8101b.S.foo(int _param_0) -fail_compilation/diag8101b.d(18): diag8101b.S.foo(int _param_0, int _param_1) -fail_compilation/diag8101b.d(33): Error: mutable method diag8101b.S.bar is not callable using a const object +fail_compilation/diag8101b.d(27): Error: none of the overloads of `foo` are callable using argument types `(double)`, candidates are: +fail_compilation/diag8101b.d(18): `diag8101b.S.foo(int _param_0)` +fail_compilation/diag8101b.d(19): `diag8101b.S.foo(int _param_0, int _param_1)` +fail_compilation/diag8101b.d(29): Error: function `diag8101b.S.bar(int _param_0)` is not callable using argument types `(double)` +fail_compilation/diag8101b.d(29): cannot pass argument `1.00000` of type `double` to parameter `int _param_0` +fail_compilation/diag8101b.d(32): Error: none of the overloads of `foo` are callable using a `const` object, candidates are: +fail_compilation/diag8101b.d(18): `diag8101b.S.foo(int _param_0)` +fail_compilation/diag8101b.d(19): `diag8101b.S.foo(int _param_0, int _param_1)` +fail_compilation/diag8101b.d(34): Error: mutable method `diag8101b.S.bar` is not callable using a `const` object --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag9420.d b/gcc/testsuite/gdc.test/fail_compilation/diag9420.d index dfaf7c8..6b2577d 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/diag9420.d +++ b/gcc/testsuite/gdc.test/fail_compilation/diag9420.d @@ -1,7 +1,8 @@ /* TEST_OUTPUT --- -fail_compilation/diag9420.d(20): Error: function diag9420.S.t3!().tx () is not callable using argument types (int) +fail_compilation/diag9420.d(21): Error: function `diag9420.S.t3!().tx()` is not callable using argument types `(int)` +fail_compilation/diag9420.d(21): expected 0 argument(s), not 1 --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail11038.d b/gcc/testsuite/gdc.test/fail_compilation/fail11038.d new file mode 100644 index 0000000..8f39ccc --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/fail11038.d @@ -0,0 +1,17 @@ +// https://issues.dlang.org/show_bug.cgi?id=11038 +/* +TEST_OUTPUT: +--- +fail_compilation/fail11038.d(16): Error: `writeln` is not defined, perhaps `import std.stdio;` is needed? +--- +*/ + +static +{ + import std.stdio; +} + +void main() +{ + writeln("foo"); // compiles +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail11445.d b/gcc/testsuite/gdc.test/fail_compilation/fail11445.d index a3cfc11..ed3f226 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail11445.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail11445.d @@ -1,7 +1,7 @@ /* TEST_OUTPUT: --- -fail_compilation/fail11445.d(11): Error: incompatible types for ((a) + (b)): 'double[string]' and 'double[string]' +fail_compilation/fail11445.d(11): Error: incompatible types for ((a) + (b)): both operands are of type 'double[string]' --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail15361.d b/gcc/testsuite/gdc.test/fail_compilation/fail15361.d new file mode 100644 index 0000000..8e5f980 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/fail15361.d @@ -0,0 +1,8 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail15361.d(8): Error: unexpected `(` after `errorize`, inside `is` expression. Try enclosing the contents of `is` with a `typeof` expression +--- +*/ + +enum isErrorizable(T) = is(errorize(T.init)); diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail15896.d b/gcc/testsuite/gdc.test/fail_compilation/fail15896.d new file mode 100644 index 0000000..e52503d --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/fail15896.d @@ -0,0 +1,18 @@ +// REQUIRED_ARGS: -de +// EXTRA_FILES: imports/imp15896.d +/* +TEST_OUTPUT: +--- +fail_compilation/fail15896.d(11): Error: module `imports.imp15896` member `thebar` is not visible from module `fail15896` +fail_compilation/fail15896.d(11): Error: module `imports.imp15896` member `packagebar` is not visible from module `fail15896` +--- +*/ + +import imports.imp15896 : thebar, packagebar; + +int func() +{ + thebar +=1; + packagebar += 1; + return 0; +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail17630.d b/gcc/testsuite/gdc.test/fail_compilation/fail17630.d new file mode 100644 index 0000000..9b6ed82 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/fail17630.d @@ -0,0 +1,15 @@ +// REQUIRED_ARGS: -de +// EXTRA_FILES: imports/a17630.d +// EXTRA_SOURCES: imports/b17630.d +/* +TEST_OUTPUT: +--- +fail_compilation/fail17630.d(13): Error: module `a17630` import `Erase` not found, did you mean variable `b17630.Erase`? +--- +*/ + +void main() +{ + import imports.a17630 : Erase; + assert(Erase == 2); +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail18219.d b/gcc/testsuite/gdc.test/fail_compilation/fail18219.d new file mode 100644 index 0000000..f3ec680 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/fail18219.d @@ -0,0 +1,20 @@ +// EXTRA_SOURCES: imports/b18219.d +// EXTRA_FILES: imports/a18219.d +/* +TEST_OUTPUT: +--- +fail_compilation/fail18219.d(16): Error: no property `Foobar` for type `AST`, did you mean `b18219.Foobar`? +fail_compilation/fail18219.d(17): Error: no property `Bar` for type `a18219.AST` +fail_compilation/fail18219.d(18): Error: no property `fun` for type `AST`, did you mean `b18219.fun`? +fail_compilation/fail18219.d(19): Error: no property `Foobar` for type `AST`, did you mean `b18219.Foobar`? +--- +*/ +import imports.a18219; + +void main() +{ + AST.Foobar t; + AST.Bar l; + AST.fun(); + AST.Foobar.smeth(); +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail19107.d b/gcc/testsuite/gdc.test/fail_compilation/fail19107.d new file mode 100644 index 0000000..c748650 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/fail19107.d @@ -0,0 +1,21 @@ +// REQUIRED_ARGS: +/* +TEST_OUTPUT: +--- +fail_compilation/test19107.d(20): Error: template `test19107.all` cannot deduce function from argument types `!((c) => c)(string[])`, candidates are: +fail_compilation/test19107.d(14): `test19107.all(alias pred, T)(T t) if (is(typeof(I!pred(t))))` +--- +*/ + +// https://issues.dlang.org/show_bug.cgi?id=19107 + +import imports.test19107b; + +void all(alias pred, T)(T t) + if (is(typeof(I!pred(t)))) +{ } + +void main(string[] args) +{ + args.all!(c => c); +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail263.d b/gcc/testsuite/gdc.test/fail_compilation/fail263.d index f7dfe21..8cf9b20 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail263.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail263.d @@ -1,7 +1,8 @@ /* TEST_OUTPUT: --- -fail_compilation/fail263.d(18): Error: function fail263.f (byte* p) is not callable using argument types (const(byte)*) +fail_compilation/fail263.d(19): Error: function `fail263.f(byte* p)` is not callable using argument types `(const(byte)*)` +fail_compilation/fail263.d(19): cannot pass argument `cast(const(byte)*)A` of type `const(byte)*` to parameter `byte* p` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail3.d b/gcc/testsuite/gdc.test/fail_compilation/fail3.d index 332e561..0b7516c 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail3.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail3.d @@ -1,7 +1,7 @@ /* TEST_OUTPUT: --- -fail_compilation/fail3.d(40): Error: incompatible types for ((a) + (b)): 'vec2' and 'vec2' +fail_compilation/fail3.d(41): Error: incompatible types for ((a) + (b)): both operands are of type 'vec2' --- */ @@ -14,6 +14,7 @@ template vector(T) T x, y; } + // not struct member vec2 opAdd(vec2 a, vec2 b) { vec2 r; diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail322.d b/gcc/testsuite/gdc.test/fail_compilation/fail322.d index 0ffa15a..491111f 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail322.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail322.d @@ -1,13 +1,18 @@ /* TEST_OUTPUT: --- -fail_compilation/fail322.d(10): Error: function fail322.digestToString2 (ref char[16] digest) is not callable using argument types (string) +fail_compilation/fail322.d(13): Error: function `fail322.digestToString2(ref char[16] digest)` is not callable using argument types `(string)` +fail_compilation/fail322.d(13): cannot pass rvalue argument `"1234567890123456"` of type `string` to parameter `ref char[16] digest` +fail_compilation/fail322.d(15): Error: function `fail322.digestToString2(ref char[16] digest)` is not callable using argument types `(const(char[16]))` +fail_compilation/fail322.d(15): cannot pass argument `s` of type `const(char[16])` to parameter `ref char[16] digest` --- */ void main() { digestToString2("1234567890123456"); + const char[16] s; + digestToString2(s); } void digestToString2(ref char[16] digest) diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail332.d b/gcc/testsuite/gdc.test/fail_compilation/fail332.d index 03f3706..91f8046 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail332.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail332.d @@ -1,15 +1,56 @@ /* TEST_OUTPUT: --- -fail_compilation/fail332.d(14): Error: function fail332.foo (int _param_0, ...) is not callable using argument types () +fail_compilation/fail332.d(22): Error: function `fail332.foo(int _param_0, ...)` is not callable using argument types `()` +fail_compilation/fail332.d(22): missing argument for parameter #1: `int _param_0` +fail_compilation/fail332.d(23): Error: function `fail332.foo(int _param_0, ...)` is not callable using argument types `(typeof(null))` +fail_compilation/fail332.d(23): cannot pass argument `null` of type `typeof(null)` to parameter `int _param_0` +fail_compilation/fail332.d(25): Error: function `fail332.baz(int[] _param_0...)` is not callable using argument types `(string)` +fail_compilation/fail332.d(25): cannot pass argument `""` of type `string` to parameter `int[] _param_0...` +fail_compilation/fail332.d(26): Error: function `fail332.baz(int[] _param_0...)` is not callable using argument types `(int, typeof(null))` +fail_compilation/fail332.d(26): cannot pass argument `null` of type `typeof(null)` to parameter `int[] _param_0...` --- */ import core.vararg; void foo(int, ...) {} +void baz(int[]...) {} -void bar() +void test() { foo(); + foo(null); + + baz(""); + baz(3, null); +} + +/* +TEST_OUTPUT: +--- +fail_compilation/fail332.d(50): Error: function `fail332.bar(Object, int[2]...)` is not callable using argument types `()` +fail_compilation/fail332.d(50): missing argument for parameter #1: `Object` +fail_compilation/fail332.d(51): Error: function `fail332.bar(Object, int[2]...)` is not callable using argument types `(int)` +fail_compilation/fail332.d(51): cannot pass argument `4` of type `int` to parameter `Object` +fail_compilation/fail332.d(52): Error: function `fail332.bar(Object, int[2]...)` is not callable using argument types `(typeof(null))` +fail_compilation/fail332.d(52): expected 2 variadic argument(s), not 0 +fail_compilation/fail332.d(53): Error: function `fail332.bar(Object, int[2]...)` is not callable using argument types `(typeof(null), int)` +fail_compilation/fail332.d(53): expected 2 variadic argument(s), not 1 +fail_compilation/fail332.d(54): Error: function `fail332.bar(Object, int[2]...)` is not callable using argument types `(typeof(null), int, string)` +fail_compilation/fail332.d(54): cannot pass argument `""` of type `string` to parameter `int[2]...` +fail_compilation/fail332.d(55): Error: function `fail332.bar(Object, int[2]...)` is not callable using argument types `(typeof(null), int, int, int)` +fail_compilation/fail332.d(55): expected 2 variadic argument(s), not 3 +--- +*/ +void bar(Object, int[2]...); + +void test2() +{ + bar(); + bar(4); + bar(null); + bar(null, 2); + bar(null, 2, ""); + bar(null, 2,3,4); } diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail347.d b/gcc/testsuite/gdc.test/fail_compilation/fail347.d index 03ae703..61718df 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail347.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail347.d @@ -2,7 +2,7 @@ TEST_OUTPUT: --- fail_compilation/fail347.d(21): Error: undefined identifier `bbr`, did you mean variable `bar`? -fail_compilation/fail347.d(22): Error: no property 'ofo' for type 'S', did you mean 'foo'? +fail_compilation/fail347.d(22): Error: no property 'ofo' for type 'S', did you mean 'fail347.S.foo'? fail_compilation/fail347.d(23): Error: undefined identifier `strlenx`, did you mean function `strlen`? --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail53.d b/gcc/testsuite/gdc.test/fail_compilation/fail53.d index 2570dd8..556896c 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail53.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail53.d @@ -1,7 +1,8 @@ /* TEST_OUTPUT: --- -fail_compilation/fail53.d(25): Error: function object.Object.opEquals (Object o) is not callable using argument types (int) +fail_compilation/fail53.d(26): Error: function `object.Object.opEquals(Object o)` is not callable using argument types `(int)` +fail_compilation/fail53.d(26): cannot pass argument `i` of type `int` to parameter `Object o` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail55.d b/gcc/testsuite/gdc.test/fail_compilation/fail55.d index 57117d8..290c2b66 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail55.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail55.d @@ -1,7 +1,8 @@ /* TEST_OUTPUT: --- -fail_compilation/fail55.d(22): Error: function object.Object.opCmp (Object o) is not callable using argument types (int) +fail_compilation/fail55.d(23): Error: function `object.Object.opCmp(Object o)` is not callable using argument types `(int)` +fail_compilation/fail55.d(23): cannot pass argument `0` of type `int` to parameter `Object o` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail79.d b/gcc/testsuite/gdc.test/fail_compilation/fail79.d index 46581d9..da06984 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail79.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail79.d @@ -1,7 +1,7 @@ /* TEST_OUTPUT: --- -fail_compilation/fail79.d(13): Error: incompatible types for ((& a) + (& b)): 'int*' and 'int*' +fail_compilation/fail79.d(13): Error: incompatible types for ((& a) + (& b)): both operands are of type 'int*' --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail99.d b/gcc/testsuite/gdc.test/fail_compilation/fail99.d index da87ed6..c147b81 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail99.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail99.d @@ -1,7 +1,8 @@ /* TEST_OUTPUT: --- -fail_compilation/fail99.d(12): Error: delegate dg (int) is not callable using argument types () +fail_compilation/fail99.d(13): Error: delegate `dg(int)` is not callable using argument types `()` +fail_compilation/fail99.d(13): missing argument for parameter #1: `int` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fix21585.d b/gcc/testsuite/gdc.test/fail_compilation/fix21585.d new file mode 100644 index 0000000..48c74cb --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/fix21585.d @@ -0,0 +1,19 @@ +/* https://issues.dlang.org/show_bug.cgi?id=21585 +TEST_OUTPUT: +--- +fail_compilation/fix21585.d(103): Error: expected 1 arguments for `toType` but had 0 +fail_compilation/fix21585.d(104): Error: expression expected as second argument of __traits `toType` +fail_compilation/fix21585.d(105): Error: `string` expected for __traits(toType, string), not `(1)` of type `int` +fail_compilation/fix21585.d(106): Error: cannot determine `__traits(toType, "hello betty")` +--- +*/ + +#line 100 + +template Type(T) { alias Type = T; } + +alias T1 = Type!(__traits(toType)); +alias T2 = Type!(__traits(toType, int)); +alias T3 = Type!(__traits(toType, 1)); +alias T4 = Type!(__traits(toType, "hello betty")); + diff --git a/gcc/testsuite/gdc.test/fail_compilation/format.d b/gcc/testsuite/gdc.test/fail_compilation/format.d new file mode 100644 index 0000000..3a24227 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/format.d @@ -0,0 +1,44 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/format.d(101): Error: function `format.printf1` `pragma(printf)` functions must be `extern(C) void printf1([parameters...], const(char)*, ...)` not `void(const(char)*, ...)` +fail_compilation/format.d(102): Error: function `format.printf2` `pragma(printf)` functions must be `extern(C) int printf2([parameters...], const(char)*, ...)` not `extern (C) int(const(int)*, ...)` +fail_compilation/format.d(103): Error: function `format.printf3` `pragma(printf)` functions must be `extern(C) int printf3([parameters...], const(char)*, va_list)` +fail_compilation/format.d(104): Error: function `format.printf4` `pragma(printf)` functions must be `extern(C) int printf4([parameters...], const(char)*, ...)` not `extern (C) int(const(char)*, int, ...)` +--- + */ + +#line 100 + +pragma(printf) void printf1(const(char)*, ...); +pragma(printf) extern (C) int printf2(const(int )*, ...); +pragma(printf) extern (C) int printf3(const(char)*); +pragma(printf) extern (C) int printf4(const(char)*, int, ...); + +pragma(printf) extern (C) int printf5(const(char)*, ...); +pragma(printf) extern (C) int printf6(immutable(char)*, ...); +pragma(printf) extern (C) int printf7(char*, ...); + +/* +TEST_OUTPUT: +--- +fail_compilation/format.d(203): Error: function `format.vprintf1` `pragma(printf)` functions must be `extern(C) void vprintf1([parameters...], const(char)*, va_list)` +fail_compilation/format.d(204): Error: function `format.vprintf2` `pragma(printf)` functions must be `extern(C) int vprintf2([parameters...], const(char)*, va_list)` +fail_compilation/format.d(205): Error: function `format.vprintf3` `pragma(printf)` functions must be `extern(C) int vprintf3([parameters...], const(char)*, va_list)` +fail_compilation/format.d(206): Error: function `format.vprintf4` `pragma(printf)` functions must be `extern(C) int vprintf4([parameters...], const(char)*, va_list)` +--- + */ + +#line 200 + +import core.stdc.stdarg; + +pragma(printf) void vprintf1(const(char)*, va_list); +pragma(printf) extern (C) int vprintf2(const(int )*, va_list); +pragma(printf) extern (C) int vprintf3(const(char)*); +pragma(printf) extern (C) int vprintf4(const(char)*, int, va_list); + +pragma(printf) extern (C) int vprintf5(const(char)*, va_list); +pragma(printf) extern (C) int vprintf6(immutable(char)*, va_list); +pragma(printf) extern (C) int vprintf7(char*, va_list); + diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice10598.d b/gcc/testsuite/gdc.test/fail_compilation/ice10598.d new file mode 100644 index 0000000..ba6cdf7 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/ice10598.d @@ -0,0 +1,10 @@ +// REQUIRED_ARGS: -de +// EXTRA_SOURCES: imports/ice10598a.d imports/ice10598b.d +/* TEST_OUTPUT: +--- +fail_compilation/imports/ice10598a.d(5): Deprecation: module imports.ice10598b is not accessible here, perhaps add 'static import imports.ice10598b;' +fail_compilation/imports/ice10598a.d(5): Deprecation: module imports.ice10598b is not accessible here, perhaps add 'static import imports.ice10598b;' +--- +*/ + +void main() {} diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice10922.d b/gcc/testsuite/gdc.test/fail_compilation/ice10922.d index 1ddad18..9eeb622 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/ice10922.d +++ b/gcc/testsuite/gdc.test/fail_compilation/ice10922.d @@ -1,7 +1,8 @@ /* TEST_OUTPUT: --- -fail_compilation/ice10922.d(9): Error: function ice10922.__lambda4 (const(uint) n) is not callable using argument types () +fail_compilation/ice10922.d(10): Error: function `ice10922.__lambda4(const(uint) n)` is not callable using argument types `()` +fail_compilation/ice10922.d(10): missing argument for parameter #1: `const(uint) n` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice12497.d b/gcc/testsuite/gdc.test/fail_compilation/ice12497.d deleted file mode 100644 index ab95e81..0000000 --- a/gcc/testsuite/gdc.test/fail_compilation/ice12497.d +++ /dev/null @@ -1,18 +0,0 @@ -/* -TEST_OUTPUT: ---- -fail_compilation/ice12497.d(15): Error: string expected for argument to mixin, not (foo()) of type void -fail_compilation/ice12497.d(17): Error: string expected for argument to mixin, not (foo()) of type void ---- -*/ - -void foo() {} - -void main() -{ - struct S - { - mixin(foo()); // MixinDeclaration - } - mixin(foo()); // MixinStatement -} diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice12501.d b/gcc/testsuite/gdc.test/fail_compilation/ice12501.d index f57980d..2c45c8a 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/ice12501.d +++ b/gcc/testsuite/gdc.test/fail_compilation/ice12501.d @@ -1,9 +1,11 @@ /* TEST_OUTPUT: --- -fail_compilation/ice12501.d(29): Error: function ice12501.foo (int value) is not callable using argument types (int, int) -fail_compilation/ice12501.d(29): Error: function ice12501.foo (int value) is not callable using argument types (int, int) -fail_compilation/ice12501.d(43): Error: template instance ice12501.reduce!(foo, foo).reduce!(Tuple!(int, int), int[]) error instantiating +fail_compilation/ice12501.d(31): Error: function `ice12501.foo(int value)` is not callable using argument types `(int, int)` +fail_compilation/ice12501.d(31): expected 1 argument(s), not 2 +fail_compilation/ice12501.d(31): Error: function `ice12501.foo(int value)` is not callable using argument types `(int, int)` +fail_compilation/ice12501.d(31): expected 1 argument(s), not 2 +fail_compilation/ice12501.d(45): Error: template instance `ice12501.reduce!(foo, foo).reduce!(Tuple!(int, int), int[])` error instantiating --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice14907.d b/gcc/testsuite/gdc.test/fail_compilation/ice14907.d new file mode 100644 index 0000000..6d9edf0 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/ice14907.d @@ -0,0 +1,22 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/ice14907.d(14): Error: struct ice14907.S(int v = S) recursive template expansion +fail_compilation/ice14907.d(19): while looking for match for `S!()` +fail_compilation/ice14907.d(15): Error: template ice14907.f(int v = f)() recursive template expansion +fail_compilation/ice14907.d(20): while looking for match for `f!()` +fail_compilation/ice14907.d(15): Error: template ice14907.f(int v = f)() recursive template expansion +fail_compilation/ice14907.d(21): Error: template `ice14907.f` cannot deduce function from argument types `!()()`, candidates are: +fail_compilation/ice14907.d(15): `ice14907.f(int v = f)()` +--- +*/ + +struct S(int v = S) {} +void f(int v = f)() {} + +void main() +{ + S!() s; // OK <- ICE + f!()(); // OK <- ICE + f(); // OK <- ICE +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice14923.d b/gcc/testsuite/gdc.test/fail_compilation/ice14923.d index 86e3b2a..e3b677e 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/ice14923.d +++ b/gcc/testsuite/gdc.test/fail_compilation/ice14923.d @@ -1,8 +1,9 @@ /* TEST_OUTPUT: --- -fail_compilation/ice14923.d(21): Error: function ice14923.parse (C a) is not callable using argument types (A) -fail_compilation/ice14923.d(21): instantiated from here: bar!((b) => parse(b)) +fail_compilation/ice14923.d(22): Error: function `ice14923.parse(C a)` is not callable using argument types `(A)` +fail_compilation/ice14923.d(22): cannot pass argument `b` of type `ice14923.A` to parameter `C a` +fail_compilation/ice14923.d(22): instantiated from here: `bar!((b) => parse(b))` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice8255.d b/gcc/testsuite/gdc.test/fail_compilation/ice8255.d index d98e38a..0db3abc 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/ice8255.d +++ b/gcc/testsuite/gdc.test/fail_compilation/ice8255.d @@ -1,8 +1,9 @@ /* TEST_OUTPUT: --- -fail_compilation/ice8255.d(10): Error: function ice8255.F!(G).F.f (ref G _param_0) is not callable using argument types (G) -fail_compilation/ice8255.d(10): while evaluating pragma(msg, F().f(G())) +fail_compilation/ice8255.d(11): Error: function `ice8255.F!(G).F.f(ref G _param_0)` is not callable using argument types `(G)` +fail_compilation/ice8255.d(11): cannot pass rvalue argument `G()` of type `G` to parameter `ref G _param_0` +fail_compilation/ice8255.d(11): while evaluating `pragma(msg, F().f(G()))` --- */ struct G {} diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice9540.d b/gcc/testsuite/gdc.test/fail_compilation/ice9540.d index d6c9cda..f95cb97 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/ice9540.d +++ b/gcc/testsuite/gdc.test/fail_compilation/ice9540.d @@ -1,8 +1,9 @@ /* TEST_OUTPUT: --- -fail_compilation/ice9540.d(34): Error: function ice9540.A.test.AddFront!(this, f).AddFront.dg (int _param_0) is not callable using argument types () -fail_compilation/ice9540.d(25): Error: template instance ice9540.A.test.AddFront!(this, f) error instantiating +fail_compilation/ice9540.d(35): Error: function `ice9540.A.test.AddFront!(this, f).AddFront.dg(int _param_0)` is not callable using argument types `()` +fail_compilation/ice9540.d(35): missing argument for parameter #1: `int _param_0` +fail_compilation/ice9540.d(26): Error: template instance `ice9540.A.test.AddFront!(this, f)` error instantiating --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/a17630.d b/gcc/testsuite/gdc.test/fail_compilation/imports/a17630.d new file mode 100644 index 0000000..c104841 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/imports/a17630.d @@ -0,0 +1,3 @@ +module a17630; + +import b17630; diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/a18219.d b/gcc/testsuite/gdc.test/fail_compilation/imports/a18219.d new file mode 100644 index 0000000..1a88493 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/imports/a18219.d @@ -0,0 +1,6 @@ +module a18219; + +struct AST +{ + import b18219; +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/b17630.d b/gcc/testsuite/gdc.test/fail_compilation/imports/b17630.d new file mode 100644 index 0000000..5ad5f99 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/imports/b17630.d @@ -0,0 +1,3 @@ +module b17630; + +int Erase; diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/b18219.d b/gcc/testsuite/gdc.test/fail_compilation/imports/b18219.d new file mode 100644 index 0000000..6008c8a --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/imports/b18219.d @@ -0,0 +1,15 @@ +module b18219; + +class Foobar +{ + int a; + this(int a) + { + this.a = a; + } + static int smeth() + { + return 1; + } +} +void fun() {} diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/ice10598a.d b/gcc/testsuite/gdc.test/fail_compilation/imports/ice10598a.d new file mode 100644 index 0000000..b0e9c3b --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/imports/ice10598a.d @@ -0,0 +1,5 @@ +module imports.ice10598a; + +template TypeTuple(TL...) { alias TL TypeTuple; } + +alias TypeTuple!(__traits(getMember, imports.ice10598b, (__traits(allMembers, imports.ice10598b)[1])))[0] notImportedType; diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/ice10598b.d b/gcc/testsuite/gdc.test/fail_compilation/imports/ice10598b.d new file mode 100644 index 0000000..de50787 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/imports/ice10598b.d @@ -0,0 +1,3 @@ +module imports.ice10598b; + +struct LocalType {} diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/imp15896.d b/gcc/testsuite/gdc.test/fail_compilation/imports/imp15896.d new file mode 100644 index 0000000..d7edcc1 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/imports/imp15896.d @@ -0,0 +1,4 @@ +module imports.imp15896; + +private int thebar=4; +package int packagebar=3; diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/test21651b.d b/gcc/testsuite/gdc.test/fail_compilation/imports/test21651b.d new file mode 100644 index 0000000..4c85aad --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/imports/test21651b.d @@ -0,0 +1,3 @@ +module imports.test21651b; + +alias T = int; diff --git a/gcc/testsuite/gdc.test/fail_compilation/issue16020.d b/gcc/testsuite/gdc.test/fail_compilation/issue16020.d new file mode 100644 index 0000000..75e3b9f --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/issue16020.d @@ -0,0 +1,13 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/issue16020.d(12): Error: user-defined attributes not allowed for `alias` declarations +fail_compilation/issue16020.d(13): Error: semicolon expected to close `alias` declaration +fail_compilation/issue16020.d(13): Error: declaration expected, not `(` +--- +*/ +module issue16020; + +struct UDA{} +alias Fun = @UDA void(); +alias FunTemplate = void(T)(T t); diff --git a/gcc/testsuite/gdc.test/fail_compilation/mixintype2.d b/gcc/testsuite/gdc.test/fail_compilation/mixintype2.d new file mode 100644 index 0000000..b18627d --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/mixintype2.d @@ -0,0 +1,16 @@ + +/* TEST_OUTPUT: +--- +fail_compilation/mixintype2.d(10): Error: alias `mixintype2.Foo.T` recursive alias declaration +fail_compilation/mixintype2.d(16): Error: `mixin(0)` does not give a valid type +--- +*/ + +struct Foo { + alias T = mixin("T2"); +} +alias T1 = mixin("Foo.T"); +alias T2 = mixin("T1"); +void func (T2 p) {} + +enum mixin(0) a = 0; diff --git a/gcc/testsuite/gdc.test/fail_compilation/test16002.d b/gcc/testsuite/gdc.test/fail_compilation/test16002.d deleted file mode 100644 index 80ae40b..0000000 --- a/gcc/testsuite/gdc.test/fail_compilation/test16002.d +++ /dev/null @@ -1,15 +0,0 @@ -/* -REQUIRED_ARGS: -PERMUTE_ARGS: -TEST_OUTPUT: ---- -fail_compilation/test16002.d(100): Error: undefined identifier `imports.nonexistent` -fail_compilation/test16002.d(101): Error: undefined identifier `imports.nonexistent` ---- -*/ - -module test.fail_compilation.test16002; - -#line 100 -enum A = is(imports.nonexistent == package); -enum B = is(imports.nonexistent == module); diff --git a/gcc/testsuite/gdc.test/fail_compilation/test21651.d b/gcc/testsuite/gdc.test/fail_compilation/test21651.d new file mode 100644 index 0000000..a4d959f --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/test21651.d @@ -0,0 +1,11 @@ +// REQUIRED_ARGS: -de +// EXTRA_SOURCES: imports/test21651b.d +/* TEST_OUTPUT: +--- +fail_compilation/test21651.d(11): Deprecation: module imports.test21651b is not accessible here, perhaps add 'static import imports.test21651b;' +--- +*/ + +module imports.test21651; + +imports.test21651b.T a; diff --git a/gcc/testsuite/gdc.test/fail_compilation/warn12809.d b/gcc/testsuite/gdc.test/fail_compilation/warn12809.d index 100f0fb..06c998d 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/warn12809.d +++ b/gcc/testsuite/gdc.test/fail_compilation/warn12809.d @@ -32,3 +32,44 @@ void test_unrachable3() int x = 1; // unreachable } + +/********************************************/ + +/* +TEST_OUTPUT: +--- +fail_compilation/warn12809.d(108): Warning: statement is not reachable +fail_compilation/warn12809.d(115): Warning: statement is not reachable +fail_compilation/warn12809.d(122): Warning: statement is not reachable +Error: warnings are treated as errors + Use -wi if you wish to treat warnings only as informational. +--- +*/ + +#line 100 + +alias noreturn = typeof(*null); + +noreturn foo(); + +void test1(ref int i) +{ + foo(); + i = 3; +} + +void test2() +{ + try foo(); + finally { } + int x = 1; +} + +void test3() +{ + try { } + finally foo(); + int x = 1; +} + + diff --git a/gcc/testsuite/gdc.test/runnable/funclit.d b/gcc/testsuite/gdc.test/runnable/funclit.d index d45e3e6d..c299bad 100644 --- a/gcc/testsuite/gdc.test/runnable/funclit.d +++ b/gcc/testsuite/gdc.test/runnable/funclit.d @@ -1242,6 +1242,66 @@ void test15794() } /***************************************************/ +// https://issues.dlang.org/show_bug.cgi?id=16271 + +ref auto funa16271(alias dg, T)(ref T a) +{ + return dg(a); +} + +ref auto func16271(alias dg)() +{ + return dg(); +} + +void assign16271(T)(ref T a, T b) +{ + alias fun = ref (ref a) => a; + fun(a) = b; +} + +void test16271() +{ + int x; + (ref () => x )() = 1; assert(x == 1); + func16271!(ref () => x) = 2; assert(x == 2); + assign16271(x, 3); assert(x == 3); + + alias alx = func16271!(ref () => x); + alx = 4; assert(x == 4); + + alias alf = ref (ref a) => a; + auto auf = ref (ref int a) => a; + alf(x) = 5; assert(x == 5); + auf(x) = 6; assert(x == 6); + + assert((funa16271!( ref (ref a) => a)(x) += 1) == 7 ); + assert((funa16271!(function ref (ref a) => a)(x) += 1) == 8 ); + assert((funa16271!(function ref int(ref a) => a)(x) += 1) == 9 ); + assert((funa16271!(delegate ref (ref a) => a)(x) += 1) == 10); + assert((funa16271!(delegate ref int(ref a) => a)(x) += 1) == 11); + assert(x == 11); + + alias aldc = ref () @trusted @nogc { return x; }; + auto audc = ref () @safe nothrow { return x; }; + alias alfuc = function ref (ref x) @trusted { return x; }; + alias aldec = delegate ref () @trusted { return x; }; + aldc() = 12; assert(x == 12); + audc() = 13; assert(x == 13); + alfuc(x) = 14; assert(x == 14); + aldec() = 15; assert(x == 15); + + template T() + { + int x; + alias alf = ref () => x; + auto auf = ref () => x; + } + T!().alf() = 1; assert(T!().x == 1); + T!().auf() = 2; assert(T!().x == 2); +} + +/***************************************************/ int main() { @@ -1299,6 +1359,7 @@ int main() test13879(); test14745(); test15794(); + test16271(); printf("Success\n"); return 0; diff --git a/gcc/testsuite/gdc.test/runnable/mangle.d b/gcc/testsuite/gdc.test/runnable/mangle.d index e6d3645..9a8420a 100644 --- a/gcc/testsuite/gdc.test/runnable/mangle.d +++ b/gcc/testsuite/gdc.test/runnable/mangle.d @@ -599,6 +599,12 @@ void fooB(void delegate (void delegate()) scope dg) //pragma(msg, fooB.mangleof); static assert(typeof(fooA).mangleof != typeof(fooB).mangleof); +/***************************************************/ + +alias noreturn = typeof(*null); +alias fpd = noreturn function(); +int funcd(fpd); +static assert(funcd.mangleof == "_D6mangle5funcdFPFZNnZi"); /***************************************************/ diff --git a/gcc/testsuite/gdc.test/runnable/noreturn1.d b/gcc/testsuite/gdc.test/runnable/noreturn1.d new file mode 100644 index 0000000..447ea28 --- /dev/null +++ b/gcc/testsuite/gdc.test/runnable/noreturn1.d @@ -0,0 +1,74 @@ +alias noreturn = typeof(*null); + +extern (C) noreturn exit(); + +/*****************************************/ + +bool testf(int i) +{ + return i && assert(0); +} + +bool testt(int i) +{ + return i || assert(0); +} + +int testa(int i) +{ + if (i && exit()) + return i + 1; + return i - 1; +} + +int testb(int i) +{ + if (i || exit()) + return i + 1; + return i - 1; +} + +void test1() +{ + assert(testf(0) == false); + assert(testt(1) == true); + + assert(testa(0) == -1); + assert(testb(3) == 4); +} + +/*****************************************/ + +noreturn exit1() { assert(0); } +noreturn exit2() { assert(0); } + + +int heli1(int i) +{ + return i ? exit1() : i - 1; +} + +int heli2(int i) +{ + return i ? i - 1 : exit1(); +} + +noreturn heli3(int i) +{ + return i ? exit1() : exit2(); +} + +void test2() +{ + assert(heli1(0) == -1); + assert(heli2(1) == 0); +} + +/*****************************************/ + +int main() +{ + test1(); + test2(); + return 0; +} diff --git a/gcc/testsuite/gdc.test/runnable_cxx/cppa.d b/gcc/testsuite/gdc.test/runnable_cxx/cppa.d index b9b4832..cb576ba 100644 --- a/gcc/testsuite/gdc.test/runnable_cxx/cppa.d +++ b/gcc/testsuite/gdc.test/runnable_cxx/cppa.d @@ -571,18 +571,20 @@ void test13289() assert(f13289_cpp_test()); } +version(Posix) +{ + enum __c_wchar_t : dchar; +} +else version(Windows) +{ + enum __c_wchar_t : wchar; +} +alias wchar_t = __c_wchar_t; extern(C++) { bool f13289_cpp_test(); - version(Posix) - { - dchar f13289_cpp_wchar_t(dchar); - } - else version(Windows) - { - wchar f13289_cpp_wchar_t(wchar); - } + wchar_t f13289_cpp_wchar_t(wchar_t); wchar f13289_d_wchar(wchar ch) { @@ -606,6 +608,17 @@ extern(C++) return ch; } } + wchar_t f13289_d_wchar_t(wchar_t ch) + { + if (ch <= 'z' && ch >= 'a') + { + return cast(wchar_t)(ch - ('a' - 'A')); + } + else + { + return ch; + } + } } /****************************************/ diff --git a/gcc/testsuite/gdc.test/runnable_cxx/extra-files/cppb.cpp b/gcc/testsuite/gdc.test/runnable_cxx/extra-files/cppb.cpp index 587145c..823c660 100644 --- a/gcc/testsuite/gdc.test/runnable_cxx/extra-files/cppb.cpp +++ b/gcc/testsuite/gdc.test/runnable_cxx/extra-files/cppb.cpp @@ -412,8 +412,12 @@ wchar_t f13289_d_wchar(wchar_t ch); unsigned int f13289_d_dchar(unsigned int ch); #endif +wchar_t f13289_d_wchar_t(wchar_t ch); + bool f13289_cpp_test() { + if (!(f13289_d_wchar_t(L'e') == L'E')) return false; + if (!(f13289_d_wchar_t(L'F') == L'F')) return false; #if __linux__ || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __sun || __NetBSD__ if (!(f13289_d_wchar((unsigned short)'c') == (unsigned short)'C')) return false; if (!(f13289_d_wchar((unsigned short)'D') == (unsigned short)'D')) return false; diff --git a/gcc/testsuite/gdc.test/runnable_cxx/extra-files/test21515.cpp b/gcc/testsuite/gdc.test/runnable_cxx/extra-files/test21515.cpp new file mode 100644 index 0000000..076777a --- /dev/null +++ b/gcc/testsuite/gdc.test/runnable_cxx/extra-files/test21515.cpp @@ -0,0 +1,82 @@ +#include +#include + +// Use custom types for inspecting parts instead of including tgmath.h +union cfloat_t { _Complex float z; struct { float re; float im; }; }; +union cdouble_t { _Complex double z; struct { double re; double im; }; }; +union creal_t { _Complex long double z; struct { long double re; long double im; }; }; + +// extern(C) tests +extern "C" _Complex float ccomplexf() { return 2.0f+I; } +extern "C" _Complex double ccomplex() { return 2.0+I; } +extern "C" _Complex long double ccomplexl() { return 2.0L+I; } +extern "C" void ccomplexf2(_Complex float c) { cfloat_t z = {c}; assert(z.re == 2 && z.im == 1); } +extern "C" void ccomplex2(_Complex double c) { cdouble_t z = {c}; assert(z.re == 2 && z.im == 1); } +extern "C" void ccomplexl2(_Complex long double c) { creal_t z = {c}; assert(z.re == 2 && z.im == 1); } + +// extern(C++) tests +_Complex float cpcomplexf() { return 2.0f+I; } +_Complex double cpcomplex() { return 2.0+I; } +_Complex long double cpcomplexl() { return 2.0L+I; } +void cpcomplexf(_Complex float c) { cfloat_t z = {c}; assert(z.re == 2 && z.im == 1); } +void cpcomplex(_Complex double c) { cdouble_t z = {c}; assert(z.re == 2 && z.im == 1); } +void cpcomplexl(_Complex long double c) { creal_t z = {c}; assert(z.re == 2 && z.im == 1); } + +// Struct tests +struct wrap_complexf { _Complex float c; }; +struct wrap_complex { _Complex double c; }; +struct wrap_complexl { _Complex long double c; }; + +wrap_complexf wcomplexf() +{ + wrap_complexf s; + s.c = 2.0f+I; + return s; +} + +wrap_complex wcomplex() +{ + wrap_complex s; + s.c = 2.0+I; + return s; +} + +wrap_complexl wcomplexl() +{ + wrap_complexl s; + s.c = 2.0L+I; + return s; +} + +void wcomplexf(wrap_complexf s) { cfloat_t z = {s.c}; assert(z.re == 2 && z.im == 1); } +void wcomplex(wrap_complex s) { cdouble_t z = {s.c}; assert(z.re == 2 && z.im == 1); } +void wcomplexl(wrap_complexl s) { creal_t z = {s.c}; assert(z.re == 2 && z.im == 1); } + +struct soft_complexf { float re; float im; }; +struct soft_complex { double re; double im; }; +struct soft_complexl { long double re; long double im; }; + +soft_complexf scomplexf() +{ + soft_complexf s; + s.re = 2.0f; s.im = 1.0f; + return s; +} + +soft_complex scomplex() +{ + soft_complex s; + s.re = 2.0; s.im = 1.0; + return s; +} + +soft_complexl scomplexl() +{ + soft_complexl s; + s.re = 2.0L; s.im = 1.0L; + return s; +} + +void scomplexf(soft_complexf s) { assert(s.re == 2 && s.im == 1); } +void scomplex(soft_complex s) { assert(s.re == 2 && s.im == 1); } +void scomplexl(soft_complexl s) { assert(s.re == 2 && s.im == 1); } diff --git a/gcc/testsuite/gdc.test/runnable_cxx/test21515.d b/gcc/testsuite/gdc.test/runnable_cxx/test21515.d new file mode 100644 index 0000000..cc44207 --- /dev/null +++ b/gcc/testsuite/gdc.test/runnable_cxx/test21515.d @@ -0,0 +1,104 @@ +// https://issues.dlang.org/show_bug.cgi?id=21515 +// EXTRA_CPP_SOURCES: test21515.cpp +// DISABLED: win32 win64 + +// ABI layout of native complex +struct _Complex(T) { T re; T im; } + +// Special enum definitions. +version (Posix) +{ + align(float.alignof) enum __c_complex_float : _Complex!float; + align(double.alignof) enum __c_complex_double : _Complex!double; + align(real.alignof) enum __c_complex_real : _Complex!real; +} +else +{ + align(float.sizeof * 2) enum __c_complex_float : _Complex!float; + align(double.sizeof * 2) enum __c_complex_double : _Complex!double; + align(real.alignof) enum __c_complex_real : _Complex!real; +} +alias complex_float = __c_complex_float; +alias complex_double = __c_complex_double; +alias complex_real = __c_complex_real; + +extern(C) complex_float ccomplexf(); +extern(C) complex_double ccomplex(); +extern(C) complex_real ccomplexl(); +extern(C) void ccomplexf2(complex_float c); +extern(C) void ccomplex2(complex_double c); +extern(C) void ccomplexl2(complex_real c); + +extern(C++) complex_float cpcomplexf(); +extern(C++) complex_double cpcomplex(); +extern(C++) complex_real cpcomplexl(); +extern(C++) void cpcomplexf(complex_float c); +extern(C++) void cpcomplex(complex_double c); +extern(C++) void cpcomplexl(complex_real c); + +struct wrap_complexf { complex_float c; alias c this; }; +struct wrap_complex { complex_double c; alias c this; }; +struct wrap_complexl { complex_real c; alias c this; }; + +extern(C++) wrap_complexf wcomplexf(); +extern(C++) wrap_complex wcomplex(); +extern(C++) wrap_complexl wcomplexl(); +extern(C++) void wcomplexf(wrap_complexf c); +extern(C++) void wcomplex(wrap_complex c); +extern(C++) void wcomplexl(wrap_complexl c); + +struct soft_complexf { float re; float im; }; +struct soft_complex { double re; double im; }; +struct soft_complexl { real re; real im; }; + +extern(C++) soft_complexf scomplexf(); +extern(C++) soft_complex scomplex(); +extern(C++) soft_complexl scomplexl(); +extern(C++) void scomplexf(soft_complexf c); +extern(C++) void scomplex(soft_complex c); +extern(C++) void scomplexl(soft_complexl c); + +int main() +{ + auto a1 = ccomplexf(); + auto b1 = ccomplex(); + auto c1 = ccomplexl(); + assert(a1.re == 2 && a1.im == 1); + assert(b1.re == 2 && b1.im == 1); + assert(c1.re == 2 && c1.im == 1); + ccomplexf2(a1); + ccomplex2(b1); + ccomplexl2(c1); + + auto a2 = cpcomplexf(); + auto b2 = cpcomplex(); + auto c2 = cpcomplexl(); + assert(a2.re == 2 && a2.im == 1); + assert(b2.re == 2 && b2.im == 1); + assert(c2.re == 2 && c2.im == 1); + cpcomplexf(a2); + cpcomplex(b2); + cpcomplexl(c2); + + auto a3 = wcomplexf(); + auto b3 = wcomplex(); + auto c3 = wcomplexl(); + assert(a3.re == 2 && a3.im == 1); + assert(b3.re == 2 && b3.im == 1); + assert(c3.re == 2 && c3.im == 1); + wcomplexf(a3); + wcomplex(b3); + wcomplexl(c3); + + auto a4 = scomplexf(); + auto b4 = scomplex(); + auto c4 = scomplexl(); + assert(a4.re == 2 && a4.im == 1); + assert(b4.re == 2 && b4.im == 1); + assert(c4.re == 2 && c4.im == 1); + scomplexf(a4); + scomplex(b4); + scomplexl(c4); + + return 0; +} -- cgit v1.1 From c0756c4eb36b6bf4bf1ea0cf3633f08ae0e1c13d Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sun, 4 Apr 2021 00:16:26 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index da72ee3..7a684f9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,51 @@ +2021-04-03 Alexandre Oliva + + * g++.dg/pr94314-3.C: Zero-initialize main loop counter. + +2021-04-03 Alexandre Oliva + + * gcc.dg/ipa/ipa-sra-19.c: Extend -Wno-psabi to ppc-vx7r2. + +2021-04-03 Marek Polacek + + PR c++/91416 + * g++.dg/other/gc7.C: New test. + +2021-04-03 Paul Thomas + + PR fortran/99818 + * gfortran.dg/coarray_48.f90: New test. + +2021-04-03 Jakub Jelinek + + PR tree-optimization/99882 + * gcc.dg/pr99882.c: New test. + +2021-04-03 Jakub Jelinek + + PR rtl-optimization/99863 + * gcc.target/i386/pr99863.c: New test. + +2021-04-03 Jakub Jelinek + + PR testsuite/98125 + * g++.dg/pr93195a.C: Skip on powerpc*-*-* 64-bit. + +2021-04-03 Jason Merrill + + PR c++/91217 + * g++.dg/opt/nrv20.C: New test. + +2021-04-03 Jason Merrill + + PR c++/90664 + * g++.dg/cpp1z/noexcept-type24.C: New test. + +2021-04-03 Jason Merrill + + PR c++/97900 + * g++.dg/ext/vector40.C: New test. + 2021-04-02 Patrick Palka PR c++/99869 -- cgit v1.1 From c3d3bb0f03dbd02512ab46979088ee8e22520c24 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Sat, 3 Apr 2021 16:17:29 -0400 Subject: c++: array new initialized from a call [PR99643] Here the get_foo() call results in a TARGET_EXPR, which we strip in massage_init_elt, but then when build_vec_init tries to use it to initialize the array element we crash because build_aggr_init expects a class rvalue to have a TARGET_EXPR. So don't strip it. The stripping was added in r206639 for PR59659, so I checked that removing it didn't significantly increase compile time or memory usage for that testcase; compile time was unaffected, memory usage increased by 0.00004%. gcc/cp/ChangeLog: PR c++/99643 * typeck2.c (massage_init_elt): Don't strip TARGET_EXPR. gcc/testsuite/ChangeLog: PR c++/99643 * g++.dg/cpp0x/initlist-new5.C: New test. --- gcc/testsuite/g++.dg/cpp0x/initlist-new5.C | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist-new5.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist-new5.C b/gcc/testsuite/g++.dg/cpp0x/initlist-new5.C new file mode 100644 index 0000000..da54d89 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist-new5.C @@ -0,0 +1,9 @@ +// PR c++/99643 +// { dg-do compile { target c++11 } } + +struct Foo {}; +Foo get_foo(); + +int main() { + new Foo[1]{get_foo()}; +} -- cgit v1.1 From 914728849a35851ba1c1e2acfef2c44d2c9a6bc4 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 5 Apr 2021 00:16:27 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7a684f9..edcc3f0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2021-04-04 Jason Merrill + + PR c++/99643 + * g++.dg/cpp0x/initlist-new5.C: New test. + 2021-04-03 Alexandre Oliva * g++.dg/pr94314-3.C: Zero-initialize main loop counter. -- cgit v1.1 From 3cb9e3aee98a206b786d7414ad28e67fbcceba5c Mon Sep 17 00:00:00 2001 From: Sandra Loosemore Date: Sun, 4 Apr 2021 17:55:46 -0700 Subject: Trivial testsuite fixes for nios2-elf. nios2-elf defaults to -fno-delete-null-pointer-checks, which causes failures in tests that assume the option is enabled. Make the dependence explicit. 2021-04-04 Sandra Loosemore gcc/testsuite/ * gcc.dg/ipa/propmalloc-4.c: Add -fdelete-null-pointer-checks. * gcc.dg/tree-ssa/evrp11.c: Likewise. --- gcc/testsuite/gcc.dg/ipa/propmalloc-4.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/evrp11.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/ipa/propmalloc-4.c b/gcc/testsuite/gcc.dg/ipa/propmalloc-4.c index 4c40d63..9552b73 100644 --- a/gcc/testsuite/gcc.dg/ipa/propmalloc-4.c +++ b/gcc/testsuite/gcc.dg/ipa/propmalloc-4.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-local-pure-const-details" } */ +/* { dg-options "-O2 -fdump-tree-local-pure-const-details -fdelete-null-pointer-checks" } */ void *foo(int cond1, int cond2, int cond3) { diff --git a/gcc/testsuite/gcc.dg/tree-ssa/evrp11.c b/gcc/testsuite/gcc.dg/tree-ssa/evrp11.c index f1373bd..d791305 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/evrp11.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/evrp11.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-evrp" } */ +/* { dg-options "-O2 -fdump-tree-evrp -fdelete-null-pointer-checks" } */ extern void link_error (); -- cgit v1.1 From 76a7e7e706ac4c01cead3c6514322aaad88f9a63 Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Sun, 14 Mar 2021 22:51:56 +0100 Subject: d: Use weak linkage for template symbols instead of gnu.linkonce (PR99914) The default linkage of templates in the D language is now DECL_WEAK instead of DECL_ONE_ONLY, if supported. This better matches the expected override semantics of template symbols compiled to object code. For example: module rt.config; template rt_flag() { pragma(mangle, "rt_flag") __gshared bool rt_flag = true; } module main; extern(C) __gshared bool rt_flag = false; The above currently does not succeed in linking due to there being multiple definitions of `rt_flag' in different sections that aren't considered mergeable. The compiler flag enabling toggling of this has been given a clearer named `-fweak-templates', which distinguishes itself from G++ `-fweak', which is intended only for testing. gcc/d/ChangeLog: PR d/99914 * d-lang.cc (d_init): Disable flag_weak_templates if no support for weak or one-only symbols. * d-tree.h (VAR_OR_FUNCTION_DECL_CHECK): New macro. (DECL_INSTANTIATED): New macro. (d_comdat_linkage): Remove declaration. (d_linkonce_linkage): Remove declaration. (set_linkage_for_decl): New declaration. * decl.cc (DeclVisitor::visit (StructDeclaration *)): Replace call to d_linkonce_linkage with setting DECL_INSTANTIATED. (DeclVisitor::visit (ClassDeclaration *)): Likewise. (DeclVisitor::visit (EnumDeclaration *)): Likewise. (DeclVisitor::visit (InterfaceDeclaration *)): Remove call to d_linkonce_linkage. (get_symbol_decl): Call set_linkage_for_decl instead of d_linkonce_linkage. (d_finish_decl): Call set_linkage_for_decl. (d_comdat_linkage): Made function static. Only set DECL_COMDAT for DECL_INSTANTIATED decls. (d_linkonce_linkage): Remove function. (d_weak_linkage): New function. (set_linkage_for_decl): New function. * gdc.texi (Runtime Options): Rename -fno-weak to -fno-weak-templates, update documentation of option. * lang.opt (fweak): Rename option to ... (fweak-templates): ... this. Update help string. * modules.cc (get_internal_fn): Add Prot parameter. Set generated function flag. (build_internal_fn): Update call to get_internal_fn. (build_dso_cdtor_fn): Likewise. (register_moduleinfo): Call d_finish_decl on dso_slot_node and dso_initialized_node. * typeinfo.cc (TypeInfoVisitor::internal_reference): Call set_linkage_for_decl instead of d_comdat_linkage. (TypeInfoDeclVisitor::visit (TypeInfoDeclaration *)): Remove calls to d_linkonce_linkage and d_comdat_linkage. (get_cpp_typeinfo_decl): Likewise. gcc/testsuite/ChangeLog: PR d/99914 * gdc.dg/pr99914.d: New test. --- gcc/testsuite/gdc.dg/pr99914.d | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 gcc/testsuite/gdc.dg/pr99914.d (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gdc.dg/pr99914.d b/gcc/testsuite/gdc.dg/pr99914.d new file mode 100644 index 0000000..689eae0 --- /dev/null +++ b/gcc/testsuite/gdc.dg/pr99914.d @@ -0,0 +1,5 @@ +// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99914 +// { dg-additional-options "-fmain" } +// { dg-do link { target d_runtime } } + +extern(C) __gshared bool rt_cmdline_enabled = false; -- cgit v1.1 From a99a7b0afe9a1f6f866e25b8572856ae8c1d3f8d Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Sun, 4 Apr 2021 01:01:56 -0400 Subject: c++: constexpr if and nested generic lambda [PR99201] When building up *_EXTRA_ARGS for a constexpr if or pack expansion, we need to walk into the body of a lambda to find all the local_specializations that we need to remember, like we do in find_parameter_packs_r. gcc/cp/ChangeLog: PR c++/99201 * pt.c (class el_data): Add visited field. (extract_local_specs): Pass it to cp_walk_tree. (extract_locals_r): Walk into the body of a lambda. gcc/testsuite/ChangeLog: PR c++/99201 * g++.dg/cpp1z/constexpr-if-lambda4.C: New test. --- gcc/testsuite/g++.dg/cpp1z/constexpr-if-lambda4.C | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1z/constexpr-if-lambda4.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp1z/constexpr-if-lambda4.C b/gcc/testsuite/g++.dg/cpp1z/constexpr-if-lambda4.C new file mode 100644 index 0000000..9940802 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/constexpr-if-lambda4.C @@ -0,0 +1,22 @@ +// PR c++/99201 +// { dg-do compile { target c++17 } } + +template + auto + make_tester(const RefF& reffun) + { + return [=](auto in) { + auto&& expected = [&](const auto&... vs) { + if constexpr (sizeof(in) > 0) + return [&](int i) { return reffun(vs[i]...); }(0); + else + return [&](int i) { return reffun(vs[i]...); }(0); + }; + }; + } + +int main() +{ + make_tester([](int x) { return x; })(0); + return 0; +} -- cgit v1.1 From bd89b8fe9efbdf0a95d827553d1a84fd3cefaa16 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Sun, 4 Apr 2021 23:32:32 -0400 Subject: c++: extern template and static data member [PR99066] 'extern template' should mean that the relevant symbols are never emitted. But in this case we were assuming that DECL_EXTERNAL was already set on the variable, so we just needed to clear DECL_NOT_REALLY_EXTERN. Since DECL_EXTERNAL was not set, we emitted a definition of npos. gcc/cp/ChangeLog: PR c++/99066 * pt.c (mark_decl_instantiated): Set DECL_EXTERNAL. gcc/testsuite/ChangeLog: PR c++/99066 * g++.dg/cpp0x/extern_template-6.C: New test. --- gcc/testsuite/g++.dg/cpp0x/extern_template-6.C | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/extern_template-6.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp0x/extern_template-6.C b/gcc/testsuite/g++.dg/cpp0x/extern_template-6.C new file mode 100644 index 0000000..8aff3ae --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/extern_template-6.C @@ -0,0 +1,17 @@ +// PR c++/99066 +// { dg-do compile { target c++11 } } + +template struct basic_string { + static const int npos = 1; +}; +template const int basic_string::npos; + +struct e { template int f() const; }; + +template int e::f() const { + return basic_string::npos; +} + +extern template class basic_string; + +// { dg-final { scan-assembler-not "_ZN12basic_stringIcE4nposE" } } -- cgit v1.1 From 69b66ff02353a87585329bb3cf4ac20d6dee1b16 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Mon, 5 Apr 2021 10:48:01 -0400 Subject: analyzer: fix apparent hang with -fanalyzer-verbosity=0 [PR analyzer/99886] The analyzer appeared to enter an infinite loop on malloc-1.c when -fanalyzer-verbosity=0 was used. In fact, it was slowly counting from 0 to 0xffffffff. Root cause is looping up to effectively ((unsigned)0) - 1 in diagnostic_manager::consolidate_conditions when there are no events in the path. Fixed by the following, which uses signed integers when subtracting from path->num_events () when simplifying checker_paths. gcc/analyzer/ChangeLog: PR analyzer/99886 * diagnostic-manager.cc (diagnostic_manager::prune_interproc_events): Use signed integers when subtracting one from path->num_events (). (diagnostic_manager::consolidate_conditions): Likewise. Convert next_idx to a signed int. gcc/testsuite/ChangeLog: PR analyzer/99886 * gcc.dg/analyzer/pr99886.c: New test. --- gcc/testsuite/gcc.dg/analyzer/pr99886.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/analyzer/pr99886.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/analyzer/pr99886.c b/gcc/testsuite/gcc.dg/analyzer/pr99886.c new file mode 100644 index 0000000..da768ba --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/pr99886.c @@ -0,0 +1,21 @@ +/* Regression test for hang with -fanalyzer-verbosity=0. */ +/* { dg-additional-options "-fanalyzer-verbosity=0" } */ + +#include + +struct coord { + float x; + float y; +}; + +void test_34 (void) +{ + float *q; + struct coord *p = malloc (sizeof (struct coord)); + if (!p) + return; + p->x = 0.0f; + q = &p->x; + free (p); + *q = 1.0f; /* { dg-warning "use after 'free' of 'q'" } */ +}; -- cgit v1.1 From 7d8f4240c94e2e7643ac13cda1fdd0bb6ca3a3fb Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Mon, 5 Apr 2021 10:51:46 -0400 Subject: analyzer: fix ICE on zero-arg calls passed to __attribute__((nonnull)) [PR 99906] gcc/analyzer/ChangeLog: PR analyzer/99906 * analyzer.cc (maybe_reconstruct_from_def_stmt): Fix NULL dereference on calls with zero arguments. * sm-malloc.cc (malloc_state_machine::on_stmt): When handling __attribute__((nonnull)), only call get_diagnostic_tree if the result will be used. gcc/testsuite/ChangeLog: PR analyzer/99906 * gcc.dg/analyzer/pr99906.c: New test. --- gcc/testsuite/gcc.dg/analyzer/pr99906.c | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/analyzer/pr99906.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/analyzer/pr99906.c b/gcc/testsuite/gcc.dg/analyzer/pr99906.c new file mode 100644 index 0000000..bb399a3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/pr99906.c @@ -0,0 +1,3 @@ +void bar(void *) __attribute__((__nonnull__)); +void *baz(void); +void foo(void) { bar(baz()); } -- cgit v1.1 From 62d60246e53778db6ee613377dd013ba4b264968 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 5 Apr 2021 11:34:48 -0400 Subject: c++: lambda in DMI in class template [PR95870] Here enclosing_instantiation_of was failing to find a match because otctx is struct S and current_function_decl is S::S(), so the latter has more function contexts, and we end up trying to compare S() to NULL_TREE. After spending a bit of time working on establishing the correspondence in this case (class <=> constructor), it occurred to me that we could just use DECL_SOURCE_LOCATION, which is unique for lambdas, since they cannot be redeclared. Since we're so close to release, for now I'm only doing this for the case that was failing before. gcc/cp/ChangeLog: PR c++/95870 * pt.c (enclosing_instantiation_of): Compare DECL_SOURCE_LOCATION if there is no enclosing non-lambda function. gcc/testsuite/ChangeLog: PR c++/95870 * g++.dg/cpp0x/lambda/lambda-nsdmi10.C: New test. --- gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nsdmi10.C | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nsdmi10.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nsdmi10.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nsdmi10.C new file mode 100644 index 0000000..810ed53 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nsdmi10.C @@ -0,0 +1,12 @@ +// PR c++/95870 +// { dg-do compile { target c++11 } } + +template struct S { + S(); + int b = []() -> int { enum E {}; return 1; }(); +}; +struct C : S { + C(); +}; +template S::S() = default; +C::C() {} -- cgit v1.1 From 9f4c41147a41d08a74990eafe69a1064a3c13435 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 5 Apr 2021 14:26:03 -0400 Subject: c++: enum in generic lambda in template [PR95317] Here we weren't instantiating the enumerators because the arglist still had the template parameter for the generic lambda, so looking one up failed. We need to instantiate if the non-lambda enclosing scope is non-dependent. gcc/cp/ChangeLog: PR c++/95317 * pt.c (lookup_template_class_1): Do tsubst_enum when tsubsting a generic lambda. gcc/testsuite/ChangeLog: PR c++/95317 * g++.dg/cpp1y/lambda-generic-enum1.C: New test. --- gcc/testsuite/g++.dg/cpp1y/lambda-generic-enum1.C | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1y/lambda-generic-enum1.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-enum1.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-enum1.C new file mode 100644 index 0000000..de15443 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-enum1.C @@ -0,0 +1,10 @@ +// PR c++/95317 +// { dg-do compile { target c++14 } } + +template void fn1() { + [](auto) { + enum { VALUE }; + VALUE; + }; +} +int main() { fn1; } -- cgit v1.1 From 07f56824fd4da14a48030e698c8eb58de951c741 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 5 Apr 2021 15:50:48 -0400 Subject: c++: reinterpret_cast from prvalue to rvalue ref [PR98440] In r260622 I allowed this under the general principle that [basic.lval] "Whenever a prvalue appears as an operand of an operator that expects a glvalue for that operand, the temporary materialization conversion (7.3.4) is applied to convert the expression to an xvalue." But [expr.reinterpret.cast] specifically excludes creating a temporary in this case. gcc/cp/ChangeLog: PR c++/98440 * typeck.c (build_reinterpret_cast_1): Don't perform temporary materialization. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/rv-cast6.C: Expect reinterpret_cast error. * g++.dg/cpp0x/reinterpret_cast2.C: Adjust message. * g++.old-deja/g++.jason/rvalue3.C: Likewise. --- gcc/testsuite/g++.dg/cpp0x/reinterpret_cast2.C | 2 +- gcc/testsuite/g++.dg/cpp0x/rv-cast6.C | 2 +- gcc/testsuite/g++.old-deja/g++.jason/rvalue3.C | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp0x/reinterpret_cast2.C b/gcc/testsuite/g++.dg/cpp0x/reinterpret_cast2.C index c173576..5402e82 100644 --- a/gcc/testsuite/g++.dg/cpp0x/reinterpret_cast2.C +++ b/gcc/testsuite/g++.dg/cpp0x/reinterpret_cast2.C @@ -6,5 +6,5 @@ struct S { }; void foo () { - auto a = reinterpret_cast(foo ()); // { dg-error "12:invalid cast of an rvalue expression of type 'void' to type" } + auto a = reinterpret_cast(foo ()); // { dg-error "12:invalid cast of a prvalue expression of type 'void' to type" } } diff --git a/gcc/testsuite/g++.dg/cpp0x/rv-cast6.C b/gcc/testsuite/g++.dg/cpp0x/rv-cast6.C index 3ae5691..3adf683 100644 --- a/gcc/testsuite/g++.dg/cpp0x/rv-cast6.C +++ b/gcc/testsuite/g++.dg/cpp0x/rv-cast6.C @@ -5,7 +5,7 @@ struct A { virtual void f(); }; struct B : A {}; auto && a = static_cast(B()); -auto && b = reinterpret_cast(B()); +auto && b = reinterpret_cast(B()); // { dg-error "prvalue" } auto && c = dynamic_cast(B()); auto && d = dynamic_cast(static_cast(B())); auto && e = const_cast(B()); diff --git a/gcc/testsuite/g++.old-deja/g++.jason/rvalue3.C b/gcc/testsuite/g++.old-deja/g++.jason/rvalue3.C index 49191c9..77969bc 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/rvalue3.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/rvalue3.C @@ -2,5 +2,5 @@ int main () { int i; - int &ir = (int&)(int)i; // { dg-error "14:invalid cast of an rvalue expression" } casting rvalue to reference type + int &ir = (int&)(int)i; // { dg-error "14:invalid cast of a prvalue expression" } casting rvalue to reference type } -- cgit v1.1 From b07dd9b0d0e501a0083da79e2bca17041c007ec8 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 5 Apr 2021 16:22:51 -0400 Subject: c++: -Wunused, constant, and generic lambda [PR96311] We never called mark_use for a return value in a function with dependent return type. In that situation we don't know if the use is as an rvalue or lvalue, but we can use mark_exp_read instead. gcc/cp/ChangeLog: PR c++/96311 * typeck.c (check_return_expr): Call mark_exp_read in dependent case. gcc/testsuite/ChangeLog: PR c++/96311 * g++.dg/cpp1y/lambda-generic-Wunused.C: New test. --- gcc/testsuite/g++.dg/cpp1y/lambda-generic-Wunused.C | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1y/lambda-generic-Wunused.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-Wunused.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-Wunused.C new file mode 100644 index 0000000..b43cbe6 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-Wunused.C @@ -0,0 +1,18 @@ +// PR c++/96311 +// { dg-do compile { target c++14 } } +// { dg-additional-options -Wunused } + +auto foo() +{ + constexpr int used = 0; + return + [](auto unused) + { + return used; + }; +} + +int main() +{ + foo()(42); +} -- cgit v1.1 From b1da991623341a2ecd97bf9034b93b0d63516517 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 6 Apr 2021 00:16:43 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 51 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index edcc3f0..0a295b0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,54 @@ +2021-04-05 Jason Merrill + + PR c++/96311 + * g++.dg/cpp1y/lambda-generic-Wunused.C: New test. + +2021-04-05 Jason Merrill + + * g++.dg/cpp0x/rv-cast6.C: Expect reinterpret_cast error. + * g++.dg/cpp0x/reinterpret_cast2.C: Adjust message. + * g++.old-deja/g++.jason/rvalue3.C: Likewise. + +2021-04-05 Jason Merrill + + PR c++/95317 + * g++.dg/cpp1y/lambda-generic-enum1.C: New test. + +2021-04-05 Jason Merrill + + PR c++/95870 + * g++.dg/cpp0x/lambda/lambda-nsdmi10.C: New test. + +2021-04-05 David Malcolm + + PR analyzer/99906 + * gcc.dg/analyzer/pr99906.c: New test. + +2021-04-05 David Malcolm + + PR analyzer/99886 + * gcc.dg/analyzer/pr99886.c: New test. + +2021-04-05 Jason Merrill + + PR c++/99066 + * g++.dg/cpp0x/extern_template-6.C: New test. + +2021-04-05 Jason Merrill + + PR c++/99201 + * g++.dg/cpp1z/constexpr-if-lambda4.C: New test. + +2021-04-05 Iain Buclaw + + PR d/99914 + * gdc.dg/pr99914.d: New test. + +2021-04-05 Sandra Loosemore + + * gcc.dg/ipa/propmalloc-4.c: Add -fdelete-null-pointer-checks. + * gcc.dg/tree-ssa/evrp11.c: Likewise. + 2021-04-04 Jason Merrill PR c++/99643 -- cgit v1.1 From 66de517b1c1dd22df7914f8e9a083cd5a73adbe2 Mon Sep 17 00:00:00 2001 From: Patrick Palka Date: Mon, 5 Apr 2021 23:35:56 -0400 Subject: c++: placeholder type constraint in structured binding [PR99899] In this PR, we're crashing because the constraint handling inside do_auto_deduction doesn't expect to see an adc_decomp_type context. This patch fixes this by treating adc_decomp_type like adc_variable_type or adc_return_type during placeholder type constraint checking. Meanwhile, I noticed we weren't checking constraints at all when binding an array via a structured binding, since do_auto_deduction would exit early and bypass the constraint check. This patch fixes this by replacing the early exit with an appropriate setup of the 'targs' vector. gcc/cp/ChangeLog: PR c++/99899 * pt.c (do_auto_deduction): Don't exit early when deducing the array type of a structured binding. Also handle adc_decomp_type during constraint checking. gcc/testsuite/ChangeLog: PR c++/99899 * g++.dg/cpp2a/concepts-placeholder7.C: New test. * g++.dg/cpp2a/concepts-placeholder8.C: New test. --- gcc/testsuite/g++.dg/cpp2a/concepts-placeholder7.C | 32 ++++++++++++++++++++++ gcc/testsuite/g++.dg/cpp2a/concepts-placeholder8.C | 10 +++++++ 2 files changed, 42 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp2a/concepts-placeholder7.C create mode 100644 gcc/testsuite/g++.dg/cpp2a/concepts-placeholder8.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-placeholder7.C b/gcc/testsuite/g++.dg/cpp2a/concepts-placeholder7.C new file mode 100644 index 0000000..93219ff --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/concepts-placeholder7.C @@ -0,0 +1,32 @@ +// PR c++/99899 +// { dg-do compile { target c++20 } } + +template concept C1 = sizeof(T) > sizeof(int[1]); + +template +void f() { + int x[] = {1,2}; + int y[] = {3}; + C1 auto [a,b] = x; + C1 auto [c] = y; // { dg-error "constraints" } +} + +template +void g() { + T x[] = {1,2}; + T y[] = {3}; + C1 auto [a,b] = x; + C1 auto [c] = y; // { dg-error "constraints" } +} +template void g(); + + +template concept C2 = sizeof...(Ts) > 1; + +struct S { int a, b; } s; + +template +void h() { + const C2 auto& [a, b] = s; +} +template void h(); diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-placeholder8.C b/gcc/testsuite/g++.dg/cpp2a/concepts-placeholder8.C new file mode 100644 index 0000000..e786592 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/concepts-placeholder8.C @@ -0,0 +1,10 @@ +// { dg-do compile { target c++20 } } + +template concept is_const = __is_same(T, const T); + +void f() { + int x[] = {1,2}; + const int y[] = {3}; + const is_const auto [a,b] = x; // { dg-error "constraints" } + const is_const auto [c] = y; +} -- cgit v1.1 From 55f40d968b0bd3be4478a9481e829a99ee0fa04f Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 5 Apr 2021 22:50:44 -0400 Subject: c++: mangling of lambdas in default args [PR91241] In this testcase, the parms remembered in LAMBDA_EXPR_EXTRA_SCOPE are no longer the parms of the FUNCTION_DECL they have as their DECL_CONTEXT, so we were mangling both lambdas as parm #0. But since the parms are numbered from right to left we don't need to need to find them in the FUNCTION_DECL, we can measure their own DECL_CHAIN. gcc/cp/ChangeLog: PR c++/91241 * mangle.c (write_compact_number): Add sanity check. (write_local_name): Use list_length for parm number. gcc/testsuite/ChangeLog: PR c++/91241 * g++.dg/abi/lambda-defarg1.C: New test. --- gcc/testsuite/g++.dg/abi/lambda-defarg1.C | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 gcc/testsuite/g++.dg/abi/lambda-defarg1.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/abi/lambda-defarg1.C b/gcc/testsuite/g++.dg/abi/lambda-defarg1.C new file mode 100644 index 0000000..8c53858 --- /dev/null +++ b/gcc/testsuite/g++.dg/abi/lambda-defarg1.C @@ -0,0 +1,11 @@ +// PR c++/91241 +// { dg-do compile { target c++11 } } + +struct A { + int *b(const int & = []() -> int { return 0; }(), + const int & = []() -> int { return 0; }()); +}; +int *A::b(const int &, const int &) { b(); return 0; } +// { dg-final { scan-assembler "_ZN1A1bERKiS1_" } } +// { dg-final { scan-assembler "_ZZN1A1bERKiS1_Ed_NKUlvE_clEv" } } +// { dg-final { scan-assembler "_ZZN1A1bERKiS1_Ed0_NKUlvE_clEv" } } -- cgit v1.1 From ffc2331d7994d7fabb1f6ebed931024a9bbe69f2 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 6 Apr 2021 11:46:32 +0200 Subject: testsuite: Fix up g++.dg/ext/vector40.C test The test FAILs on i686-linux due to -Wpsabi diagnostics. 2021-04-06 Jakub Jelinek PR c++/97900 * g++.dg/ext/vector40.C: Add -Wno-psabi -w to dg-options. --- gcc/testsuite/g++.dg/ext/vector40.C | 1 + 1 file changed, 1 insertion(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/ext/vector40.C b/gcc/testsuite/g++.dg/ext/vector40.C index 885afb0..66b6b64 100644 --- a/gcc/testsuite/g++.dg/ext/vector40.C +++ b/gcc/testsuite/g++.dg/ext/vector40.C @@ -1,4 +1,5 @@ // PR c++/97900 +// { dg-options "-Wno-psabi -w" } template T test(T __attribute__((vector_size(2 * sizeof(T)))) vec) { -- cgit v1.1 From 58cd9fc8a61de09ba181c5ed5ac7fb91ec506414 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 6 Apr 2021 11:21:47 +0200 Subject: tree-optimization/99924 - visit permute nodes again when partitioning Since SLP graph partitioning works on scalar stmts (because it's done for costing) we have to make sure to visit permute nodes multiple times since they will not pull partitions together. 2021-04-06 Richard Biener PR tree-optimization/99924 * tree-vect-slp.c (vect_bb_partition_graph_r): Do not mark nodes w/o scalar stmts as visited. * gfortran.dg/vect/pr99924.f90: New testcase. --- gcc/testsuite/gfortran.dg/vect/pr99924.f90 | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/vect/pr99924.f90 (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gfortran.dg/vect/pr99924.f90 b/gcc/testsuite/gfortran.dg/vect/pr99924.f90 new file mode 100644 index 0000000..f271ea1 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/vect/pr99924.f90 @@ -0,0 +1,12 @@ +! { dg-do compile } +! { dg-additional-options "-march=armv8.3-a" { target aarch64-*-* } } +subroutine cunhj (tfn, asum, bsum) + implicit none + complex :: up, tfn, asum, bsum + real :: ar + + up = tfn * ar + bsum = up + ar + asum = up + asum + return +end subroutine cunhj -- cgit v1.1 From bfeb36bd03c2168af263daa13370a20a96c42b5d Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 6 Apr 2021 12:44:51 +0200 Subject: testsuite: Fix up pr96573.c on aarch64 [PR96573] On Thu, Apr 01, 2021 at 02:16:55PM +0100, Alex Coplan via Gcc-patches wrote: > FYI, I'm seeing the new test failing on aarch64: > > PASS: gcc.dg/pr96573.c (test for excess errors) > FAIL: gcc.dg/pr96573.c scan-tree-dump optimized "__builtin_bswap" The vectorizer in the aarch64 case manages to emit a VEC_PERM_EXPR instead (which is just as efficient). So, do we want to go for the following (and/or perhaps also restrict the test to a couple of targets where it works? In my last distro build it failed only on aarch64-linux, while armv7hl-linux-gnueabi and {i686,x86_64,powerpc64le,s390x}-linux were fine)? 2021-04-06 Jakub Jelinek PR tree-optimization/96573 * gcc.dg/pr96573.c: Instead of __builtin_bswap accept also VEC_PERM_EXPR with bswapping permutation. --- gcc/testsuite/gcc.dg/pr96573.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/pr96573.c b/gcc/testsuite/gcc.dg/pr96573.c index 3acf117..63db69d 100644 --- a/gcc/testsuite/gcc.dg/pr96573.c +++ b/gcc/testsuite/gcc.dg/pr96573.c @@ -2,7 +2,7 @@ /* { dg-do compile { target { lp64 || ilp32 } } } */ /* { dg-require-effective-target bswap } */ /* { dg-options "-O3 -fdump-tree-optimized" } */ -/* { dg-final { scan-tree-dump "__builtin_bswap" "optimized" } } */ +/* { dg-final { scan-tree-dump "__builtin_bswap\|VEC_PERM_EXPR\[^\n\r]*7, 6, 5, 4, 3, 2, 1, 0" "optimized" } } */ typedef __SIZE_TYPE__ size_t; -- cgit v1.1 From 671f9f5c0f04d859265f1f2da117baf5a75511ac Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Tue, 6 Apr 2021 05:04:28 -0700 Subject: c++: Simplify va_arg test The va_arg scans are just too brittle. Let's not be that picky. We have other tested builtins that are less brittle now anyway. gcc/testsuite/ * g++.dg/modules/builtin-3_a.C: Remove dump scans. * g++.dg/modules/builtin-3_b.C: Remove dump scans. --- gcc/testsuite/g++.dg/modules/builtin-3_a.C | 23 +---------------------- gcc/testsuite/g++.dg/modules/builtin-3_b.C | 7 +------ 2 files changed, 2 insertions(+), 28 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/modules/builtin-3_a.C b/gcc/testsuite/g++.dg/modules/builtin-3_a.C index fb7da61..66f7129 100644 --- a/gcc/testsuite/g++.dg/modules/builtin-3_a.C +++ b/gcc/testsuite/g++.dg/modules/builtin-3_a.C @@ -1,4 +1,4 @@ -// { dg-additional-options "-fmodules-ts -fdump-lang-module-blocks-alias-uid" } +// { dg-additional-options -fmodules-ts } module; #include export module builtins; @@ -21,24 +21,3 @@ export inline int count (int a, ...) return c; } - -// { dg-final { scan-lang-dump-not {Cluster members:\n \[0\]=decl declaration '::__builtin_strlen'\n \[1\]=binding '::__builtin_strlen'\n} module } } -// { dg-final { scan-lang-dump {Wrote GMF:-[0-9]* function_decl:'::__builtin_strlen'@builtins} module } } -// { dg-final { scan-lang-dump {Writing:-[0-9]*'s named merge key \(decl\) function_decl:'::__builtin_strlen'} module } } -// { dg-final { scan-lang-dump-not {Writing tree:-[0-9]* function_decl:'__builtin_strlen'\(strlen\)} module } } - -// The implementation details of va_list's are target-specific. -// Usually one of two patterns though -// { dg-final { scan-lang-dump-not { Cluster members:\n \[0\]=decl declaration '::__builtin_va_list'\n \[1\]=binding '::__builtin_va_list'\n} module { target i?86-*-linux* x86_64-*-linux* } } } -// { dg-final { scan-lang-dump {Wrote GMF:-[0-9]* type_decl:'::__builtin_va_list'@builtins} module { target { { x86_64-*-linux* i?86-*-linux* } && lp64 } } } } -// { dg-final { scan-lang-dump {Writing:-[0-9]*'s named merge key \(decl\) type_decl:'::__builtin_va_list'} module { target { { x86_64-*-linux* i?86-*-linux* } && lp64 } } } } - -// { dg-final { scan-lang-dump {Writing:-1's named merge key \(decl\) type_decl:'::__gnuc_va_list'} module { target i?86-*-linux* *-*-darwin* } } } -// { dg-final { scan-lang-dump {Wrote GMF:-3 type_decl:'::__gnuc_va_list'@builtins} module { target i?86-*-linux* *-*-darwin* } } } - -// { dg-final { scan-lang-dump {Wrote fixed:[0-9]* record_type:'__va_list'} module { target aarch64*-*-linux* } } } -// { dg-final { scan-lang-dump {Wrote fixed:[0-9]* pointer_type:'::__builtin_va_list'} module { target powerpc*-*-linux* } } } - -// { dg-final { scan-lang-dump-not { Cluster members:\n \[0\]=decl declaration '::va_list'\n \[1\]=binding '::va_list'\n} module } } -// { dg-final { scan-lang-dump {Wrote GMF:-[0-9]* type_decl:'::va_list'@builtins} module } } -// { dg-final { scan-lang-dump {Writing:-[0-9]*'s named merge key \(decl\) type_decl:'::va_list'} module } } diff --git a/gcc/testsuite/g++.dg/modules/builtin-3_b.C b/gcc/testsuite/g++.dg/modules/builtin-3_b.C index e0e6306..7ba933d 100644 --- a/gcc/testsuite/g++.dg/modules/builtin-3_b.C +++ b/gcc/testsuite/g++.dg/modules/builtin-3_b.C @@ -1,4 +1,4 @@ -// { dg-additional-options "-fmodules-ts -fdump-lang-module-alias" } +// { dg-additional-options -fmodules-ts } import builtins; int main () @@ -6,8 +6,3 @@ int main () length (""); count (1, "", "", nullptr); } - -// { dg-final { scan-lang-dump {Read:-[0-9]*'s named merge key \(matched\) function_decl:'::__builtin_strlen'} module } } -// { dg-final { scan-lang-dump {Read:-[0-9]*'s named merge key \(matched\) type_decl:'::__builtin_va_list'} module { target { { x86_64-*-linux* i?86-*-linux* } && lp64 } } } } -// { dg-final { scan-lang-dump {Read:-[0-9]*'s named merge key \(new\) type_decl:'::va_list'} module } } -// { dg-final { scan-lang-dump {Read:-[0-9]*'s named merge key \(new\) type_decl:'::__gnuc_va_list'} module } } -- cgit v1.1 From e5c170e080399fb3d24a38bbfcd66bd4675abe53 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 6 Apr 2021 13:20:44 +0200 Subject: tree-optimization/99880 - avoid vectorizing irrelevant PHI backedge defs This adds a relevancy check before trying to set the vector def of a backedge in an unvectorized PHI. 2021-04-06 Richard Biener PR tree-optimization/99880 * tree-vect-loop.c (maybe_set_vectorized_backedge_value): Only set vectorized defs of relevant PHIs. * gcc.dg/torture/pr99880.c: New testcase. --- gcc/testsuite/gcc.dg/torture/pr99880.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/torture/pr99880.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/torture/pr99880.c b/gcc/testsuite/gcc.dg/torture/pr99880.c new file mode 100644 index 0000000..7e09899 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr99880.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-ftree-vectorize" } */ + +unsigned a; +int b, c, d, e; +void f() { + b = 5; + for (; b <= 51; b++) + ; + unsigned int g = -8; + while (g) { + g += 5; + int h = 10; + do { + h -= a = 1; + for (; a; a++) + ; + c *= c >= d >= b; + } while (h); + c -= e; + } +} -- cgit v1.1 From a32452a5442cd05040af53787af0d8b537ac77a6 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Thu, 11 Mar 2021 16:56:26 -0800 Subject: x86: Update memcpy/memset inline strategies for Skylake family CPUs Simply memcpy and memset inline strategies to avoid branches for Skylake family CPUs: 1. With MOVE_RATIO and CLEAR_RATIO == 17, GCC will use integer/vector load and store for up to 16 * 16 (256) bytes when the data size is fixed and known. 2. Inline only if data size is known to be <= 256. a. Use "rep movsb/stosb" with simple code sequence if the data size is a constant. b. Use loop if data size is not a constant. 3. Use memcpy/memset libray function if data size is unknown or > 256. On Cascadelake processor with -march=native -Ofast -flto, 1. Performance impacts of SPEC CPU 2017 rate are: 500.perlbench_r 0.17% 502.gcc_r -0.36% 505.mcf_r 0.00% 520.omnetpp_r 0.08% 523.xalancbmk_r -0.62% 525.x264_r 1.04% 531.deepsjeng_r 0.11% 541.leela_r -1.09% 548.exchange2_r -0.25% 557.xz_r 0.17% Geomean -0.08% 503.bwaves_r 0.00% 507.cactuBSSN_r 0.69% 508.namd_r -0.07% 510.parest_r 1.12% 511.povray_r 1.82% 519.lbm_r 0.00% 521.wrf_r -1.32% 526.blender_r -0.47% 527.cam4_r 0.23% 538.imagick_r -1.72% 544.nab_r -0.56% 549.fotonik3d_r 0.12% 554.roms_r 0.43% Geomean 0.02% 2. Significant impacts on eembc benchmarks are: eembc/idctrn01 9.23% eembc/nnet_test 29.26% gcc/ * config/i386/x86-tune-costs.h (skylake_memcpy): Updated. (skylake_memset): Likewise. (skylake_cost): Change CLEAR_RATIO to 17. * config/i386/x86-tune.def (X86_TUNE_PREFER_KNOWN_REP_MOVSB_STOSB): Replace m_CANNONLAKE, m_ICELAKE_CLIENT, m_ICELAKE_SERVER, m_TIGERLAKE and m_SAPPHIRERAPIDS with m_SKYLAKE and m_CORE_AVX512. gcc/testsuite/ * gcc.target/i386/memcpy-strategy-9.c: New test. * gcc.target/i386/memcpy-strategy-10.c: Likewise. * gcc.target/i386/memcpy-strategy-11.c: Likewise. * gcc.target/i386/memset-strategy-7.c: Likewise. * gcc.target/i386/memset-strategy-8.c: Likewise. * gcc.target/i386/memset-strategy-9.c: Likewise. --- gcc/testsuite/gcc.target/i386/memcpy-strategy-10.c | 11 +++++++++++ gcc/testsuite/gcc.target/i386/memcpy-strategy-11.c | 18 ++++++++++++++++++ gcc/testsuite/gcc.target/i386/memcpy-strategy-9.c | 9 +++++++++ gcc/testsuite/gcc.target/i386/memset-strategy-7.c | 11 +++++++++++ gcc/testsuite/gcc.target/i386/memset-strategy-8.c | 9 +++++++++ gcc/testsuite/gcc.target/i386/memset-strategy-9.c | 17 +++++++++++++++++ 6 files changed, 75 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/memcpy-strategy-10.c create mode 100644 gcc/testsuite/gcc.target/i386/memcpy-strategy-11.c create mode 100644 gcc/testsuite/gcc.target/i386/memcpy-strategy-9.c create mode 100644 gcc/testsuite/gcc.target/i386/memset-strategy-7.c create mode 100644 gcc/testsuite/gcc.target/i386/memset-strategy-8.c create mode 100644 gcc/testsuite/gcc.target/i386/memset-strategy-9.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/i386/memcpy-strategy-10.c b/gcc/testsuite/gcc.target/i386/memcpy-strategy-10.c new file mode 100644 index 0000000..970aa74 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/memcpy-strategy-10.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -march=skylake -mno-sse" } */ +/* { dg-final { scan-assembler "jmp\tmemcpy" { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler "call\tmemcpy" { target ia32 } } } */ +/* { dg-final { scan-assembler-not "rep movsb" } } */ + +void +foo (char *dest, char *src) +{ + __builtin_memcpy (dest, src, 257); +} diff --git a/gcc/testsuite/gcc.target/i386/memcpy-strategy-11.c b/gcc/testsuite/gcc.target/i386/memcpy-strategy-11.c new file mode 100644 index 0000000..b604194 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/memcpy-strategy-11.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -march=skylake" } */ +/* { dg-final { scan-assembler-not "jmp\tmemcpy" { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-not "call\tmemcpy" { target ia32 } } } */ +/* { dg-final { scan-assembler-not "rep movsb" } } */ + +typedef unsigned char e_u8; + +#define MAXBC 8 + +void MixColumn(e_u8 a[4][MAXBC], e_u8 BC) +{ + e_u8 b[4][MAXBC]; + int i, j; + + for(i = 0; i < 4; i++) + for(j = 0; j < BC; j++) a[i][j] = b[i][j]; +} diff --git a/gcc/testsuite/gcc.target/i386/memcpy-strategy-9.c b/gcc/testsuite/gcc.target/i386/memcpy-strategy-9.c new file mode 100644 index 0000000..b0dc748 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/memcpy-strategy-9.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -march=skylake -mno-sse" } */ +/* { dg-final { scan-assembler "rep movsb" } } */ + +void +foo (char *dest, char *src) +{ + __builtin_memcpy (dest, src, 256); +} diff --git a/gcc/testsuite/gcc.target/i386/memset-strategy-7.c b/gcc/testsuite/gcc.target/i386/memset-strategy-7.c new file mode 100644 index 0000000..07c2816 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/memset-strategy-7.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -march=skylake -mno-sse" } */ +/* { dg-final { scan-assembler "jmp\tmemset" { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler "call\tmemset" { target ia32 } } } */ +/* { dg-final { scan-assembler-not "rep stosb" } } */ + +void +foo (char *dest) +{ + __builtin_memset (dest, 0, 257); +} diff --git a/gcc/testsuite/gcc.target/i386/memset-strategy-8.c b/gcc/testsuite/gcc.target/i386/memset-strategy-8.c new file mode 100644 index 0000000..52ea882 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/memset-strategy-8.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -march=skylake -mno-sse" } */ +/* { dg-final { scan-assembler "rep stosb" } } */ + +void +foo (char *dest) +{ + __builtin_memset (dest, 0, 256); +} diff --git a/gcc/testsuite/gcc.target/i386/memset-strategy-9.c b/gcc/testsuite/gcc.target/i386/memset-strategy-9.c new file mode 100644 index 0000000..d4db031 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/memset-strategy-9.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -march=skylake" } */ +/* { dg-final { scan-assembler-not "jmp\tmemset" { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-not "call\tmemset" { target ia32 } } } */ +/* { dg-final { scan-assembler-not "rep stosb" } } */ + +typedef unsigned char e_u8; + +#define MAXBC 8 + +void MixColumn(e_u8 a[4][MAXBC], e_u8 BC) +{ + int i, j; + + for(i = 0; i < 4; i++) + for(j = 0; j < BC; j++) a[i][j] = 1; +} -- cgit v1.1 From 4bbd51afaa4a3c116fb538d912b35e126be80b41 Mon Sep 17 00:00:00 2001 From: "Vladimir N. Makarov" Date: Wed, 31 Mar 2021 13:26:30 -0400 Subject: [PR99781] Update correctly reg notes in LRA for multi-registers and set up biggest mode safely The PR is about incorrect use of partial_subreg_p for unordered modes. I found 2 places of dangerous comparing unordered modes in LRA. The patch removes dangerous use of paradoxical_subreg_p and partial_subreg_p in split_reg and process_bb_lives. The both places used them to solve PR77761 long time ago. But the problem was also fixed by later patches too (if there is no hard reg explicitly, it have VOIDmode and we use natural mode to split hard reg live, otherwise we use the biggest explicitly used mode for hard reg splitting). The PR also says about inaccurate update of reg notes in LRA. It happens for reg notes which refer for multi-registers. The patch also fixes this issue. gcc/ChangeLog: PR target/99781 * lra-constraints.c (split_reg): Don't check paradoxical_subreg_p. * lra-lives.c (clear_sparseset_regnos, regnos_in_sparseset_p): New functions. (process_bb_lives): Don't update biggest mode of hard reg for implicit in multi-register group. Use the new functions for updating dead_set and unused_set by register notes. gcc/testsuite/ChangeLog: PR target/99781 * g++.target/aarch64/sve/pr99781.C: New. --- gcc/testsuite/g++.target/aarch64/sve/pr99781.C | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 gcc/testsuite/g++.target/aarch64/sve/pr99781.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.target/aarch64/sve/pr99781.C b/gcc/testsuite/g++.target/aarch64/sve/pr99781.C new file mode 100644 index 0000000..21da8e0 --- /dev/null +++ b/gcc/testsuite/g++.target/aarch64/sve/pr99781.C @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-march=armv8-a+sve" } */ + +#include + +typedef int32_t vnx4si __attribute__((vector_size(32))); + +void +foo (int32_t val) +{ + register vnx4si x asm ("z0"); + register vnx4si y asm ("z1"); + asm volatile ("" : "=w" (y)); + val += 1; + vnx4si z = { val, val, val, val, val, val, val, val }; + x = (vnx4si) { -1, 0, 0, -1, 0, -1, 0, -1 } ? z : y; + asm volatile ("" :: "w" (x)); +} -- cgit v1.1 From dddf3bb0c37e8ff7f2c0488a46edfa18716d8a00 Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Mon, 5 Apr 2021 14:05:28 +0200 Subject: d: Merge upstream dmd 5cc71ff83, druntime 1134b710 D front-end changes: - Fix ICEs that occurred when using opaque enums. - Update `pragma(printf)' checking code to work on 16-bit targets. Phobos change: - Don't compile in argTypes code on AArch64 Reviewed-on: https://github.com/dlang/dmd/pull/12378 https://github.com/dlang/druntime/pull/3431 gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 5cc71ff83. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime 1134b710. --- gcc/testsuite/gdc.test/compilable/ice10770.d | 5 + .../gdc.test/fail_compilation/chkformat.d | 34 +++- .../gdc.test/fail_compilation/enum_init.d | 171 +++++++++++++++++++++ gcc/testsuite/gdc.test/fail_compilation/fail109.d | 8 +- gcc/testsuite/gdc.test/fail_compilation/ice10770.d | 13 -- gcc/testsuite/gdc.test/fail_compilation/ice8511.d | 13 -- 6 files changed, 213 insertions(+), 31 deletions(-) create mode 100644 gcc/testsuite/gdc.test/compilable/ice10770.d create mode 100644 gcc/testsuite/gdc.test/fail_compilation/enum_init.d delete mode 100644 gcc/testsuite/gdc.test/fail_compilation/ice10770.d delete mode 100644 gcc/testsuite/gdc.test/fail_compilation/ice8511.d (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gdc.test/compilable/ice10770.d b/gcc/testsuite/gdc.test/compilable/ice10770.d new file mode 100644 index 0000000..cf55833 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/ice10770.d @@ -0,0 +1,5 @@ +enum E1 : int; +static assert(is(E1 e == enum) && is(e == int)); + +enum E2; +static assert(is(E2 e == enum)); diff --git a/gcc/testsuite/gdc.test/fail_compilation/chkformat.d b/gcc/testsuite/gdc.test/fail_compilation/chkformat.d index 7451b3f..e9ed241 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/chkformat.d +++ b/gcc/testsuite/gdc.test/fail_compilation/chkformat.d @@ -36,7 +36,7 @@ fail_compilation/chkformat.d(214): Deprecation: argument `0` for format specific fail_compilation/chkformat.d(215): Deprecation: argument `0` for format specification `"%hhu"` must be `ubyte*`, not `int` fail_compilation/chkformat.d(216): Deprecation: argument `0` for format specification `"%hu"` must be `ushort*`, not `int` fail_compilation/chkformat.d(218): Deprecation: argument `0` for format specification `"%llu"` must be `ulong*`, not `int` -fail_compilation/chkformat.d(219): Deprecation: argument `0` for format specification `"%ju"` must be `ulong*`, not `int` +fail_compilation/chkformat.d(219): Deprecation: argument `0` for format specification `"%ju"` must be `core.stdc.stdint.uintmax_t*`, not `int` fail_compilation/chkformat.d(220): Deprecation: argument `0` for format specification `"%zu"` must be `size_t*`, not `int` fail_compilation/chkformat.d(221): Deprecation: argument `0` for format specification `"%tu"` must be `ptrdiff_t*`, not `int` fail_compilation/chkformat.d(222): Deprecation: argument `8.0L` for format specification `"%g"` must be `float*`, not `real` @@ -137,3 +137,35 @@ void test302() { va_list vargs; vscanf("%Q", vargs); } //void test() { vscanf(); } //void test() { vfscanf(); } //void test() { vsscanf(); } + +/* TEST_OUTPUT: +--- +fail_compilation/chkformat.d(401): Deprecation: argument `p` for format specification `"%u"` must be `uint`, not `char*` +fail_compilation/chkformat.d(402): Deprecation: argument `p` for format specification `"%d"` must be `int`, not `char*` +fail_compilation/chkformat.d(403): Deprecation: argument `p` for format specification `"%hhu"` must be `ubyte`, not `char*` +fail_compilation/chkformat.d(404): Deprecation: argument `p` for format specification `"%hhd"` must be `byte`, not `char*` +fail_compilation/chkformat.d(405): Deprecation: argument `p` for format specification `"%hu"` must be `ushort`, not `char*` +fail_compilation/chkformat.d(406): Deprecation: argument `p` for format specification `"%hd"` must be `short`, not `char*` +fail_compilation/chkformat.d(407): Deprecation: argument `p` for format specification `"%lu"` must be `$?:windows=uint|32=uint|64=ulong$`, not `char*` +fail_compilation/chkformat.d(408): Deprecation: argument `p` for format specification `"%ld"` must be `$?:windows=int|32=int|64=long$`, not `char*` +fail_compilation/chkformat.d(409): Deprecation: argument `p` for format specification `"%llu"` must be `ulong`, not `char*` +fail_compilation/chkformat.d(410): Deprecation: argument `p` for format specification `"%lld"` must be `long`, not `char*` +fail_compilation/chkformat.d(411): Deprecation: argument `p` for format specification `"%ju"` must be `core.stdc.stdint.uintmax_t`, not `char*` +fail_compilation/chkformat.d(412): Deprecation: argument `p` for format specification `"%jd"` must be `core.stdc.stdint.intmax_t`, not `char*` +--- +*/ + +#line 400 + +void test401() { char* p; printf("%u", p); } +void test402() { char* p; printf("%d", p); } +void test403() { char* p; printf("%hhu", p); } +void test404() { char* p; printf("%hhd", p); } +void test405() { char* p; printf("%hu", p); } +void test406() { char* p; printf("%hd", p); } +void test407() { char* p; printf("%lu", p); } +void test408() { char* p; printf("%ld", p); } +void test409() { char* p; printf("%llu", p); } +void test410() { char* p; printf("%lld", p); } +void test411() { char* p; printf("%ju", p); } +void test412() { char* p; printf("%jd", p); } diff --git a/gcc/testsuite/gdc.test/fail_compilation/enum_init.d b/gcc/testsuite/gdc.test/fail_compilation/enum_init.d new file mode 100644 index 0000000..ab6ba30 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/enum_init.d @@ -0,0 +1,171 @@ +/* +https://issues.dlang.org/show_bug.cgi?id=8511 + +TEST_OUTPUT: +--- +fail_compilation/enum_init.d(5): Error: type `SQRTMAX` has no value +--- +*/ +#line 1 + +real hypot() +{ + enum SQRTMAX; + SQRTMAX/2; +} + +/* +https://issues.dlang.org/show_bug.cgi?id=21785 + +TEST_OUTPUT: +--- +fail_compilation/enum_init.d(106): Error: enum `enum_init.NoBase` is opaque and has no default initializer +--- +*/ +#line 100 + +enum NoBase; + +void fooNB() +{ + NoBase nbv = void; + NoBase nb; +} + +/* +https://issues.dlang.org/show_bug.cgi?id=21785 + +TEST_OUTPUT: +--- +fail_compilation/enum_init.d(206): Error: enum `enum_init.Xobj` is opaque and has no default initializer +--- +*/ +#line 200 + +enum Xobj : void*; + +void main() +{ + Xobj vv = void; + Xobj var; +} + + +/* +https://issues.dlang.org/show_bug.cgi?id=21785 + +TEST_OUTPUT: +--- +fail_compilation/enum_init.d(306): Error: variable `enum_init.fooOB.ob` no definition of struct `S` +fail_compilation/enum_init.d(302): required by type `OpaqueBase` +--- +*/ +#line 300 + +struct S; +enum OpaqueBase : S; + +void fooOB() +{ + OpaqueBase ob; +} + +/* +TEST_OUTPUT: +--- +fail_compilation/enum_init.d(405): Error: enum `enum_init.forwardRef.Foo` forward reference of `Foo.init` +--- +*/ +#line 400 + +void forwardRef() +{ + enum Foo + { + a = Foo.init + } +} + +/* +https://issues.dlang.org/show_bug.cgi?id=21792 + +TEST_OUTPUT: +--- +fail_compilation/enum_init.d(503): Error: circular reference to enum base type `Bar` +--- +*/ +#line 500 + +void forwardRef2() +{ + enum Bar : Bar + { + a + } +} + +/* +TEST_OUTPUT: +--- +fail_compilation/enum_init.d(606): Error: enum member `enum_init.forwardRef3.Foo.b` is forward referenced looking for `.min` +fail_compilation/enum_init.d(607): Error: enum member `enum_init.forwardRef3.Foo.c` is forward referenced looking for `.min` +--- +*/ +#line 600 + +void forwardRef3() +{ + enum Foo + { + a, + b = Foo.min, + c + } +} + +/* +TEST_OUTPUT: +--- +fail_compilation/enum_init.d(711): Error: circular reference to enum base type `int[Bar.sizeof]` +--- +*/ +#line 700 + +void forwardRef4() +{ + enum Foo + { + a = Foo.sizeof, + c + } + // pragma(msg, typeof(Foo.sizeof)); + // static assert(is(Foo Base == enum) && is(Base == int)); + + enum Bar : int[Bar.sizeof] + { + a + } +} + +/* +TEST_OUTPUT: +--- +fail_compilation/enum_init.d(809): Error: enum `enum_init.opaqueProperties.Foo` is opaque and has no default initializer +fail_compilation/enum_init.d(810): Error: enum `enum_init.opaqueProperties.Foo` is opaque and has no `.min` +fail_compilation/enum_init.d(811): Error: enum `enum_init.opaqueProperties.Foo` is opaque and has no `.max` +--- +*/ +#line 800 + +void opaqueProperties() +{ + enum Foo; + + // Valid + enum size = Foo.sizeof; + enum s = Foo.mangleof; + + Foo f = Foo.init; + int min = Foo.min; + int max = Foo.max; +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail109.d b/gcc/testsuite/gdc.test/fail_compilation/fail109.d index 4fd5321..3e379c3 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail109.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail109.d @@ -53,10 +53,10 @@ enum B /* Bugzilla 11849 TEST_OUTPUT: --- -fail_compilation/fail109.d(72): Error: enum fail109.RegValueType1a recursive definition of `.max` property -fail_compilation/fail109.d(79): Error: enum fail109.RegValueType1b recursive definition of `.max` property -fail_compilation/fail109.d(84): Error: enum fail109.RegValueType2a recursive definition of `.min` property -fail_compilation/fail109.d(91): Error: enum fail109.RegValueType2b recursive definition of `.min` property +fail_compilation/fail109.d(72): Error: enum member `fail109.RegValueType1a.Unknown` is forward referenced looking for `.max` +fail_compilation/fail109.d(79): Error: enum member `fail109.RegValueType1b.Unknown` is forward referenced looking for `.max` +fail_compilation/fail109.d(84): Error: enum member `fail109.RegValueType2a.Unknown` is forward referenced looking for `.min` +fail_compilation/fail109.d(91): Error: enum member `fail109.RegValueType2b.Unknown` is forward referenced looking for `.min` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice10770.d b/gcc/testsuite/gdc.test/fail_compilation/ice10770.d deleted file mode 100644 index 5b0659a..0000000 --- a/gcc/testsuite/gdc.test/fail_compilation/ice10770.d +++ /dev/null @@ -1,13 +0,0 @@ -/* -TEST_OUTPUT: ---- -fail_compilation/ice10770.d(13): Error: enum ice10770.E2 is forward referenced looking for base type -fail_compilation/ice10770.d(13): while evaluating: `static assert(is(E2 e == enum))` ---- -*/ - -enum E1 : int; -static assert(is(E1 e == enum) && is(e == int)); - -enum E2; -static assert(is(E2 e == enum)); diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice8511.d b/gcc/testsuite/gdc.test/fail_compilation/ice8511.d deleted file mode 100644 index 873f896..0000000 --- a/gcc/testsuite/gdc.test/fail_compilation/ice8511.d +++ /dev/null @@ -1,13 +0,0 @@ -/* -TEST_OUTPUT: ---- -fail_compilation/ice8511.d(11): Error: enum ice8511.hypot.SQRTMAX is forward referenced looking for base type -fail_compilation/ice8511.d(12): Error: incompatible types for ((SQRTMAX) / (2)): cannot use '/' with types ---- -*/ - -real hypot() -{ - enum SQRTMAX; - SQRTMAX/2; -} -- cgit v1.1 From 8685348075d91945066dea9b564bd42cbc1d22bd Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 6 Apr 2021 01:21:05 -0400 Subject: c++: C++17 constexpr static data member linkage [PR99901] C++17 makes constexpr static data members implicitly inline variables. In C++14, a subsequent out-of-class declaration is the definition. We want to continue emitting a symbol for such a declaration in C++17 mode, for ABI compatibility with C++14 code that wants to refer to it. Normally I'd distinguish in- and out-of-class declarations by looking at DECL_IN_AGGR_P, but we never set DECL_IN_AGGR_P on inline variables. I think that's wrong, but don't want to mess with it so close to release. Conveniently, we already have a test for in-class declaration earlier in the function. gcc/cp/ChangeLog: PR c++/99901 * decl.c (cp_finish_decl): mark_needed an implicitly inline static data member with an out-of-class redeclaration. gcc/testsuite/ChangeLog: PR c++/99901 * g++.dg/cpp1z/inline-var9.C: New test. --- gcc/testsuite/g++.dg/cpp1z/inline-var9.C | 40 ++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1z/inline-var9.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp1z/inline-var9.C b/gcc/testsuite/g++.dg/cpp1z/inline-var9.C new file mode 100644 index 0000000..43c9748 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/inline-var9.C @@ -0,0 +1,40 @@ +// PR c++/99901 +// { dg-do compile { target c++11 } } +// { dg-final { scan-assembler-not "_ZN1A1aE" } } +// { dg-final { scan-assembler-not "_ZN2A21aE" } } +// { dg-final { scan-assembler-not "_ZN1CIiE1cE" } } +// { dg-final { scan-assembler "_ZN1B1bE" } } +// { dg-final { scan-assembler "_ZN2B21bE" } } +// { dg-final { scan-assembler "_ZN2B31bE" } } + +struct A { + static const int a = 5; +}; + +struct A2 { + static constexpr int a = 5; +}; + +struct B { + static const int b; +}; +constexpr int B::b = 5; + +struct B2 { + static const int b = 5; +}; +constexpr int B2::b; + +struct B3 { + static constexpr int b = 5; +}; +const int B3::b; + +template +struct C { + static constexpr int c = 5; +}; +template +constexpr int C::c; + +int i = C::c; -- cgit v1.1 From de03b82f3ca9103eba3699d1dc91b1d0ee1f16cb Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 6 Apr 2021 15:13:02 -0400 Subject: c++: access checking in aggregate initialization [PR96673] We were deferring access checks while parsing B{}, didn't adjust that when we went to instantiate the default member initializer for B::c, deferred access checking for C::C, and then checked it after parsing B{}, back in the main() context which has no access. We need to do the access checks in the class context of the DMI. I tried fixing this in push_to/pop_from_top_level, but that caused several regressions. gcc/cp/ChangeLog: PR c++/96673 * init.c (get_nsdmi): Don't defer access checking. gcc/testsuite/ChangeLog: PR c++/96673 * g++.dg/cpp1y/nsdmi-aggr13.C: New test. --- gcc/testsuite/g++.dg/cpp1y/nsdmi-aggr13.C | 33 +++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1y/nsdmi-aggr13.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp1y/nsdmi-aggr13.C b/gcc/testsuite/g++.dg/cpp1y/nsdmi-aggr13.C new file mode 100644 index 0000000..845e26f --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/nsdmi-aggr13.C @@ -0,0 +1,33 @@ +// PR c++/96673 +// { dg-do compile { target c++11 } } + +template +class A {}; + +template +class B; + +template +class C { + private: + + friend class B; + + explicit C(A&) {}; +}; + + +template +class B { + public: + B() = default; + //B() {}; // << This implementation of the constructor makes it work + + A a = {}; + C c = C{a}; +}; + +int main() { + auto b = B{}; + auto &c = b.c; +} -- cgit v1.1 From 8cac6af6f8ba5cce69161459e572e59c2be60e75 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 7 Apr 2021 00:16:39 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 61 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0a295b0..97874f9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,64 @@ +2021-04-06 Jason Merrill + + PR c++/96673 + * g++.dg/cpp1y/nsdmi-aggr13.C: New test. + +2021-04-06 Jason Merrill + + PR c++/99901 + * g++.dg/cpp1z/inline-var9.C: New test. + +2021-04-06 Vladimir N. Makarov + + PR target/99781 + * g++.target/aarch64/sve/pr99781.C: New. + +2021-04-06 H.J. Lu + + * gcc.target/i386/memcpy-strategy-9.c: New test. + * gcc.target/i386/memcpy-strategy-10.c: Likewise. + * gcc.target/i386/memcpy-strategy-11.c: Likewise. + * gcc.target/i386/memset-strategy-7.c: Likewise. + * gcc.target/i386/memset-strategy-8.c: Likewise. + * gcc.target/i386/memset-strategy-9.c: Likewise. + +2021-04-06 Richard Biener + + PR tree-optimization/99880 + * gcc.dg/torture/pr99880.c: New testcase. + +2021-04-06 Nathan Sidwell + + * g++.dg/modules/builtin-3_a.C: Remove dump scans. + * g++.dg/modules/builtin-3_b.C: Remove dump scans. + +2021-04-06 Jakub Jelinek + + PR tree-optimization/96573 + * gcc.dg/pr96573.c: Instead of __builtin_bswap accept also + VEC_PERM_EXPR with bswapping permutation. + +2021-04-06 Richard Biener + + PR tree-optimization/99924 + * gfortran.dg/vect/pr99924.f90: New testcase. + +2021-04-06 Jakub Jelinek + + PR c++/97900 + * g++.dg/ext/vector40.C: Add -Wno-psabi -w to dg-options. + +2021-04-06 Jason Merrill + + PR c++/91241 + * g++.dg/abi/lambda-defarg1.C: New test. + +2021-04-06 Patrick Palka + + PR c++/99899 + * g++.dg/cpp2a/concepts-placeholder7.C: New test. + * g++.dg/cpp2a/concepts-placeholder8.C: New test. + 2021-04-05 Jason Merrill PR c++/96311 -- cgit v1.1 From a7698c0e1ecad65b1ab651acc82b34e12c7efd35 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Tue, 6 Apr 2021 22:17:33 -0400 Subject: c++: Add test for Core issue 1376 [PR52202] As Jens says in the PR, we handle this correctly. gcc/testsuite/ChangeLog: PR c++/52202 * g++.dg/cpp0x/rv-life.C: New test. --- gcc/testsuite/g++.dg/cpp0x/rv-life.C | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/rv-life.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp0x/rv-life.C b/gcc/testsuite/g++.dg/cpp0x/rv-life.C new file mode 100644 index 0000000..0fd1119 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/rv-life.C @@ -0,0 +1,12 @@ +// Core 1376 +// PR c++/52202 +// { dg-do run { target c++11 } } + +extern "C" void abort(); +bool x; +struct T { ~T() { if (!x) abort (); } }; +int main() +{ + T&& r = static_cast(T()); + x = true; +} -- cgit v1.1 From e0bdccac582c01c928a05f26edcd8f5ac24669eb Mon Sep 17 00:00:00 2001 From: Bin Cheng Date: Wed, 7 Apr 2021 10:24:32 +0800 Subject: tree-optimization/98736 - use programing order preserved RPO in ldist Tree loop distribution uses RPO to build reduced dependence graph, it's important that RPO preserves the original programing order. Though it usually does so, when distributing loop nest, exit BB can be placed before some loop BBs while after loop header. This patch fixes the issue by calling rev_post_order_and_mark_dfs_back_seme. gcc/ChangeLog: PR tree-optimization/98736 * tree-loop-distribution.c * (loop_distribution::bb_top_order_init): Compute RPO with programing order preserved by calling function rev_post_order_and_mark_dfs_back_seme. gcc/testsuite/ChangeLog: PR tree-optimization/98736 * gcc.c-torture/execute/pr98736.c: New test. --- gcc/testsuite/gcc.c-torture/execute/pr98736.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr98736.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.c-torture/execute/pr98736.c b/gcc/testsuite/gcc.c-torture/execute/pr98736.c new file mode 100644 index 0000000..c066abc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr98736.c @@ -0,0 +1,14 @@ +/* PR tree-optimization/98736 */ + +int a[6]; +char b, c; +int main() { + int d[4] = {0, 0, 0, 0}; + for (c = 0; c <= 5; c++) { + for (b = 2; b != 0; b++) + a[c] = 8; + a[c] = d[3]; + } + if (a[0] != 0) + __builtin_abort(); +} -- cgit v1.1 From d11bcbe166c03f722c0e0d41d6e87ac445758fba Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 7 Apr 2021 10:02:07 +0200 Subject: tree-optimization/99947 - avoid v.safe_push (v[0]) This avoids (again) the C++ pitfall of pushing a reference to sth being reallocated. 2021-04-07 Richard Biener PR tree-optimization/99947 * tree-vect-loop.c (vectorizable_induction): Pre-allocate steps vector to avoid pushing elements from the reallocated vector. * gcc.dg/torture/pr99947.c: New testcase. --- gcc/testsuite/gcc.dg/torture/pr99947.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/torture/pr99947.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/torture/pr99947.c b/gcc/testsuite/gcc.dg/torture/pr99947.c new file mode 100644 index 0000000..2cf3ec6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr99947.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ + +int a, b, d, e; +short c; +void f() { + for (; e; e++) { + int g = 6; + for (; g > 2; g--) { + int i = -8; + while (i < 20) { + i += 5; + a += b; + } + c *= d; + } + b--; + } +} -- cgit v1.1 From 0d6ad10c170e3670f0b5e3709e0fa6e76b7065b3 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 7 Apr 2021 13:21:23 +0200 Subject: testsuite/99955 - fix may_alias declaration of vector This fixes the order of the type attributes to preserve may_alias for the vector type. 2021-04-07 Richard Biener PR testsuite/99955 * gcc.c-torture/execute/pr92618.c: Move may_alias attributes last. --- gcc/testsuite/gcc.c-torture/execute/pr92618.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.c-torture/execute/pr92618.c b/gcc/testsuite/gcc.c-torture/execute/pr92618.c index 2a5e565..88f2f68 100644 --- a/gcc/testsuite/gcc.c-torture/execute/pr92618.c +++ b/gcc/testsuite/gcc.c-torture/execute/pr92618.c @@ -1,6 +1,6 @@ /* PR tree-optimization/92618 */ -typedef long long __m128i __attribute__((__may_alias__, __vector_size__(2 * sizeof (long long)))); +typedef long long __m128i __attribute__((__vector_size__(2 * sizeof (long long)),__may_alias__)); double a[4]; unsigned long long b[4]; @@ -14,7 +14,7 @@ bar (void) } #if __SIZEOF_LONG_LONG__ == __SIZEOF_DOUBLE__ -typedef double __m128d __attribute__((__may_alias__, __vector_size__(2 * sizeof (double)))); +typedef double __m128d __attribute__((__vector_size__(2 * sizeof (double)),__may_alias__)); __attribute__((noipa)) __m128i qux (void) -- cgit v1.1 From c01ae2ab6b227e21835d128c90e974dce4604be9 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 7 Apr 2021 13:17:05 +0200 Subject: tree-optimization/99954 - fix loop distribution memcpy classification This fixes bogus classification of a copy as memcpy. We cannot use plain dependence analysis to decide between memcpy and memmove when it computes no dependence. Instead we have to try harder later which the patch does for the gcc.dg/tree-ssa/ldist-24.c testcase by resorting to tree-affine to compute the difference between src and dest and compare against the copy size. 2021-04-07 Richard Biener PR tree-optimization/99954 * tree-loop-distribution.c: Include tree-affine.h. (generate_memcpy_builtin): Try using tree-affine to prove non-overlap. (loop_distribution::classify_builtin_ldst): Always classify as PKIND_MEMMOVE. * gcc.dg/torture/pr99954.c: New testcase. --- gcc/testsuite/gcc.dg/torture/pr99954.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/torture/pr99954.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/torture/pr99954.c b/gcc/testsuite/gcc.dg/torture/pr99954.c new file mode 100644 index 0000000..7d44703 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr99954.c @@ -0,0 +1,30 @@ +/* { dg-do run } */ + +#include + +#define CONTAINER_KIND union + +typedef CONTAINER_KIND container { int value; } container; + +void move(container* end, container* start) { + container* p; + for (p = end; p > start; p--) { + (p)->value = (p-1)->value; + } +} + +#define N 100 + +int main(int argc, char* argv[]) { + container vals[N]; + int i; + for (i=0; i Date: Wed, 7 Apr 2021 15:21:55 +0100 Subject: vect: Don't split store groups if we have IFN_STORE_LANES [PR99873] As noted in the PR, we were no longer using ST3 for the testcase and instead stored each lane individually. This is because we'd split the store group during SLP and couldn't recover when SLP failed. However, we can also get better code with ST3 and ST4 even if SLP would have succeeded, such as for vect-complex-5.c. I'm not sure exactly where the cut-off point is, but it seems reasonable to allow the split if either of the new groups would operate on full vectors *within* rather than across scalar loop iterations. E.g. on a Cortex-A57, pr99873_3.c performs better using ST4 while pr99873_2.c performs better with SLP. Another factor is that SLP can handle smaller iteration counts than IFN_STORE_LANES can, but we don't have the infrastructure to choose reliably based on that. gcc/ PR tree-optimization/99873 * tree-vect-slp.c (vect_slp_prefer_store_lanes_p): New function. (vect_build_slp_instance): Don't split store groups that could use IFN_STORE_LANES. gcc/testsuite/ * gcc.dg/vect/slp-21.c: Only expect 2 of the loops to use SLP if IFN_STORE_LANES is available. * gcc.dg/vect/vect-complex-5.c: Expect no loops to use SLP if IFN_STORE_LANES is available. * gcc.target/aarch64/pr99873_1.c: New test. * gcc.target/aarch64/pr99873_2.c: Likewise. * gcc.target/aarch64/pr99873_3.c: Likewise. * gcc.target/aarch64/sve/pr99873_1.c: Likewise. * gcc.target/aarch64/sve/pr99873_2.c: Likewise. * gcc.target/aarch64/sve/pr99873_3.c: Likewise. --- gcc/testsuite/gcc.dg/vect/slp-21.c | 4 ++-- gcc/testsuite/gcc.dg/vect/vect-complex-5.c | 3 ++- gcc/testsuite/gcc.target/aarch64/pr99873_1.c | 17 +++++++++++++++++ gcc/testsuite/gcc.target/aarch64/pr99873_2.c | 20 ++++++++++++++++++++ gcc/testsuite/gcc.target/aarch64/pr99873_3.c | 20 ++++++++++++++++++++ gcc/testsuite/gcc.target/aarch64/sve/pr99873_1.c | 15 +++++++++++++++ gcc/testsuite/gcc.target/aarch64/sve/pr99873_2.c | 18 ++++++++++++++++++ gcc/testsuite/gcc.target/aarch64/sve/pr99873_3.c | 18 ++++++++++++++++++ 8 files changed, 112 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.target/aarch64/pr99873_1.c create mode 100644 gcc/testsuite/gcc.target/aarch64/pr99873_2.c create mode 100644 gcc/testsuite/gcc.target/aarch64/pr99873_3.c create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/pr99873_1.c create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/pr99873_2.c create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/pr99873_3.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/vect/slp-21.c b/gcc/testsuite/gcc.dg/vect/slp-21.c index bf8f434..8539397 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-21.c +++ b/gcc/testsuite/gcc.dg/vect/slp-21.c @@ -210,7 +210,7 @@ int main (void) Not all vect_perm targets support that, and it's a bit too specific to have its own effective-target selector, so we just test targets directly. */ -/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 4 "vect" { target { aarch64*-*-* arm*-*-* powerpc64*-*-* } } } } */ -/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" { target { vect_strided4 && { ! { aarch64*-*-* arm*-*-* powerpc64*-*-* } } } } } } */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 4 "vect" { target powerpc64*-*-* } } } */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" { target { vect_strided4 && { ! powerpc64*-*-* } } } } } */ /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" { target { ! { vect_strided4 } } } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-complex-5.c b/gcc/testsuite/gcc.dg/vect/vect-complex-5.c index 81fdb67c..addcf60 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-complex-5.c +++ b/gcc/testsuite/gcc.dg/vect/vect-complex-5.c @@ -40,4 +40,5 @@ main (void) return 0; } -/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" { xfail { ! vect_hw_misalign } } } } */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" { target vect_load_lanes } } } */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" { target { ! vect_load_lanes } xfail { ! vect_hw_misalign } } } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/pr99873_1.c b/gcc/testsuite/gcc.target/aarch64/pr99873_1.c new file mode 100644 index 0000000..bc4d81e --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr99873_1.c @@ -0,0 +1,17 @@ +/* { dg-options "-O3" } */ + +#pragma GCC target "+nosve" + +void +f (int *restrict x, int *restrict y, int *restrict z, int n) +{ + for (int i = 0; i < n; i += 3) + { + x[i] = y[i] + z[i]; + x[i + 1] = y[i + 1] - z[i + 1]; + x[i + 2] = y[i + 2] | z[i + 2]; + } +} + +/* { dg-final { scan-assembler-times {\tld3\t} 2 } } */ +/* { dg-final { scan-assembler-times {\tst3\t} 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/pr99873_2.c b/gcc/testsuite/gcc.target/aarch64/pr99873_2.c new file mode 100644 index 0000000..b73fbdc --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr99873_2.c @@ -0,0 +1,20 @@ +/* { dg-options "-O3" } */ + +#include + +#pragma GCC target "+nosve" + +void __attribute ((noipa)) +foo (uint64_t *__restrict x, uint64_t *__restrict y, int n) +{ + for (int i = 0; i < n; i += 4) + { + x[i] += y[i]; + x[i + 1] += y[i + 1]; + x[i + 2] |= y[i + 2]; + x[i + 3] |= y[i + 3]; + } +} + +/* { dg-final { scan-assembler-not {\tld4\t} } } */ +/* { dg-final { scan-assembler-not {\tst4\t} } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/pr99873_3.c b/gcc/testsuite/gcc.target/aarch64/pr99873_3.c new file mode 100644 index 0000000..ccbab6d --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr99873_3.c @@ -0,0 +1,20 @@ +/* { dg-options "-O3" } */ + +#include + +#pragma GCC target "+nosve" + +void __attribute ((noipa)) +foo (uint32_t *__restrict x, uint32_t *__restrict y, int n) +{ + for (int i = 0; i < n; i += 4) + { + x[i] += y[i]; + x[i + 1] += y[i + 1]; + x[i + 2] |= y[i + 2]; + x[i + 3] |= y[i + 3]; + } +} + +/* { dg-final { scan-assembler-times {\tld4\t} 2 } } */ +/* { dg-final { scan-assembler-times {\tst4\t} 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr99873_1.c b/gcc/testsuite/gcc.target/aarch64/sve/pr99873_1.c new file mode 100644 index 0000000..f4b95da --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/pr99873_1.c @@ -0,0 +1,15 @@ +/* { dg-options "-O3" } */ + +void +f (int *restrict x, int *restrict y, int *restrict z, int n) +{ + for (int i = 0; i < n; i += 3) + { + x[i] = y[i] + z[i]; + x[i + 1] = y[i + 1] - z[i + 1]; + x[i + 2] = y[i + 2] | z[i + 2]; + } +} + +/* { dg-final { scan-assembler-times {\tld3w\t} 2 } } */ +/* { dg-final { scan-assembler-times {\tst3w\t} 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr99873_2.c b/gcc/testsuite/gcc.target/aarch64/sve/pr99873_2.c new file mode 100644 index 0000000..03dc4ef --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/pr99873_2.c @@ -0,0 +1,18 @@ +/* { dg-options "-O3" } */ + +#include + +void __attribute ((noipa)) +foo (uint64_t *__restrict x, uint64_t *__restrict y, int n) +{ + for (int i = 0; i < n; i += 4) + { + x[i] += y[i]; + x[i + 1] += y[i + 1]; + x[i + 2] |= y[i + 2]; + x[i + 3] |= y[i + 3]; + } +} + +/* { dg-final { scan-assembler-times {\tld4d\t} 2 } } */ +/* { dg-final { scan-assembler-times {\tst4d\t} 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr99873_3.c b/gcc/testsuite/gcc.target/aarch64/sve/pr99873_3.c new file mode 100644 index 0000000..87a0141 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/pr99873_3.c @@ -0,0 +1,18 @@ +/* { dg-options "-O3" } */ + +#include + +void __attribute ((noipa)) +foo (uint32_t *__restrict x, uint32_t *__restrict y, int n) +{ + for (int i = 0; i < n; i += 4) + { + x[i] += y[i]; + x[i + 1] += y[i + 1]; + x[i + 2] |= y[i + 2]; + x[i + 3] |= y[i + 3]; + } +} + +/* { dg-final { scan-assembler-times {\tld4w\t} 2 } } */ +/* { dg-final { scan-assembler-times {\tst4w\t} 1 } } */ -- cgit v1.1 From 2f3d9104610cb2058cf091707a20c1c6eff8d470 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Wed, 7 Apr 2021 15:21:56 +0100 Subject: vect: Restore variable-length SLP permutes [PR97513] Many of the gcc.target/sve/slp-perm*.c tests started failing after the introduction of separate SLP permute nodes. This patch adds variable-length support using a similar technique to vect_transform_slp_perm_load. As there, the idea is to detect when every permute mask vector is the same and can be generated using a regular stepped sequence. We can easily handle those cases for variable-length, but still need to restrict the general case to constant-length. Again copying vect_transform_slp_perm_load, the idea is to distinguish the two cases regardless of whether the length is variable or not, partly to increase testing coverage and partly because it avoids generating redundant trees. Doing this means that we can also use SLP for the two-vector permute in pr88834.c, which we couldn't before VEC_PERM_EXPR nodes were introduced. The patch therefore makes pr88834.c check that we don't regress back to not using SLP and adds pr88834_ld3.c to check for the original problem in the PR. gcc/ PR tree-optimization/97513 * tree-vect-slp.c (vect_add_slp_permutation): New function, split out from... (vectorizable_slp_permutation): ...here. Detect cases in which all VEC_PERM_EXPRs are guaranteed to have the same stepped permute vector and only generate one permute vector for that case. Extend that case to handle variable-length vectors. gcc/testsuite/ * gcc.target/aarch64/sve/pr88834.c: Expect the vectorizer to use SLP. * gcc.target/aarch64/sve/pr88834_ld3.c: New test. --- gcc/testsuite/gcc.target/aarch64/sve/pr88834.c | 5 +++-- gcc/testsuite/gcc.target/aarch64/sve/pr88834_ld3.c | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/pr88834_ld3.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr88834.c b/gcc/testsuite/gcc.target/aarch64/sve/pr88834.c index 7e7be4e..818291e 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/pr88834.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/pr88834.c @@ -11,5 +11,6 @@ f (int *restrict x, int *restrict y, int *restrict z, int n) } } -/* { dg-final { scan-assembler-times {\tld2w\t{z[0-9]+.s - z[0-9]+.s}, p[0-7]/z, \[x[0-9]+, x[0-9]+, lsl 2\]\n} 2 } } */ -/* { dg-final { scan-assembler-times {\tst2w\t{z[0-9]+.s - z[0-9]+.s}, p[0-7], \[x[0-9]+, x[0-9]+, lsl 2\]\n} 1 } } */ +/* { dg-final { scan-assembler {\tptrue\tp[0-7]\.d, all\n} } } */ +/* { dg-final { scan-assembler-times {\tld1w\tz[0-9]+.s, p[0-7]/z, \[x[0-9]+, x[0-9]+, lsl 2\]\n} 2 } } */ +/* { dg-final { scan-assembler-times {\tst1w\tz[0-9]+.s, p[0-7], \[x[0-9]+, x[0-9]+, lsl 2\]\n} 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr88834_ld3.c b/gcc/testsuite/gcc.target/aarch64/sve/pr88834_ld3.c new file mode 100644 index 0000000..5936b87 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/pr88834_ld3.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +void +f (int *restrict x, int *restrict y, int *restrict z, int n) +{ + for (int i = 0; i < n; i += 3) + { + x[i] = y[i] + z[i]; + x[i + 1] = y[i + 1] - z[i + 1]; + x[i + 2] = y[i + 2] | z[i + 2]; + } +} + +/* { dg-final { scan-assembler-times {\tld3w\t{z[0-9]+.s - z[0-9]+.s}, p[0-7]/z, \[x[0-9]+, x[0-9]+, lsl 2\]\n} 2 } } */ +/* { dg-final { scan-assembler-times {\tst3w\t{z[0-9]+.s - z[0-9]+.s}, p[0-7], \[x[0-9]+, x[0-9]+, lsl 2\]\n} 1 } } */ -- cgit v1.1 From 12029c04d01c7ba0f775cdc208edf29490ee5db6 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Wed, 7 Apr 2021 19:46:37 +0100 Subject: testsuite: Fix many UNRESOLVEDs for gcc.dg/vect It turns out that, on targets that use testglue, many gcc.dg/vect scan-dump tests became UNRESOLVED after the change to the dump file naming scheme. The problem is that, when creating an executable, we normally name the dump file after both the executable and the source file name. However, as an exception, we name it after only the source file name if: (a) there is only one source file name and (b) the source file and the executable have the same basename Both (a) and (b) are normally true when building executables from gcc.dg/vect. But (a) is not true when linking against testglue. The harness was therefore looking for a dump file based only on the source file name while the compiler was producing a dump file that contained both names. We get around this for dg-additional-sources using: # This option restores naming of aux and dump output files # after input files when multiple input files are named, # instead of getting them combined with the output name. lappend options "additional_flags=-dumpbase \"\"" This patch does the same thing for executables that are linked against testglue. This removes over 2400 UNRESOLVEDs from an armeb-eabi test run, but in so doing introduces FAILs for some tests that were previously skipped. gcc/testsuite/ * lib/gcc.exp (gcc_target_compile): Add -dumpbase "" when building an executable with testglue. --- gcc/testsuite/lib/gcc.exp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/lib/gcc.exp b/gcc/testsuite/lib/gcc.exp index dda4d0e..4d80606 100644 --- a/gcc/testsuite/lib/gcc.exp +++ b/gcc/testsuite/lib/gcc.exp @@ -134,6 +134,9 @@ proc gcc_target_compile { source dest type options } { [info exists gluefile] } { lappend options "libs=${gluefile}" lappend options "ldflags=$wrap_flags" + if { $type == "executable" } { + set options [concat "{additional_flags=-dumpbase \"\"}" $options] + } } global TEST_EXTRA_LIBS -- cgit v1.1 From a528594cf9a74e5a0fbac13ef673064ed73e1b89 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 7 Apr 2021 14:55:48 -0400 Subject: c++: using overloaded with local decl [PR92918] The problem here was that the lookup for 'impl' when parsing the template only found the using-declaration, not the member function declaration. This happened because when trying to add the member function declaration, push_class_level_binding_1 saw that the current binding was a USING_DECL and the new value is an overload, and decided to just return success. That 'return true' dates back to r69921. In https://gcc.gnu.org/pipermail/gcc-patches/2003-July/110632.html Nathan mentions that we only push dependent USING_DECLs, which is no longer the case; now that we retain more USING_DECLs, handling this case like the other overloaded function cases seems like the obvious solution. gcc/cp/ChangeLog: PR c++/92918 * name-lookup.c (push_class_level_binding_1): Do overload a new function with a previous using-declaration. gcc/testsuite/ChangeLog: PR c++/92918 * g++.dg/lookup/using66.C: New test. --- gcc/testsuite/g++.dg/lookup/using66.C | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 gcc/testsuite/g++.dg/lookup/using66.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/lookup/using66.C b/gcc/testsuite/g++.dg/lookup/using66.C new file mode 100644 index 0000000..02383bb --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/using66.C @@ -0,0 +1,23 @@ +// PR c++/92918 +// { dg-do compile { target c++11 } } + +struct Base03 +{ + static void impl(); +}; + +struct Problem : Base03 +{ + using Base03::impl; + static int impl(char const *); + + template + auto f(const T &t) const + -> decltype(impl(t)) + { + return impl(t); + } +}; + +Problem t; +int i = t.f("42"); -- cgit v1.1 From b40d45cb1930e9aa8a1f9a6a8728fd47ebeeaaac Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 7 Apr 2021 15:38:07 -0400 Subject: c++: base template friend [PR52625] Here we were mistakenly treating the injected-class-name as a partial specialization. gcc/cp/ChangeLog: PR c++/52625 * pt.c (maybe_process_partial_specialization): Check DECL_SELF_REFERENCE_P. gcc/testsuite/ChangeLog: PR c++/52625 * g++.dg/template/friend70.C: New test. --- gcc/testsuite/g++.dg/template/friend70.C | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 gcc/testsuite/g++.dg/template/friend70.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/template/friend70.C b/gcc/testsuite/g++.dg/template/friend70.C new file mode 100644 index 0000000..5496548 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/friend70.C @@ -0,0 +1,9 @@ +// PR c++/52625 + +template +class base {}; + +class derived : public base +{ + template friend class base; +}; -- cgit v1.1 From fb5ed6d8c90a4bf8e677a3ff9bd79d83636ccff9 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 7 Apr 2021 16:42:44 -0400 Subject: c++: friend with redundant qualification [PR41723] Different code paths were correctly choosing to look up D directly, since C is the current instantiation, but here we decided to try to make it a typename type, leading to confusion. Fixed by using dependent_scope_p as we do elsewhere. gcc/cp/ChangeLog: PR c++/41723 * parser.c (cp_parser_class_name): Check dependent_scope_p. gcc/testsuite/ChangeLog: PR c++/41723 * g++.dg/template/friend71.C: New test. --- gcc/testsuite/g++.dg/template/friend71.C | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 gcc/testsuite/g++.dg/template/friend71.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/template/friend71.C b/gcc/testsuite/g++.dg/template/friend71.C new file mode 100644 index 0000000..939ea6b --- /dev/null +++ b/gcc/testsuite/g++.dg/template/friend71.C @@ -0,0 +1,8 @@ +// PR c++/41723 + +template +class C { + template class D {}; + + friend class C::D; +}; -- cgit v1.1 From 299859c2a458062c882c68c2e24022497726408f Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 8 Apr 2021 00:16:44 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 64 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 97874f9..b5de7aa 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,67 @@ +2021-04-07 Jason Merrill + + PR c++/41723 + * g++.dg/template/friend71.C: New test. + +2021-04-07 Jason Merrill + + PR c++/52625 + * g++.dg/template/friend70.C: New test. + +2021-04-07 Jason Merrill + + PR c++/92918 + * g++.dg/lookup/using66.C: New test. + +2021-04-07 Richard Sandiford + + * lib/gcc.exp (gcc_target_compile): Add -dumpbase "" + when building an executable with testglue. + +2021-04-07 Richard Sandiford + + * gcc.target/aarch64/sve/pr88834.c: Expect the vectorizer to use SLP. + * gcc.target/aarch64/sve/pr88834_ld3.c: New test. + +2021-04-07 Richard Sandiford + + * gcc.dg/vect/slp-21.c: Only expect 2 of the loops to use SLP + if IFN_STORE_LANES is available. + * gcc.dg/vect/vect-complex-5.c: Expect no loops to use SLP if + IFN_STORE_LANES is available. + * gcc.target/aarch64/pr99873_1.c: New test. + * gcc.target/aarch64/pr99873_2.c: Likewise. + * gcc.target/aarch64/pr99873_3.c: Likewise. + * gcc.target/aarch64/sve/pr99873_1.c: Likewise. + * gcc.target/aarch64/sve/pr99873_2.c: Likewise. + * gcc.target/aarch64/sve/pr99873_3.c: Likewise. + +2021-04-07 Richard Biener + + PR tree-optimization/99954 + * gcc.dg/torture/pr99954.c: New testcase. + +2021-04-07 Richard Biener + + PR testsuite/99955 + * gcc.c-torture/execute/pr92618.c: Move may_alias attributes + last. + +2021-04-07 Richard Biener + + PR tree-optimization/99947 + * gcc.dg/torture/pr99947.c: New testcase. + +2021-04-07 Bin Cheng + + PR tree-optimization/98736 + * gcc.c-torture/execute/pr98736.c: New test. + +2021-04-07 Marek Polacek + + PR c++/52202 + * g++.dg/cpp0x/rv-life.C: New test. + 2021-04-06 Jason Merrill PR c++/96673 -- cgit v1.1 From 67d56b272021363eb58c319ca3b73beba3a60817 Mon Sep 17 00:00:00 2001 From: Alex Coplan Date: Thu, 8 Apr 2021 09:36:57 +0100 Subject: arm: Various MVE vec_duplicate fixes [PR99647] This patch fixes various issues with vec_duplicate in the MVE patterns. Currently there are two patterns named *mve_mov. The second of these is really a vector duplicate rather than a move, so I've renamed it accordingly. As it stands, there are several issues with this pattern: 1. The MVE_types iterator has an entry for TImode, but vec_duplicate:TI is invalid. 2. The mode of the operand to vec_duplicate is SImode, but it should vary according to the vector mode iterator. 3. The second alternative of this pattern is bogus: it allows matching symbol_refs (the cause of the PR) and const_ints (which means that it matches (vec_duplicate (const_int ...)) which is non-canonical: such rtxes should be const_vectors instead and handled by the main vector move pattern). This patch fixes all of these issues, and removes the redundant *mve_vec_duplicate pattern. gcc/ChangeLog: PR target/99647 * config/arm/iterators.md (MVE_vecs): New. (V_elem): Also handle V2DF. * config/arm/mve.md (*mve_mov): Rename to ... (*mve_vdup): ... this. Remove second alternative since vec_duplicate of const_int is not canonical RTL, and we don't want to match symbol_refs. (*mve_vec_duplicate): Delete (pattern is redundant). gcc/testsuite/ChangeLog: PR target/99647 * gcc.c-torture/compile/pr99647.c: New test. --- gcc/testsuite/gcc.c-torture/compile/pr99647.c | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr99647.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.c-torture/compile/pr99647.c b/gcc/testsuite/gcc.c-torture/compile/pr99647.c new file mode 100644 index 0000000..701155d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr99647.c @@ -0,0 +1,5 @@ +/* { dg-do assemble } */ +typedef int __attribute((vector_size(16))) V; +V f(void) { + return (V){ (int)f, (int)f, (int)f, (int)f }; +} -- cgit v1.1 From 2cd5333d16419f596d07a830bb3f1c40fa8a7b5c Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Wed, 7 Apr 2021 16:44:24 -0400 Subject: c++: Fix ICE with unexpanded parameter pack [PR99844] In explicit17.C, we weren't detecting an unexpanded parameter pack in explicit(bool), so we crashed on a TEMPLATE_PARM_INDEX in constexpr. I noticed the same is true for noexcept(), but only since my patch to implement delayed parsing of noexcept. Previously, we would detect the unexpanded pack in push_template_decl but now the noexcept expression has not yet been parsed, so we need to do it a bit later. gcc/cp/ChangeLog: PR c++/99844 * decl.c (build_explicit_specifier): Call check_for_bare_parameter_packs. * except.c (build_noexcept_spec): Likewise. gcc/testsuite/ChangeLog: PR c++/99844 * g++.dg/cpp2a/explicit16.C: Use c++20. * g++.dg/cpp0x/noexcept66.C: New test. * g++.dg/cpp2a/explicit17.C: New test. --- gcc/testsuite/g++.dg/cpp0x/noexcept66.C | 13 +++++++++++++ gcc/testsuite/g++.dg/cpp2a/explicit16.C | 2 +- gcc/testsuite/g++.dg/cpp2a/explicit17.C | 9 +++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/noexcept66.C create mode 100644 gcc/testsuite/g++.dg/cpp2a/explicit17.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept66.C b/gcc/testsuite/g++.dg/cpp0x/noexcept66.C new file mode 100644 index 0000000..6c76d91 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/noexcept66.C @@ -0,0 +1,13 @@ +// PR c++/99844 +// { dg-do compile { target c++11 } } + +template +struct S { + void fn() noexcept(B); // { dg-error "parameter packs not expanded" } +}; + +void fn () +{ + S s; + s.fn(); +} diff --git a/gcc/testsuite/g++.dg/cpp2a/explicit16.C b/gcc/testsuite/g++.dg/cpp2a/explicit16.C index 9d95b0d..9c20f63 100644 --- a/gcc/testsuite/g++.dg/cpp2a/explicit16.C +++ b/gcc/testsuite/g++.dg/cpp2a/explicit16.C @@ -1,5 +1,5 @@ // PR c++/95066 - explicit malfunction with dependent expression. -// { dg-do compile { target c++2a } } +// { dg-do compile { target c++20 } } template struct Foo { diff --git a/gcc/testsuite/g++.dg/cpp2a/explicit17.C b/gcc/testsuite/g++.dg/cpp2a/explicit17.C new file mode 100644 index 0000000..38a61f4 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/explicit17.C @@ -0,0 +1,9 @@ +// PR c++/99844 +// { dg-do compile { target c++20 } } + +template +struct S { + constexpr explicit(B) S() {} // { dg-error "parameter packs not expanded" } +}; + +constexpr S s; -- cgit v1.1 From ac24fa46e449fbff0ff571951cfcc78b8488f6e7 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 8 Apr 2021 01:03:28 -0400 Subject: c++: improve specialization mismatch diagnostic [PR94529] We were telling users they needed more template<> to specialize a member template in a testcase with no member templates. Only produce that message if we actually see a member template, and also always print the candidates. gcc/cp/ChangeLog: PR c++/94529 * pt.c (determine_specialization): Improve diagnostic. gcc/testsuite/ChangeLog: PR c++/94529 * g++.dg/template/mem-spec2.C: New test. --- gcc/testsuite/g++.dg/template/mem-spec2.C | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 gcc/testsuite/g++.dg/template/mem-spec2.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/template/mem-spec2.C b/gcc/testsuite/g++.dg/template/mem-spec2.C new file mode 100644 index 0000000..bc96159 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/mem-spec2.C @@ -0,0 +1,11 @@ +// PR c++/94529 + +template +struct foo { + // the issue is const here + void bar(T& foobar) const { foobar = 0; } // { dg-message "candidate" } +}; + +template <> void +foo::bar(int& foobar) { foobar = 9; } // { dg-error "does not match" } +// { dg-bogus "member function template" "" { target *-*-* } .-1 } -- cgit v1.1 From 8e84a142913a1f3084d415462024964f97356bee Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Tue, 14 Apr 2020 09:29:10 +0200 Subject: d: Update language attribute support, and implement gcc.attributes D attribute support has been updated to have a baseline parity with the LLVM D compiler's own `ldc.attributes'. The handler that extracts GCC attributes from a list of UDAs has been improved to take care of some mistakes that could have been warnings. UDAs attached to field variables are also now processed for any GCC attributes attached to them. The following new attributes have been added to the D front-end: - @attribute("alloc_size") - @attribute("used") - @attribute("optimize") - @attribute("restrict") - @attribute("cold") - @attribute("noplt") - @attribute("target_clones") - @attribute("no_icf") - @attribute("noipa") - @attribute("symver") With convenience aliases in a new `gcc.attributes' module to match the same naming convention as `ldc.attributes': - @allocSize() - @assumeUsed - @fastmath - @naked - @restrict - @cold - @noplt - @optStrategy() - @polly - @section() - @target() - @weak The old gcc.attribute module has been deprecated, along with the removal of the following attribute handlers: - @attribute("alias"): Has been superseded by `pragma(mangle)'. - @attribute("forceinline"): Renamed to always_inline. gcc/d/ChangeLog: * d-attribs.cc: Include fold-const.h and opts.h. (attr_noreturn_exclusions): Add alloc_size. (attr_const_pure_exclusions): Likewise. (attr_inline_exclusions): Add target_clones. (attr_noinline_exclusions): Rename forceinline to always_inline. (attr_target_exclusions): New array. (attr_target_clones_exclusions): New array. (attr_alloc_exclusions): New array. (attr_cold_hot_exclusions): New array. (d_langhook_common_attribute_table): Add new D attribute handlers. (build_attributes): Update to look for gcc.attributes. Issue warning if not given a struct literal. Handle void initialized arguments. (handle_always_inline_attribute): Remove function. (d_handle_noinline_attribute): Don't extract TYPE_LANG_FRONTEND. (d_handle_forceinline_attribute): Rename to... (d_handle_always_inline_attribute): ...this. Remove special handling. (d_handle_flatten_attribute): Don't extract TYPE_LANG_FRONTEND. (d_handle_target_attribute): Likewise. Warn about empty arguments. (d_handle_target_clones_attribute): New function. (optimize_args): New static variable. (parse_optimize_options): New function. (d_handle_optimize_attribute): New function. (d_handle_noclone_attribute): Don't extract TYPE_LANG_FRONTEND. (d_handle_alias_attribute): Remove function. (d_handle_noicf_attribute): New function. (d_handle_noipa_attribute): New function. (d_handle_section_attribute): Call the handle_generic_attribute target hook after performing target independent processing. (d_handle_symver_attribute): New function. (d_handle_noplt_attribute): New function. (positional_argument): New function. (d_handle_alloc_size_attribute): New function. (d_handle_cold_attribute): New function. (d_handle_restrict_attribute): New function. (d_handle_used_attribute): New function. * decl.cc (gcc_attribute_p): Update to look for gcc.attributes. (get_symbol_decl): Update decl source location of old prototypes to the new declaration being merged. * types.cc (layout_aggregate_members): Apply user defined attributes on fields. libphobos/ChangeLog: * libdruntime/Makefile.am (DRUNTIME_DSOURCES): Add gcc/attributes.d. * libdruntime/Makefile.in: Regenerate. * libdruntime/gcc/attribute.d: Deprecate module, publicly import gcc.attributes. * libdruntime/gcc/deh.d: Update imports. * libdruntime/gcc/attributes.d: New file. gcc/testsuite/ChangeLog: * gdc.dg/gdc108.d: Update test. * gdc.dg/gdc142.d: Likewise. * gdc.dg/pr90136a.d: Likewise. * gdc.dg/pr90136b.d: Likewise. * gdc.dg/pr90136c.d: Likewise. * gdc.dg/pr95173.d: Likewise. * gdc.dg/attr_allocsize1.d: New test. * gdc.dg/attr_allocsize2.d: New test. * gdc.dg/attr_alwaysinline1.d: New test. * gdc.dg/attr_cold1.d: New test. * gdc.dg/attr_exclusions1.d: New test. * gdc.dg/attr_exclusions2.d: New test. * gdc.dg/attr_flatten1.d: New test. * gdc.dg/attr_module.d: New test. * gdc.dg/attr_noclone1.d: New test. * gdc.dg/attr_noicf1.d: New test. * gdc.dg/attr_noinline1.d: New test. * gdc.dg/attr_noipa1.d: New test. * gdc.dg/attr_noplt1.d: New test. * gdc.dg/attr_optimize1.d: New test. * gdc.dg/attr_optimize2.d: New test. * gdc.dg/attr_optimize3.d: New test. * gdc.dg/attr_optimize4.d: New test. * gdc.dg/attr_restrict1.d: New test. * gdc.dg/attr_section1.d: New test. * gdc.dg/attr_symver1.d: New test. * gdc.dg/attr_target1.d: New test. * gdc.dg/attr_targetclones1.d: New test. * gdc.dg/attr_used1.d: New test. * gdc.dg/attr_used2.d: New test. * gdc.dg/attr_weak1.d: New test. * gdc.dg/imports/attributes.d: New test. --- gcc/testsuite/gdc.dg/attr_allocsize1.d | 44 ++++++++++++++++++++++++++++ gcc/testsuite/gdc.dg/attr_allocsize2.d | 13 +++++++++ gcc/testsuite/gdc.dg/attr_alwaysinline1.d | 17 +++++++++++ gcc/testsuite/gdc.dg/attr_cold1.d | 13 +++++++++ gcc/testsuite/gdc.dg/attr_exclusions1.d | 19 ++++++++++++ gcc/testsuite/gdc.dg/attr_exclusions2.d | 19 ++++++++++++ gcc/testsuite/gdc.dg/attr_flatten1.d | 21 ++++++++++++++ gcc/testsuite/gdc.dg/attr_module.d | 40 ++++++++++++++++++++++++++ gcc/testsuite/gdc.dg/attr_noclone1.d | 12 ++++++++ gcc/testsuite/gdc.dg/attr_noicf1.d | 30 +++++++++++++++++++ gcc/testsuite/gdc.dg/attr_noinline1.d | 19 ++++++++++++ gcc/testsuite/gdc.dg/attr_noipa1.d | 17 +++++++++++ gcc/testsuite/gdc.dg/attr_noplt1.d | 13 +++++++++ gcc/testsuite/gdc.dg/attr_optimize1.d | 48 +++++++++++++++++++++++++++++++ gcc/testsuite/gdc.dg/attr_optimize2.d | 9 ++++++ gcc/testsuite/gdc.dg/attr_optimize3.d | 19 ++++++++++++ gcc/testsuite/gdc.dg/attr_optimize4.d | 45 +++++++++++++++++++++++++++++ gcc/testsuite/gdc.dg/attr_restrict1.d | 18 ++++++++++++ gcc/testsuite/gdc.dg/attr_section1.d | 23 +++++++++++++++ gcc/testsuite/gdc.dg/attr_symver1.d | 24 ++++++++++++++++ gcc/testsuite/gdc.dg/attr_target1.d | 20 +++++++++++++ gcc/testsuite/gdc.dg/attr_targetclones1.d | 12 ++++++++ gcc/testsuite/gdc.dg/attr_used1.d | 16 +++++++++++ gcc/testsuite/gdc.dg/attr_used2.d | 16 +++++++++++ gcc/testsuite/gdc.dg/attr_weak1.d | 14 +++++++++ gcc/testsuite/gdc.dg/gdc108.d | 4 +-- gcc/testsuite/gdc.dg/gdc142.d | 2 +- gcc/testsuite/gdc.dg/imports/attributes.d | 28 ++++++++++++++++++ gcc/testsuite/gdc.dg/pr90136a.d | 4 +-- gcc/testsuite/gdc.dg/pr90136b.d | 2 +- gcc/testsuite/gdc.dg/pr90136c.d | 6 ++-- gcc/testsuite/gdc.dg/pr95173.d | 2 +- 32 files changed, 579 insertions(+), 10 deletions(-) create mode 100644 gcc/testsuite/gdc.dg/attr_allocsize1.d create mode 100644 gcc/testsuite/gdc.dg/attr_allocsize2.d create mode 100644 gcc/testsuite/gdc.dg/attr_alwaysinline1.d create mode 100644 gcc/testsuite/gdc.dg/attr_cold1.d create mode 100644 gcc/testsuite/gdc.dg/attr_exclusions1.d create mode 100644 gcc/testsuite/gdc.dg/attr_exclusions2.d create mode 100644 gcc/testsuite/gdc.dg/attr_flatten1.d create mode 100644 gcc/testsuite/gdc.dg/attr_module.d create mode 100644 gcc/testsuite/gdc.dg/attr_noclone1.d create mode 100644 gcc/testsuite/gdc.dg/attr_noicf1.d create mode 100644 gcc/testsuite/gdc.dg/attr_noinline1.d create mode 100644 gcc/testsuite/gdc.dg/attr_noipa1.d create mode 100644 gcc/testsuite/gdc.dg/attr_noplt1.d create mode 100644 gcc/testsuite/gdc.dg/attr_optimize1.d create mode 100644 gcc/testsuite/gdc.dg/attr_optimize2.d create mode 100644 gcc/testsuite/gdc.dg/attr_optimize3.d create mode 100644 gcc/testsuite/gdc.dg/attr_optimize4.d create mode 100644 gcc/testsuite/gdc.dg/attr_restrict1.d create mode 100644 gcc/testsuite/gdc.dg/attr_section1.d create mode 100644 gcc/testsuite/gdc.dg/attr_symver1.d create mode 100644 gcc/testsuite/gdc.dg/attr_target1.d create mode 100644 gcc/testsuite/gdc.dg/attr_targetclones1.d create mode 100644 gcc/testsuite/gdc.dg/attr_used1.d create mode 100644 gcc/testsuite/gdc.dg/attr_used2.d create mode 100644 gcc/testsuite/gdc.dg/attr_weak1.d create mode 100644 gcc/testsuite/gdc.dg/imports/attributes.d (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gdc.dg/attr_allocsize1.d b/gcc/testsuite/gdc.dg/attr_allocsize1.d new file mode 100644 index 0000000..9efba19 --- /dev/null +++ b/gcc/testsuite/gdc.dg/attr_allocsize1.d @@ -0,0 +1,44 @@ +// { dg-do compile } + +import gcc.attributes; + +@alloc_size(1) +int ignoredfunc(int size); // { dg-warning ".alloc_size. attribute ignored on a function returning .int." } + +@alloc_size(0) int var; // { dg-warning ".alloc_size. attribute only applies to function types" } + +@attribute("alloc_size", "1") +void* invalid1(int size); // { dg-warning ".alloc_size. attribute argument is invalid" } + +@attribute("alloc_size", 1, "2") +void* invalid2(int count, int size); // { dg-warning ".alloc_size. attribute argument 2 is invalid" } + +@attribute("alloc_size", 0.1) +void* wrongtype1(int size); // { dg-warning ".alloc_size. attribute argument has type .double." } + +@attribute("alloc_size", 1, 0.2) +void* wrongtype2(int count, int size); // { dg-warning ".alloc_size. attribute argument 2 has type .double." } + +@alloc_size(0) +void* malloc0(int size); // { dg-warning ".alloc_size. attribute argument value .0. does not refer to a function parameter" } + +@alloc_size(1, 0) +void* malloc0(int count, int size); // { dg-warning ".alloc_size. attribute argument 2 value .0. does not refer to a function parameter" } + +@alloc_size(1, 0, true) +void* malloc0pos(int count, int size); + +@alloc_size(1, -1, true) +void* mallocminus1(int count, int size); // { dg-warning ".alloc_size. attribute argument 2 value .-1. does not refer to a function parameter" } + +@alloc_size(99) +void* malloc99(int size); // { dg-warning ".alloc_size. attribute argument value .99. exceeds the number of function parameters 1" } + +@alloc_size(1, 99) +void* malloc99(int count, int size); // { dg-warning ".alloc_size. attribute argument 2 value .99. exceeds the number of function parameters 2" } + +@alloc_size(1) +void* mallocdouble(double size); // { dg-warning ".alloc_size. attribute argument value .1. refers to parameter type .double." } + +@alloc_size(2, 1) +void* mallocdouble(int count, double size); // { dg-warning ".alloc_size. attribute argument 1 value .2. refers to parameter type .double." } diff --git a/gcc/testsuite/gdc.dg/attr_allocsize2.d b/gcc/testsuite/gdc.dg/attr_allocsize2.d new file mode 100644 index 0000000..a10dbbe --- /dev/null +++ b/gcc/testsuite/gdc.dg/attr_allocsize2.d @@ -0,0 +1,13 @@ +// { dg-do compile } + +import gcc.attributes; + +void* my_calloc(size_t num, size_t size) @allocSize(1, 0) +{ + return null; +} + +void* my_malloc(int a, int b, size_t size, int c) @allocSize(2) +{ + return null; +} diff --git a/gcc/testsuite/gdc.dg/attr_alwaysinline1.d b/gcc/testsuite/gdc.dg/attr_alwaysinline1.d new file mode 100644 index 0000000..8fbe25c --- /dev/null +++ b/gcc/testsuite/gdc.dg/attr_alwaysinline1.d @@ -0,0 +1,17 @@ +// { dg-do compile } +// { dg-options "-O0" } + +import gcc.attributes; + +int func() +{ + int nested_function() @always_inline + { + return 13; + } + return nested_function(); +} + +@always_inline int var = 0; // { dg-warning ".always_inline. attribute ignored" } + +// { dg-final { scan-assembler-not "nested_function" } } diff --git a/gcc/testsuite/gdc.dg/attr_cold1.d b/gcc/testsuite/gdc.dg/attr_cold1.d new file mode 100644 index 0000000..bf44d7b --- /dev/null +++ b/gcc/testsuite/gdc.dg/attr_cold1.d @@ -0,0 +1,13 @@ +// { dg-do compile } +// { dg-options "-O2 -fdump-tree-optimized" } + +import gcc.attributes; + +int func() @cold +{ + return 0; +} + +@cold int var = 0; // { dg-warning ".cold. attribute ignored" } + +// { dg-final { scan-tree-dump "func\[^\r\n\]*(unlikely executed)" "optimized" } } diff --git a/gcc/testsuite/gdc.dg/attr_exclusions1.d b/gcc/testsuite/gdc.dg/attr_exclusions1.d new file mode 100644 index 0000000..90d4e5d --- /dev/null +++ b/gcc/testsuite/gdc.dg/attr_exclusions1.d @@ -0,0 +1,19 @@ +// { dg-do compile } + +import gcc.attributes; + +// always_inline + +@noinline +@always_inline +void i0(); // { dg-warning "ignoring attribute .always_inline. because it conflicts with attribute .noinline." } + +@target_clones("") +@always_inline +void i1(); // { dg-warning "ignoring attribute .always_inline. because it conflicts with attribute .target_clones." } + +// noinline + +@always_inline +@noinline +void n0(); // { dg-warning "ignoring attribute .noinline. because it conflicts with attribute .always_inline." } diff --git a/gcc/testsuite/gdc.dg/attr_exclusions2.d b/gcc/testsuite/gdc.dg/attr_exclusions2.d new file mode 100644 index 0000000..791e9af --- /dev/null +++ b/gcc/testsuite/gdc.dg/attr_exclusions2.d @@ -0,0 +1,19 @@ +// { dg-do compile { target x86_64-*-* } } + +import gcc.attributes; + +// target + +@target_clones("default") +@target("default") +void tc0(); // { dg-warning "ignoring attribute .target. because it conflicts with attribute .target_clones." } + +// target_clones + +@target("default") +@target_clones("default") +void t0(); // { dg-warning "ignoring attribute .target_clones. because it conflicts with attribute .target." } + +@always_inline +@target_clones("default") +void tc1(); // { dg-warning "ignoring attribute .target_clones. because it conflicts with attribute .always_inline." } diff --git a/gcc/testsuite/gdc.dg/attr_flatten1.d b/gcc/testsuite/gdc.dg/attr_flatten1.d new file mode 100644 index 0000000..47bcc38 --- /dev/null +++ b/gcc/testsuite/gdc.dg/attr_flatten1.d @@ -0,0 +1,21 @@ +// { dg-do compile } +// { dg-options "-O1" } + +import gcc.attributes; + +int func() @flatten +{ + __gshared int count = 0; + int nested_function() + { + return count++; + } + static foreach (_; 0 .. 1000) + nested_function(); + + return nested_function(); +} + +@flatten int var = 0; // { dg-warning ".flatten. attribute ignored" } + +// { dg-final { scan-assembler-not "nested_function" } } diff --git a/gcc/testsuite/gdc.dg/attr_module.d b/gcc/testsuite/gdc.dg/attr_module.d new file mode 100644 index 0000000..e7a9341 --- /dev/null +++ b/gcc/testsuite/gdc.dg/attr_module.d @@ -0,0 +1,40 @@ +// { dg-do compile } +// { dg-additional-sources "imports/attributes.d" } + +import gcc.attributes; + +@value_ignored +int f0() +{ + return 0; +} + +@type_symbol // { dg-warning ".type_symbol. attribute has no effect" } +int f1() +{ + return 1; +} + +@template_symbol // { dg-warning ".template_symbol. attribute has no effect" } +int f2() +{ + return 2; +} + +@struct_wrong_field(123) // { dg-warning "unknown attribute .123." } +int f3() +{ + return 3; +} + +@struct_void_init() +int f4() +{ + return 4; +} + +@unknown_attribute() // { dg-warning "unknown attribute .made up name." } +int f5() +{ + return 5; +} diff --git a/gcc/testsuite/gdc.dg/attr_noclone1.d b/gcc/testsuite/gdc.dg/attr_noclone1.d new file mode 100644 index 0000000..0289135 --- /dev/null +++ b/gcc/testsuite/gdc.dg/attr_noclone1.d @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +import gcc.attributes; + +@target_clones("avx", "default") +@noclone +void func() // { dg-error "clones for .target_clones. attribute cannot be created" } +{ // { dg-message "function .func. can never be copied because it has .noclone. attribute" "" { target *-*-* } .-1 } +} + +@noclone int var = 0; // { dg-warning ".noclone. attribute ignored" } diff --git a/gcc/testsuite/gdc.dg/attr_noicf1.d b/gcc/testsuite/gdc.dg/attr_noicf1.d new file mode 100644 index 0000000..71a9aa1 --- /dev/null +++ b/gcc/testsuite/gdc.dg/attr_noicf1.d @@ -0,0 +1,30 @@ +// { dg-do compile } +// { dg-options "-O2 -fno-inline" } + +import gcc.attributes; + +extern int t(); + +int func() +{ + __gshared int var = 42; + int nested_1() @no_icf + { + return var++; + } + int nested_2() + { + return var++; + } + int nested_3() + { + return var++; + } + return nested_1() + nested_2() + nested_3(); +} + +@no_icf int var = 0; // { dg-warning ".no_icf. attribute ignored" } + +// { dg-final { scan-assembler "nested_1" } } +// { dg-final { scan-assembler "nested_2" } } +// { dg-final { scan-assembler-not "nested_3" } } diff --git a/gcc/testsuite/gdc.dg/attr_noinline1.d b/gcc/testsuite/gdc.dg/attr_noinline1.d new file mode 100644 index 0000000..51fffe5 --- /dev/null +++ b/gcc/testsuite/gdc.dg/attr_noinline1.d @@ -0,0 +1,19 @@ +// { dg-do compile } +// { dg-options "-O2 -finline-functions -fno-ipa-icf" } + +import gcc.attributes; + +extern int t(); + +void func() +{ + void nested_function() @noinline + { + t(); + } + nested_function(); +} + +@noinline int var = 0; // { dg-warning ".noinline. attribute ignored" } + +// { dg-final { scan-assembler "nested_function" } } diff --git a/gcc/testsuite/gdc.dg/attr_noipa1.d b/gcc/testsuite/gdc.dg/attr_noipa1.d new file mode 100644 index 0000000..a1f58dc --- /dev/null +++ b/gcc/testsuite/gdc.dg/attr_noipa1.d @@ -0,0 +1,17 @@ +// { dg-do compile } +// { dg-options "-O2 -finline-functions" } + +import gcc.attributes; + +int func(int x) +{ + int nested_function(int y, int z) @noipa + { + return y + z; + } + return nested_function(x, 0); +} + +@noipa int var = 0; // { dg-warning ".noipa. attribute ignored" } + +// { dg-final { scan-assembler "nested_function" } } diff --git a/gcc/testsuite/gdc.dg/attr_noplt1.d b/gcc/testsuite/gdc.dg/attr_noplt1.d new file mode 100644 index 0000000..73a2fb5 --- /dev/null +++ b/gcc/testsuite/gdc.dg/attr_noplt1.d @@ -0,0 +1,13 @@ +// { dg-do compile { target x86_64-*-linux* } } +// { dg-options "-O2 -fno-pic" } + +import gcc.attributes; + +@noplt int func(); + +@noplt int var = 0; // { dg-warning ".noplt. attribute ignored" } + +int main() +{ + return func(); +} diff --git a/gcc/testsuite/gdc.dg/attr_optimize1.d b/gcc/testsuite/gdc.dg/attr_optimize1.d new file mode 100644 index 0000000..043202a --- /dev/null +++ b/gcc/testsuite/gdc.dg/attr_optimize1.d @@ -0,0 +1,48 @@ +// { dg-do compile } + +import gcc.attributes; + +int func() +{ + int return_zero() @optimize(0) + { + return 0; + } + + int return_one() @optimize("0") + { + return 1; + } + + int return_two() @optimize("s") + { + return 2; + } + + int return_three() @optimize("O3") + { + return 3; + } + + int return_four() @optimize("fast-math") + { + return 4; + } + + return return_one + return_two + return_three + return_four; +} + +@optimize(3) +int var = 0; // { dg-warning ".optimize. attribute ignored" } + +@optimize("-f_") +int bad_option() // { dg-warning "bad option .-f_. to attribute .optimize." } +{ + return 0; +} + +@optimize("-z") +int bad_option2() // { dg-warning "bad option .-z. to attribute .optimize." } +{ + return 0; +} diff --git a/gcc/testsuite/gdc.dg/attr_optimize2.d b/gcc/testsuite/gdc.dg/attr_optimize2.d new file mode 100644 index 0000000..13bc1d7 --- /dev/null +++ b/gcc/testsuite/gdc.dg/attr_optimize2.d @@ -0,0 +1,9 @@ +// { dg-do compile } + +import gcc.attributes; + +@optimize(-1) +int non_negative() // { dg-error "argument to .-O. should be a non-negative integer" } +{ + return 0; +} diff --git a/gcc/testsuite/gdc.dg/attr_optimize3.d b/gcc/testsuite/gdc.dg/attr_optimize3.d new file mode 100644 index 0000000..2a9ad12 --- /dev/null +++ b/gcc/testsuite/gdc.dg/attr_optimize3.d @@ -0,0 +1,19 @@ +// { dg-do compile } +// { dg-options "-O0 -fdump-tree-optimized-raw" } + +import gcc.attributes; + +double notfast(double x) +{ + return x * x * x * x * x * x * x * x; +} + +// { dg-final { scan-tree-dump-times "mult_expr, _" 7 "optimized" } } + +@fastmath +static double fast(double x) +{ + return x * x * x * x * x * x * x * x; +} + +// { dg-final { scan-tree-dump-times "mult_expr, powmult_" 3 "optimized" } } diff --git a/gcc/testsuite/gdc.dg/attr_optimize4.d b/gcc/testsuite/gdc.dg/attr_optimize4.d new file mode 100644 index 0000000..54d793e --- /dev/null +++ b/gcc/testsuite/gdc.dg/attr_optimize4.d @@ -0,0 +1,45 @@ +// { dg-do compile } +// { dg-options "-O3 -fdump-tree-optimized-raw" } + +import gcc.attributes; + +int glob1; +int easily_inlinable(int i) { glob1 = i; return 2; } + +@optStrategy("none") +int call_easily_inlinable(int i) +{ + return easily_inlinable(i); +} + +// { dg-final { scan-tree-dump "gimple_call Date: Thu, 8 Apr 2021 09:46:03 -0400 Subject: analyzer: fix leak false +ves due to maybe-clobbered regions [PR99042,PR99774] Prior to this patch, program_state::detect_leaks worked by finding all live svalues in the old state and in the new state, and calling on_svalue_leak for each svalue that has changed from being live to not being live. PR analyzer/99042 and PR analyzer/99774 both describe false leak diagnostics from -fanalyzer (a false FILE * leak in git, and a false malloc leak in qemu, respectively). In both cases the root cause of the false leak diagnostic relates to svalues no longer being explicitly bound in the store due to regions being conservatively clobbered, due to an unknown function being called, or due to a write through a pointer that could alias the region, respectively. We have a transition from an svalue being explicitly live to not being explicitly live - but only because the store is being conservative, clobbering the binding. The leak detection is looking for transitions from "definitely live" to "not definitely live", when it should be looking for transitions from "definitely live" to "definitely not live". This patch introduces a new class to temporarily capture information about svalues that were explicitly live, but for which a region bound to them got clobbered for conservative reasons. This new "uncertainty_t" class is passed around to capture the data long enough for use in program_state::detect_leaks, where it is used to only complain about svalues that were definitely live and are now both not definitely live *or* possibly-live i.e. definitely not-live. The class also captures for which svalues we can't meaningfully track sm-state anymore, and resets the svalues back to the "start" state. Together, these changes fix the false leak reports. gcc/analyzer/ChangeLog: PR analyzer/99042 PR analyzer/99774 * engine.cc (impl_region_model_context::impl_region_model_context): Add uncertainty param and use it to initialize m_uncertainty. (impl_region_model_context::get_uncertainty): New. (impl_sm_context::get_fndecl_for_call): Add NULL for new uncertainty param when constructing impl_region_model_context. (impl_sm_context::get_state): Likewise. (impl_sm_context::set_next_state): Likewise. (impl_sm_context::warn): Likewise. (exploded_node::on_stmt): Add uncertainty param and use it when constructing impl_region_model_context. (exploded_node::on_edge): Add uncertainty param and pass to on_edge call. (exploded_node::detect_leaks): Create uncertainty_t and pass to impl_region_model_context. (exploded_graph::get_or_create_node): Create uncertainty_t and pass to prune_for_point. (maybe_process_run_of_before_supernode_enodes): Create uncertainty_t and pass to impl_region_model_context. (exploded_graph::process_node): Create uncertainty_t instances and pass around as needed. * exploded-graph.h (impl_region_model_context::impl_region_model_context): Add uncertainty param. (impl_region_model_context::get_uncertainty): New decl. (impl_region_model_context::m_uncertainty): New field. (exploded_node::on_stmt): Add uncertainty param. (exploded_node::on_edge): Likewise. * program-state.cc (sm_state_map::on_liveness_change): Get uncertainty from context and use it to unset sm-state from svalues as appropriate. (program_state::on_edge): Add uncertainty param and use it when constructing impl_region_model_context. Fix indentation. (program_state::prune_for_point): Add uncertainty param and use it when constructing impl_region_model_context. (program_state::detect_leaks): Get any uncertainty from ctxt and use it to get maybe-live svalues for dest_state, rather than definitely-live ones; use this when determining which svalues have leaked. (selftest::test_program_state_merging): Create uncertainty_t and pass to impl_region_model_context. * program-state.h (program_state::on_edge): Add uncertainty param. (program_state::prune_for_point): Likewise. * region-model-impl-calls.cc (call_details::get_uncertainty): New. (region_model::impl_call_memcpy): Pass uncertainty to mark_region_as_unknown call. (region_model::impl_call_memset): Likewise. (region_model::impl_call_strcpy): Likewise. * region-model-reachability.cc (reachable_regions::handle_sval): Also add sval to m_mutable_svals. * region-model.cc (region_model::on_assignment): Pass any uncertainty from ctxt to the store::set_value call. (region_model::handle_unrecognized_call): Get any uncertainty from ctxt and use it to record mutable svalues at the unknown call. (region_model::get_reachable_svalues): Add uncertainty param and use it to mark any maybe-bound svalues as being reachable. (region_model::set_value): Pass any uncertainty from ctxt to the store::set_value call. (region_model::mark_region_as_unknown): Add uncertainty param and pass it on to the store::mark_region_as_unknown call. (region_model::update_for_call_summary): Add uncertainty param and pass it on to the region_model::mark_region_as_unknown call. * region-model.h (call_details::get_uncertainty): New decl. (region_model::get_reachable_svalues): Add uncertainty param. (region_model::mark_region_as_unknown): Add uncertainty param. (region_model_context::get_uncertainty): New vfunc. (noop_region_model_context::get_uncertainty): New vfunc implementation. * store.cc (dump_svalue_set): New. (uncertainty_t::dump_to_pp): New. (uncertainty_t::dump): New. (binding_cluster::clobber_region): Pass NULL for uncertainty to remove_overlapping_bindings. (binding_cluster::mark_region_as_unknown): Add uncertainty param and pass it to remove_overlapping_bindings. (binding_cluster::remove_overlapping_bindings): Add uncertainty param. Use it to record any svalues that were in clobbered bindings. (store::set_value): Add uncertainty param. Pass it to binding_cluster::mark_region_as_unknown when handling symbolic regions. (store::mark_region_as_unknown): Add uncertainty param and pass it to binding_cluster::mark_region_as_unknown. (store::remove_overlapping_bindings): Add uncertainty param and pass it to binding_cluster::remove_overlapping_bindings. * store.h (binding_cluster::mark_region_as_unknown): Add uncertainty param. (binding_cluster::remove_overlapping_bindings): Likewise. (store::set_value): Likewise. (store::mark_region_as_unknown): Likewise. gcc/testsuite/ChangeLog: PR analyzer/99042 PR analyzer/99774 * gcc.dg/analyzer/pr99042.c: New test. * gcc.dg/analyzer/pr99774-1.c: New test. * gcc.dg/analyzer/pr99774-2.c: New test. --- gcc/testsuite/gcc.dg/analyzer/pr99042.c | 53 +++++++++++ gcc/testsuite/gcc.dg/analyzer/pr99774-1.c | 61 +++++++++++++ gcc/testsuite/gcc.dg/analyzer/pr99774-2.c | 144 ++++++++++++++++++++++++++++++ 3 files changed, 258 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/analyzer/pr99042.c create mode 100644 gcc/testsuite/gcc.dg/analyzer/pr99774-1.c create mode 100644 gcc/testsuite/gcc.dg/analyzer/pr99774-2.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/analyzer/pr99042.c b/gcc/testsuite/gcc.dg/analyzer/pr99042.c new file mode 100644 index 0000000..c3d124f --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/pr99042.c @@ -0,0 +1,53 @@ +#include + +struct foo { + FILE *file; +}; + +extern void unknown_fn (); +extern void unknown_fn2 (const struct foo *f); + +int test_1 (struct foo *p) +{ + if ((p->file = fopen("test.txt", "w")) == NULL) + return 1; + unknown_fn (); + return 0; /* { dg-bogus "leak" } */ +} + +int test_2 (struct foo *p) +{ + if ((p->file = fopen("test.txt", "w")) == NULL) + return 1; + return 0; /* { dg-bogus "leak" } */ +} + +int test_3 (void) +{ + struct foo f; + struct foo *p = &f; + if ((p->file = fopen("test.txt", "w")) == NULL) + return 1; + unknown_fn (); + return 0; /* { dg-warning "leak" } */ +} + +int test_4 (void) +{ + struct foo f; + struct foo *p = &f; + if ((p->file = fopen("test.txt", "w")) == NULL) + return 1; + return 0; /* { dg-warning "leak" } */ +} + +int test_5 (void) +{ + struct foo f; + struct foo *p = &f; + if ((p->file = fopen("test.txt", "w")) == NULL) + return 1; + /* Although p is const, the underlying FILE * is not and could be closed. */ + unknown_fn2 (p); + return 0; /* { dg-bogus "leak" } */ +} diff --git a/gcc/testsuite/gcc.dg/analyzer/pr99774-1.c b/gcc/testsuite/gcc.dg/analyzer/pr99774-1.c new file mode 100644 index 0000000..620cf65 --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/pr99774-1.c @@ -0,0 +1,61 @@ +/* Reproducer for report from -Wanalyzer-malloc-leak + Reduced from + https://git.qemu.org/?p=qemu.git;a=blob;f=subprojects/libvhost-user/libvhost-user.c;h=fab7ca17ee1fb27bcfc338527d1aeb9f923aade5;hb=HEAD#l1184 + which is licensed under GNU GPLv2 or later. */ + +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned long uint64_t; +typedef unsigned long uint64_t; +typedef long unsigned int size_t; + +extern void *calloc(size_t __nmemb, size_t __size) + __attribute__((__nothrow__, __leaf__)) + __attribute__((__malloc__)) + __attribute__((__alloc_size__(1, 2))) + __attribute__((__warn_unused_result__)); + +typedef struct VuDescStateSplit { + uint8_t inflight; + uint64_t counter; +} VuDescStateSplit; + +typedef struct VuVirtqInflight { + uint16_t desc_num; + VuDescStateSplit desc[]; +} VuVirtqInflight; + +typedef struct VuVirtqInflightDesc { + uint16_t index; + uint64_t counter; +} VuVirtqInflightDesc; + +typedef struct VuVirtq { + VuVirtqInflight *inflight; + VuVirtqInflightDesc *resubmit_list; + uint16_t resubmit_num; + uint64_t counter; + int inuse; +} VuVirtq; + +int vu_check_queue_inflights(VuVirtq *vq) { + int i = 0; + + if (vq->inuse) { + vq->resubmit_list = calloc(vq->inuse, sizeof(VuVirtqInflightDesc)); + if (!vq->resubmit_list) { + return -1; + } + + for (i = 0; i < vq->inflight->desc_num; i++) { + if (vq->inflight->desc[i].inflight) { + vq->resubmit_list[vq->resubmit_num].index = i; /* { dg-bogus "leak" } */ + vq->resubmit_list[vq->resubmit_num].counter = + vq->inflight->desc[i].counter; + vq->resubmit_num++; + } + } + } + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/analyzer/pr99774-2.c b/gcc/testsuite/gcc.dg/analyzer/pr99774-2.c new file mode 100644 index 0000000..d9704de --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/pr99774-2.c @@ -0,0 +1,144 @@ +#include + +struct st +{ + void *m_f; +}; + +struct node +{ + struct node *m_next; +}; + +extern void unknown_fn (void *); +extern void const_unknown_fn (const void *); + +void +test_1 (struct st *p, struct st *q) +{ + p->m_f = malloc (1024); + q->m_f = NULL; /* { dg-bogus "leak" } */ + free (p->m_f); +} + +void +test_2 (void) +{ + struct st s; + s.m_f = malloc (1024); + unknown_fn (&s); + free (s.m_f); +} + +void +test_3 (void) +{ + struct st s; + s.m_f = malloc (1024); + const_unknown_fn (&s); + free (s.m_f); +} + +void +test_4 (void) +{ + struct st s; + s.m_f = malloc (1024); + unknown_fn (&s); +} /* { dg-bogus "leak" } */ + +void +test_5 (void) +{ + struct st s; + s.m_f = malloc (1024); + /* s is const, but the pointer could still be freed; hence not a leak. */ + const_unknown_fn (&s); +} /* { dg-bogus "leak" } */ + +void +test_6 (void) +{ + struct st s; + s.m_f = malloc (1024); +} /* { dg-warning "leak" } */ + +struct st +test_7 (void) +{ + struct st s; + s.m_f = malloc (1024); + return s; +} /* { dg-bogus "leak" } */ + +struct node * +test_8 (void) +{ + struct node *n1 = malloc (sizeof (struct node)); + if (!n1) + return NULL; + n1->m_next = malloc (sizeof (struct node)); + return n1; +} + +void +test_9 (void) +{ + struct node *n1 = malloc (sizeof (struct node)); + if (!n1) + return; + n1->m_next = malloc (sizeof (struct node)); + /* Could free n1 and n1->m_next. */ + unknown_fn (n1); +} + +void +test_10 (void) +{ + struct node *n1 = malloc (sizeof (struct node)); + if (!n1) + return; + n1->m_next = malloc (sizeof (struct node)); + /* Could free n1->m_next, but not n1. */ + const_unknown_fn (n1); /* { dg-warning "leak of 'n1'" } */ +} + +void +test_11 (void) +{ + struct node *n1 = malloc (sizeof (struct node)); + if (!n1) + return; + n1->m_next = malloc (sizeof (struct node)); + /* Could free n1->m_next, but not n1. */ + unknown_fn (n1->m_next); /* { dg-warning "leak of 'n1'" } */ +} + +void +test_12a (void) +{ + int *ip = malloc (sizeof (int)); + *ip = 42; /* { dg-warning "dereference of possibly-NULL 'ip'" } */ + free (ip); +} + +void +test_12b (void) +{ + int *ip = malloc (sizeof (int)); + unknown_fn (ip); + /* Might not be a null-deref, as unknown_fn could abort on NULL. */ + *ip = 42; + free (ip); +} + +void +test_12c (void) +{ + int *ip = malloc (sizeof (int)); + /* Might not be a null-deref, as const_unknown_fn could abort on NULL. + Right now we don't have a great way of handling this. */ + const_unknown_fn (ip); + *ip = 42; /* { dg-bogus "dereference of possibly-NULL 'ip'" "" { xfail *-*-* } } */ + free (ip); +} -- cgit v1.1 From d3f78917e1310d7d00e4f955c8e5d30a777f7d35 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Thu, 8 Apr 2021 15:00:03 +0100 Subject: testsuite: Fix sve/mul_2.c failures Some sve/mul_2.c tests were failing because we'd (reasonably) decided to use shifts and adds instead of MULs for some simple negative constants. We'd already needed to avoid that when picking positive constants, so this patch does the same thing for the negative ones. gcc/testsuite/ * gcc.target/aarch64/sve/mul_2.c: Adjust negative constants to avoid conversion to shifts and adds. --- gcc/testsuite/gcc.target/aarch64/sve/mul_2.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/aarch64/sve/mul_2.c b/gcc/testsuite/gcc.target/aarch64/sve/mul_2.c index ff049f5..b57e321 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/mul_2.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/mul_2.c @@ -21,14 +21,14 @@ TEST_TYPE (uint8_t, 32, 2, 250) TEST_TYPE (int8_t, 64, -110, 110) TEST_TYPE (uint8_t, 64, 3, 253) -TEST_TYPE (int16_t, 64, -128, 123) +TEST_TYPE (int16_t, 64, -123, 123) TEST_TYPE (uint16_t, 64, 3, 255) -TEST_TYPE (int8_t, 128, -120, 120) +TEST_TYPE (int8_t, 128, -119, 120) TEST_TYPE (uint8_t, 128, 4, 251) -TEST_TYPE (int16_t, 128, -128, 123) +TEST_TYPE (int16_t, 128, -123, 123) TEST_TYPE (uint16_t, 128, 2, 255) -TEST_TYPE (int32_t, 128, -128, 123) +TEST_TYPE (int32_t, 128, -123, 123) TEST_TYPE (uint32_t, 128, 4, 255) /* { dg-final { scan-assembler-times {\tmul\tz[0-9]+\.b, p[0-7]/m, z[0-9]+\.b, z[0-9]+\.b\n} 6 } } */ @@ -37,9 +37,9 @@ TEST_TYPE (uint32_t, 128, 4, 255) /* { dg-final { scan-assembler-times {\tmul\tz[0-9]+\.b, z[0-9]+\.b, #-100\n} 1 } } */ /* { dg-final { scan-assembler-times {\tmul\tz[0-9]+\.b, z[0-9]+\.b, #-110\n} 1 } } */ -/* { dg-final { scan-assembler-times {\tmul\tz[0-9]+\.b, z[0-9]+\.b, #-120\n} 1 } } */ -/* { dg-final { scan-assembler-times {\tmul\tz[0-9]+\.h, z[0-9]+\.h, #-128\n} 2 } } */ -/* { dg-final { scan-assembler-times {\tmul\tz[0-9]+\.s, z[0-9]+\.s, #-128\n} 1 } } */ +/* { dg-final { scan-assembler-times {\tmul\tz[0-9]+\.b, z[0-9]+\.b, #-119\n} 1 } } */ +/* { dg-final { scan-assembler-times {\tmul\tz[0-9]+\.h, z[0-9]+\.h, #-123\n} 2 } } */ +/* { dg-final { scan-assembler-times {\tmul\tz[0-9]+\.s, z[0-9]+\.s, #-123\n} 1 } } */ /* { dg-final { scan-assembler-times {\tmul\tz[0-9]+\.b, z[0-9]+\.b, #50\n} 6 } } */ /* { dg-final { scan-assembler-times {\tmul\tz[0-9]+\.h, z[0-9]+\.h, #50\n} 4 } } */ -- cgit v1.1 From a45fe62102c952072e977db6d42a8524c4dd36c1 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Thu, 8 Apr 2021 15:00:04 +0100 Subject: testsuite: Fix Advanced SIMD failures for SVE This patch just adds some missing +nosve directives to Advanced SIMD vectorisation tests. gcc/testsuite/ * gcc.target/aarch64/asimd-mull-elem.c: Add +nosve. * gcc.target/aarch64/pr98772.c: Likewise. * gcc.target/aarch64/simd/vect_su_add_sub.c: Likewise. --- gcc/testsuite/gcc.target/aarch64/asimd-mull-elem.c | 2 ++ gcc/testsuite/gcc.target/aarch64/pr98772.c | 3 +++ gcc/testsuite/gcc.target/aarch64/simd/vect_su_add_sub.c | 2 ++ 3 files changed, 7 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/aarch64/asimd-mull-elem.c b/gcc/testsuite/gcc.target/aarch64/asimd-mull-elem.c index 513721c..8ee7d11 100644 --- a/gcc/testsuite/gcc.target/aarch64/asimd-mull-elem.c +++ b/gcc/testsuite/gcc.target/aarch64/asimd-mull-elem.c @@ -3,6 +3,8 @@ /* { dg-require-effective-target vect_float } */ /* { dg-options "-Ofast" } */ +#pragma GCC target "+nosve" + #include void s_mult_i (int32_t* restrict res, int32_t* restrict a, int32_t b) diff --git a/gcc/testsuite/gcc.target/aarch64/pr98772.c b/gcc/testsuite/gcc.target/aarch64/pr98772.c index 6632215..8259251 100644 --- a/gcc/testsuite/gcc.target/aarch64/pr98772.c +++ b/gcc/testsuite/gcc.target/aarch64/pr98772.c @@ -1,5 +1,8 @@ /* { dg-do run } */ /* { dg-options "-O3 -save-temps" } */ + +#pragma GCC target "+nosve" + #include #include diff --git a/gcc/testsuite/gcc.target/aarch64/simd/vect_su_add_sub.c b/gcc/testsuite/gcc.target/aarch64/simd/vect_su_add_sub.c index 921c5f1..4abb8e9 100644 --- a/gcc/testsuite/gcc.target/aarch64/simd/vect_su_add_sub.c +++ b/gcc/testsuite/gcc.target/aarch64/simd/vect_su_add_sub.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ /* { dg-options "-O3" } */ +#pragma GCC target "+nosve" + typedef int __attribute__ ((mode (SI))) int32_t; typedef int __attribute__ ((mode (DI))) int64_t; typedef unsigned __attribute__ ((mode (SI))) size_t; -- cgit v1.1 From cc6c157200748ad401afdfd37cbd403b3eaa56ed Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Thu, 8 Apr 2021 15:00:05 +0100 Subject: testsuite: Update error messages in sve/acle/general-c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The “previous definition of 'x'†notes now include the type of the original definition before “was hereâ€. There's not really any need to hard-code that much of the message in the ACLE tests, so this patch just removes the “was here†from the match string. gcc/testsuite/ * gcc.target/aarch64/sve/acle/general-c/func_redef_1.c: Remove "was here" from error message. * gcc.target/aarch64/sve/acle/general-c/func_redef_2.c: Likewise. * gcc.target/aarch64/sve/acle/general-c/func_redef_3.c: Likewise. * gcc.target/aarch64/sve/acle/general-c/func_redef_6.c: Likewise. * gcc.target/aarch64/sve/acle/general-c/type_redef_1.c: Likewise. * gcc.target/aarch64/sve/acle/general-c/type_redef_2.c: Likewise. * gcc.target/aarch64/sve/acle/general-c/type_redef_3.c: Likewise. * gcc.target/aarch64/sve/acle/general-c/type_redef_4.c: Likewise. * gcc.target/aarch64/sve/acle/general-c/type_redef_5.c: Likewise. * gcc.target/aarch64/sve/acle/general-c/type_redef_6.c: Likewise. * gcc.target/aarch64/sve/acle/general-c/type_redef_8.c: Likewise. * gcc.target/aarch64/sve/acle/general-c/type_redef_9.c: Likewise. * gcc.target/aarch64/sve/acle/general-c/type_redef_10.c: Likewise. * gcc.target/aarch64/sve/acle/general-c/type_redef_13.c: Likewise. --- gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/func_redef_1.c | 2 +- gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/func_redef_2.c | 2 +- gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/func_redef_3.c | 2 +- gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/func_redef_6.c | 2 +- gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_1.c | 2 +- gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_10.c | 2 +- gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_13.c | 2 +- gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_2.c | 2 +- gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_3.c | 2 +- gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_4.c | 2 +- gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_5.c | 2 +- gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_6.c | 2 +- gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_8.c | 2 +- gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_9.c | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/func_redef_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/func_redef_1.c index e1b99fa..33ed8f7 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/func_redef_1.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/func_redef_1.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -int svadd_n_u8_x; /* { dg-message "note: previous declaration of 'svadd_n_u8_x' was here" } */ +int svadd_n_u8_x; /* { dg-message "note: previous declaration of 'svadd_n_u8_x'" } */ #pragma GCC aarch64 "arm_sve.h" /* { dg-error {'svadd_n_u8_x' redeclared} } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/func_redef_2.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/func_redef_2.c index 7f653f1..6799668 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/func_redef_2.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/func_redef_2.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -int svadd_n_u8_x = 1; /* { dg-message "note: previous definition of 'svadd_n_u8_x' was here" } */ +int svadd_n_u8_x = 1; /* { dg-message "note: previous definition of 'svadd_n_u8_x'" } */ #pragma GCC aarch64 "arm_sve.h" /* { dg-error {'svadd_n_u8_x' redeclared} } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/func_redef_3.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/func_redef_3.c index d9ff15a..41988b2 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/func_redef_3.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/func_redef_3.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -extern __SVInt8_t svadd_u8_x (__SVBool_t, __SVInt8_t, __SVInt8_t); /* { dg-message "note: previous declaration of 'svadd_u8_x' was here" } */ +extern __SVInt8_t svadd_u8_x (__SVBool_t, __SVInt8_t, __SVInt8_t); /* { dg-message "note: previous declaration of 'svadd_u8_x'" } */ #pragma GCC aarch64 "arm_sve.h" /* { dg-error {conflicting types for 'svadd_u8_x'} } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/func_redef_6.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/func_redef_6.c index 1f04e46..01d1ca7 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/func_redef_6.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/func_redef_6.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -typedef int svadd_u8_x; /* { dg-message "note: previous declaration of 'svadd_u8_x' was here" } */ +typedef int svadd_u8_x; /* { dg-message "note: previous declaration of 'svadd_u8_x'" } */ #pragma GCC aarch64 "arm_sve.h" /* { dg-error {'svadd_u8_x' redeclared} } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_1.c index 70b2d9d..28fba53 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_1.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_1.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -int svbool_t; /* { dg-message "note: previous declaration of 'svbool_t' was here" } */ +int svbool_t; /* { dg-message "note: previous declaration of 'svbool_t'" } */ #pragma GCC aarch64 "arm_sve.h" /* { dg-error {'svbool_t' redeclared} } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_10.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_10.c index 8278c1c..22b7934 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_10.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_10.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -typedef struct svint8x2_t svint8x2_t; /* { dg-message "note: previous declaration of 'svint8x2_t' was here" } */ +typedef struct svint8x2_t svint8x2_t; /* { dg-message "note: previous declaration of 'svint8x2_t'" } */ #pragma GCC aarch64 "arm_sve.h" /* { dg-error {conflicting types for 'svint8x2_t'} } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_13.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_13.c index 62bab1f..61449a0 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_13.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_13.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -#pragma GCC aarch64 "arm_sve.h" /* { dg-message "note: previous declaration of 'svint8x2_t' was here" } */ +#pragma GCC aarch64 "arm_sve.h" /* { dg-message "note: previous declaration of 'svint8x2_t'" } */ int svint8x2_t; /* { dg-error {'svint8x2_t' redeclared} } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_2.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_2.c index ffd86ae..a4afb78 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_2.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_2.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -int svint8_t; /* { dg-message "note: previous declaration of 'svint8_t' was here" } */ +int svint8_t; /* { dg-message "note: previous declaration of 'svint8_t'" } */ #pragma GCC aarch64 "arm_sve.h" /* { dg-error {'svint8_t' redeclared} } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_3.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_3.c index f42dd96..c22c105 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_3.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_3.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -int svuint16_t; /* { dg-message "note: previous declaration of 'svuint16_t' was here" } */ +int svuint16_t; /* { dg-message "note: previous declaration of 'svuint16_t'" } */ #pragma GCC aarch64 "arm_sve.h" /* { dg-error {'svuint16_t' redeclared} } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_4.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_4.c index 91c95a1..2c4014e 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_4.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_4.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -int svfloat32_t; /* { dg-message "note: previous declaration of 'svfloat32_t' was here" } */ +int svfloat32_t; /* { dg-message "note: previous declaration of 'svfloat32_t'" } */ #pragma GCC aarch64 "arm_sve.h" /* { dg-error {'svfloat32_t' redeclared} } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_5.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_5.c index 3cb6b8a..30bf077 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_5.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_5.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -typedef int svbool_t; /* { dg-message "note: previous declaration of 'svbool_t' was here" } */ +typedef int svbool_t; /* { dg-message "note: previous declaration of 'svbool_t'" } */ #pragma GCC aarch64 "arm_sve.h" /* { dg-error {conflicting types for 'svbool_t'} } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_6.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_6.c index c051897..5d81b2b 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_6.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_6.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ -typedef __SVBool_t svbool_t; /* { dg-message "note: previous declaration of 'svbool_t' was here" } */ +typedef __SVBool_t svbool_t; /* { dg-message "note: previous declaration of 'svbool_t'" } */ #pragma GCC aarch64 "arm_sve.h" /* { dg-error {redefinition of typedef 'svbool_t'} } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_8.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_8.c index 41614a3..88ed541 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_8.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_8.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -int svint8x2_t; /* { dg-message "note: previous declaration of 'svint8x2_t' was here" } */ +int svint8x2_t; /* { dg-message "note: previous declaration of 'svint8x2_t'" } */ #pragma GCC aarch64 "arm_sve.h" /* { dg-error {'svint8x2_t' redeclared} } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_9.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_9.c index 83b6855..ec67386 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_9.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/type_redef_9.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -typedef int svint8x2_t; /* { dg-message "note: previous declaration of 'svint8x2_t' was here" } */ +typedef int svint8x2_t; /* { dg-message "note: previous declaration of 'svint8x2_t'" } */ #pragma GCC aarch64 "arm_sve.h" /* { dg-error {conflicting types for 'svint8x2_t'} } */ -- cgit v1.1 From 860c5caf8cbb87055c02b1e77d04f658d2c75880 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Thu, 8 Apr 2021 15:00:05 +0100 Subject: testsuite: Fix gcc.dg/vect/pr99102.c pr99102.c needs to override the default options to exercise the original problem, but that means that it also needs to respecify the dump flags. gcc/testsuite/ * gcc.dg/vect/pr99102.c: Add -fdump-tree-vect-details. --- gcc/testsuite/gcc.dg/vect/pr99102.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/vect/pr99102.c b/gcc/testsuite/gcc.dg/vect/pr99102.c index 62d4d33..6c1a13f 100644 --- a/gcc/testsuite/gcc.dg/vect/pr99102.c +++ b/gcc/testsuite/gcc.dg/vect/pr99102.c @@ -1,4 +1,4 @@ -/* { dg-options "-O2 -ftree-vectorize" } */ +/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-details" } */ /* { dg-additional-options "-msve-vector-bits=256" { target aarch64_sve256_hw } } */ long a[44]; short d, e = -7; -- cgit v1.1 From 559d2f1e0eafd96c19dc5324db1a466286c0e7fc Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 8 Apr 2021 17:15:39 +0200 Subject: c++: Don't cache constexpr functions which are passed pointers to heap or static vars being constructed [PR99859] When cxx_bind_parameters_in_call is called e.g. on a method on an automatic variable, we evaluate the argument and because ADDR_EXPR of an automatic decl is not TREE_CONSTANT, we set *non_constant_args and don't cache it. But when it is called on an object located on the heap (allocated using C++20 constexpr new) where we represent it as TREE_STATIC artificial var, or when it is called on a static var that is currently being constructed, such ADDR_EXPRs are TREE_CONSTANT and we happily cache such calls, but they can in those cases have side-effects in the heap or static var objects and so caching them means such side-effects will happen only once and not as many times as that method or function is called. Furthermore, as Patrick mentioned in the PR, the argument doesn't need to be just ADDR_EXPR of the heap or static var or its components, but it could be a CONSTRUCTOR that has the ADDR_EXPR embedded anywhere. And the incorrectly cached function doesn't need to modify the pointed vars or their components, but some caller could be changing them in between the call that was cached and the call that used the cached result. The following patch fixes it by setting *non_constant_args also when the argument contains somewhere such an ADDR_EXPR, either of a heap artificial var or component thereof, or of a static var currently being constructed (where for that it uses the same check as cxx_eval_store_expression, ctx->global->values.get (...); addresses of other static variables would be rejected by cxx_eval_store_expression and therefore it is ok to cache such calls). 2021-04-08 Jakub Jelinek PR c++/99859 * constexpr.c (addr_of_non_const_var): New function. (cxx_bind_parameters_in_call): Set *non_constant_args to true even if cp_walk_tree on arg with addr_of_non_const_var callback returns true. * g++.dg/cpp1y/constexpr-99859-1.C: New test. * g++.dg/cpp1y/constexpr-99859-2.C: New test. * g++.dg/cpp2a/constexpr-new18.C: New test. * g++.dg/cpp2a/constexpr-new19.C: New test. --- gcc/testsuite/g++.dg/cpp1y/constexpr-99859-1.C | 24 ++++++++++++++ gcc/testsuite/g++.dg/cpp1y/constexpr-99859-2.C | 12 +++++++ gcc/testsuite/g++.dg/cpp2a/constexpr-new18.C | 45 ++++++++++++++++++++++++++ gcc/testsuite/g++.dg/cpp2a/constexpr-new19.C | 43 ++++++++++++++++++++++++ 4 files changed, 124 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1y/constexpr-99859-1.C create mode 100644 gcc/testsuite/g++.dg/cpp1y/constexpr-99859-2.C create mode 100644 gcc/testsuite/g++.dg/cpp2a/constexpr-new18.C create mode 100644 gcc/testsuite/g++.dg/cpp2a/constexpr-new19.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-99859-1.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-99859-1.C new file mode 100644 index 0000000..dea5a5b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-99859-1.C @@ -0,0 +1,24 @@ +// PR c++/99859 +// { dg-do compile { target c++14 } } + +constexpr int +foo (int *x) +{ + return ++*x; +} + +struct S { constexpr S () : a(0) { foo (&a); foo (&a); } int a; }; +constexpr S s = S (); +static_assert (s.a == 2, ""); + +struct R { int *p; }; + +constexpr int +bar (R x) +{ + return ++*x.p; +} + +struct T { int a = 0; constexpr T () { bar (R{&a}); bar (R{&a}); } }; +constexpr T t = T (); +static_assert (t.a == 2, ""); diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-99859-2.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-99859-2.C new file mode 100644 index 0000000..a249f47 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-99859-2.C @@ -0,0 +1,12 @@ +// PR c++/99859 +// { dg-do compile { target c++14 } } + +struct A +{ + int i; + constexpr int f() { return i; } + constexpr A() : i(0) { i = f(); i = 1; i = f(); } +}; + +constexpr A a = A(); +static_assert (a.i == 1, ""); diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-new18.C b/gcc/testsuite/g++.dg/cpp2a/constexpr-new18.C new file mode 100644 index 0000000..24b298a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-new18.C @@ -0,0 +1,45 @@ +// PR c++/99859 +// { dg-do compile { target c++20 } } + +template +struct intrusive_ptr +{ + T *ptr = nullptr; + constexpr explicit intrusive_ptr(T* p) : ptr(p) { + ++ptr->count_; + } + constexpr ~intrusive_ptr() { + if (ptr->dec() == 0) + delete ptr; + } + constexpr intrusive_ptr(intrusive_ptr const& a) : ptr(a.ptr) { + ++ptr->count_; + } +}; + +struct Foo { + int count_ = 0; + constexpr int dec() { + return --count_; + } +}; + +constexpr bool baz() { + Foo f { 4 }; + intrusive_ptr a(&f); + return true; +} +constexpr bool x = baz(); + +constexpr void bar(intrusive_ptr a) +{ + if (a.ptr->count_ != 2) throw 1; +} + +constexpr bool foo() { + intrusive_ptr a(new Foo()); + bar(a); + return true; +} + +static_assert(foo()); diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-new19.C b/gcc/testsuite/g++.dg/cpp2a/constexpr-new19.C new file mode 100644 index 0000000..7a73dee --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-new19.C @@ -0,0 +1,43 @@ +// PR c++/99859 +// { dg-do compile { target c++20 } } + +constexpr void +foo (int *x) +{ + ++*x; +} + +constexpr int +bar () +{ + int *x = new int (0); + foo (x); + foo (x); + int y = *x; + delete x; + return y; +} + +static_assert (bar () == 2); + +struct R { int a, *b; }; + +constexpr void +baz (R x) +{ + ++*x.b; +} + +constexpr int +qux () +{ + int *x = new int (0); + R r{1, x}; + baz (r); + baz (r); + int y = *x; + delete x; + return y; +} + +static_assert (qux () == 2); -- cgit v1.1 From 9f74f9cf47ed9d65e65a06378041e9dd5698e49d Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 8 Apr 2021 08:23:17 -0400 Subject: c++: improve reference binding diagnostic [PR91849] Here we were complaining about binding the lvalue reference to the rvalue result of converting from float to int, but didn't mention that conversion. Talk about the type of the initializer instead. gcc/cp/ChangeLog: PR c++/91849 * call.c (convert_like_internal): Improve reference diagnostic. gcc/testsuite/ChangeLog: PR c++/91849 * g++.dg/conversion/pr66211.C: Adjust diagnostic. * g++.dg/conversion/ref7.C: New test. --- gcc/testsuite/g++.dg/conversion/pr66211.C | 2 +- gcc/testsuite/g++.dg/conversion/ref7.C | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/conversion/ref7.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/conversion/pr66211.C b/gcc/testsuite/g++.dg/conversion/pr66211.C index 770e8a0..5c1ae13 100644 --- a/gcc/testsuite/g++.dg/conversion/pr66211.C +++ b/gcc/testsuite/g++.dg/conversion/pr66211.C @@ -7,5 +7,5 @@ int main() { int x = 0; double y = 1; - f(1 > 0 ? x : y); // { dg-error "cannot bind .* to an rvalue" } + f(1 > 0 ? x : y); // { dg-error "cannot bind non-const lvalue reference of type .int&. to a value of type .double" } } diff --git a/gcc/testsuite/g++.dg/conversion/ref7.C b/gcc/testsuite/g++.dg/conversion/ref7.C new file mode 100644 index 0000000..99347cb --- /dev/null +++ b/gcc/testsuite/g++.dg/conversion/ref7.C @@ -0,0 +1,17 @@ +// PR c++/91849 + +struct A { operator float(); }; + +void +g () +{ + float f = 1.f; + int &r = f; // { dg-error "float" } + int &r2 = A(); // { dg-error "float" } +} + +void +g2 () +{ + int &r = 1.f; // { dg-error "float" } +} -- cgit v1.1 From 09ef422fadce393300ce84d2f8c8331a344de2ef Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Thu, 8 Apr 2021 17:39:11 +0100 Subject: testsuite: Add -mbig-endian stdint.h requirement Some AArch64 tests force -mbig-endian and indirectly include stdint.h. However, not all OSes support both endiannesses, leading to: FAIL: gcc.target/aarch64/advsimd-intrinsics/bf16_get-be.c -O0 (test for excess errors) UNRESOLVED: gcc.target/aarch64/advsimd-intrinsics/bf16_get-be.c -O1 check-function-bodies test_vget_high_bf16 UNRESOLVED: gcc.target/aarch64/advsimd-intrinsics/bf16_get-be.c -O1 check-function-bodies test_vget_low_bf16 etc. This patch adds an (admittedly special-purpose) target selector for this. gcc/ * doc/sourcebuild.texi (stdint_types_mbig_endian): Document. gcc/testsuite/ * lib/target-supports.exp (check_effective_target_stdint_types_mbig_endian): New proc. * gcc.target/aarch64/advsimd-intrinsics/bf16_get-be.c: Require stdint_types_mbig_endian. * gcc.target/aarch64/advsimd-intrinsics/bfdot-2.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vdot-3-2.c: Likewise. --- .../gcc.target/aarch64/advsimd-intrinsics/bf16_get-be.c | 1 + .../gcc.target/aarch64/advsimd-intrinsics/bfdot-2.c | 1 + .../gcc.target/aarch64/advsimd-intrinsics/vdot-3-2.c | 1 + gcc/testsuite/lib/target-supports.exp | 12 ++++++++++++ 4 files changed, 15 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_get-be.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_get-be.c index bd9bb11..cd27098 100644 --- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_get-be.c +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_get-be.c @@ -1,4 +1,5 @@ /* { dg-do assemble { target { aarch64*-*-* } } } */ +/* { dg-require-effective-target stdint_types_mbig_endian } */ /* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */ /* { dg-add-options arm_v8_2a_bf16_neon } */ /* { dg-additional-options "-mbig-endian -save-temps" } */ diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bfdot-2.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bfdot-2.c index 58bdee5..ae0a953 100755 --- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bfdot-2.c +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bfdot-2.c @@ -1,4 +1,5 @@ /* { dg-do assemble { target { aarch64*-*-* } } } */ +/* { dg-require-effective-target stdint_types_mbig_endian } */ /* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */ /* { dg-add-options arm_v8_2a_bf16_neon } */ /* { dg-additional-options "-mbig-endian --save-temps" } */ diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vdot-3-2.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vdot-3-2.c index 96bca23..61c7c51 100755 --- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vdot-3-2.c +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vdot-3-2.c @@ -1,4 +1,5 @@ /* { dg-do assemble { target { aarch64*-*-* } } } */ +/* { dg-require-effective-target stdint_types_mbig_endian } */ /* { dg-require-effective-target arm_v8_2a_i8mm_ok } */ /* { dg-add-options arm_v8_2a_i8mm } */ /* { dg-additional-options "-mbig-endian -save-temps" } */ diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 1230d19..ad32310 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -8254,6 +8254,18 @@ proc check_effective_target_stdint_types { } { }] } +# Like check_effective_target_stdint_types, but test what happens when +# -mbig-endian is passed. This test only makes sense on targets that +# support -mbig-endian; it will fail elsewhere. + +proc check_effective_target_stdint_types_mbig_endian { } { + return [check_no_compiler_messages stdint_types_mbig_endian assembly { + #include + int8_t a; int16_t b; int32_t c; int64_t d; + uint8_t e; uint16_t f; uint32_t g; uint64_t h; + } "-mbig-endian"] +} + # Return 1 if target has the basic signed and unsigned types in # , 0 otherwise. This is for tests that GCC's notions of # these types agree with those in the header, as some systems have -- cgit v1.1 From 59d09f9fe4bcf4a341494220be377dfe13d84c1e Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Thu, 8 Apr 2021 17:39:12 +0100 Subject: testsuite: Update scan-lto-assembler scan-lto-assembler was looking for the old dump names instead of the new ones. There are only two uses of this: gcc.target/nios2/custom-fp-lto.c gcc.target/aarch64/pr70044.c Both of them use single source files, so I think they both want the same behaviour. gcc/testsuite/ * lib/scanasm.exp (scan-lto-assembler): Update expected name of dump file. --- gcc/testsuite/lib/scanasm.exp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/lib/scanasm.exp b/gcc/testsuite/lib/scanasm.exp index e723608..0dcb893 100644 --- a/gcc/testsuite/lib/scanasm.exp +++ b/gcc/testsuite/lib/scanasm.exp @@ -754,7 +754,7 @@ proc scan-lto-assembler { args } { set testcase [testname-for-summary] # The name might include a list of options; extract the file name. set filename [lindex $testcase 0] - set output_file "[file rootname [file tail $filename]].exe.ltrans0.s" + set output_file "[file rootname [file tail $filename]].ltrans0.ltrans.s" verbose "output_file: $output_file" dg-scan "scan-lto-assembler" 1 $testcase $output_file $args } -- cgit v1.1 From 05708d6eef87a3dd0c68b1aed7f8d9c3824062b8 Mon Sep 17 00:00:00 2001 From: Patrick Palka Date: Thu, 8 Apr 2021 13:07:37 -0400 Subject: c++: constrained CTAD for nested class template [PR97679] In the testcase below, we're crashing during constraint checking of the implicitly generated deduction guides for the nested class template A::B because we never substitute the outer template arguments (for A) into the constraint, neither ahead of time nor as part of satisfaction. Ideally we'd like to avoid substituting into a constraint ahead of time, but the "flattening" vector 'tsubst_args' is constructed under the assumption that all outer template arguments are already substituted in, and eliminating this assumption to yield a flattening vector that includes outer (generic) template arguments suitable for substituting into the constraint would be tricky and error-prone. So this patch takes the approximate approach of substituting the outer arguments into the constraint ahead of time, so that the subsequent substitution of 'tsubst_args' is coherent and so later satisfaction just works. gcc/cp/ChangeLog: PR c++/97679 * pt.c (build_deduction_guide): Document OUTER_ARGS. Substitute them into the propagated constraints. gcc/testsuite/ChangeLog: PR c++/97679 * g++.dg/cpp2a/concepts-ctad3.C: New test. --- gcc/testsuite/g++.dg/cpp2a/concepts-ctad3.C | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp2a/concepts-ctad3.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-ctad3.C b/gcc/testsuite/g++.dg/cpp2a/concepts-ctad3.C new file mode 100644 index 0000000..3546b74 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/concepts-ctad3.C @@ -0,0 +1,16 @@ +// PR c++/97679 +// { dg-do compile { target c++20 } } + +template struct A { + template struct B { + B(T) requires V; + template B(T, U) requires V || (__is_same(T, char) && __is_same(U, int)); + }; +}; + +A::B x1(0); +A::B x2(0); // { dg-error "deduction|no match" } + +A::B y1(0, '0'); +A::B y2(0, '0'); // { dg-error "deduction|no match" } +A::B y3('0', 0); -- cgit v1.1 From 123b3e03c911a43054c1f88f5d3110e1d084dd4e Mon Sep 17 00:00:00 2001 From: Patrick Palka Date: Thu, 8 Apr 2021 13:07:43 -0400 Subject: c++: Don't substitute into constraints on lambdas [PR99874] We currently substitute through a lambda's constraints whenever we regenerate it via tsubst_lambda_expr. This is the wrong approach because it can lead to hard errors due to constraints being evaluated out of order (as in the testcase concepts-lambda17.C below), and because it doesn't mesh well with the recently added REQUIRES_EXPR_EXTRA_ARGS mechanism for delaying substitution into requires-expressions, which is the cause of this PR. But in order to avoid substituting through a lambda's constraints during regeneration, we need to be able to get at all in-scope template parameters and corresponding template arguments during constraint checking of a lambda's op(). And this information is not easily available when we need it, it seems. To that end, the approach that this patch takes is to add two new fields to LAMBDA_EXPR (and remove one): LAMBDA_EXPR_REGENERATED_FROM (replacing LAMBDA_EXPR_INSTANTIATED), and LAMBDA_EXPR_REGENERATING_TARGS. The former allows us to obtain the complete set of template parameters that are in-scope for a lambda's op(), and the latter gives us all outer template arguments that were used to regenerate the lambda (analogous to the TI_TEMPLATE and TI_ARGS of a TEMPLATE_INFO, respectively). LAMBDA_EXPR_REGENERATING_TARGS is not strictly necessary -- in an earlier prototype, I walked LAMBDA_EXPR_EXTRA_SCOPE to build up this set of outer template arguments on demand, but it seems cleaner to do it this way. (We'd need to walk LAMBDA_EXPR_EXTRA_SCOPE and not DECL/TYPE_CONTEXT because the latter skips over variable template scopes.) This patch also renames the predicate instantiated_lambda_fn_p to regenerated_lambda_fn_p, for sake of consistency with the rest of the patch which uses "regenerated" instead of "instantiated". gcc/cp/ChangeLog: PR c++/99874 * constraint.cc (get_normalized_constraints_from_decl): Handle regenerated lambdas. (satisfy_declaration_constraints): Likewise. Check for dependent args later. * cp-tree.h (LAMBDA_EXPR_INSTANTIATED): Replace with ... (LAMBDA_EXPR_REGENERATED_FROM): ... this. (LAMBDA_EXPR_REGENERATING_TARGS): New. (tree_lambda_expr::regenerated_from): New data member. (tree_lambda_expr::regenerating_targs): New data member. (add_to_template_args): Declare. (regenerated_lambda_fn_p): Likewise. (most_general_lambda): Likewise. * lambda.c (build_lambda_expr): Set LAMBDA_EXPR_REGENERATED_FROM and LAMBDA_EXPR_REGENERATING_TARGS. * pt.c (add_to_template_args): No longer static. (tsubst_function_decl): Unconditionally propagate constraints on the substituted function decl. (instantiated_lambda_fn_p): Rename to ... (regenerated_lambda_fn_p): ... this. Check LAMBDA_EXPR_REGENERATED_FROM instead of LAMBDA_EXPR_INSTANTIATED. (most_general_lambda): Define. (enclosing_instantiation_of): Adjust after renaming instantiated_lambda_fn_p. (tsubst_lambda_expr): Don't set LAMBDA_EXPR_INSTANTIATED. Set LAMBDA_EXPR_REGENERATED_FROM and LAMBDA_EXPR_REGENERATING_TARGS. Don't substitute or set constraints on the regenerated lambda. gcc/testsuite/ChangeLog: PR c++/99874 * g++.dg/cpp2a/concepts-lambda16.C: New test. * g++.dg/cpp2a/concepts-lambda17.C: New test. --- gcc/testsuite/g++.dg/cpp2a/concepts-lambda16.C | 61 ++++++++++++++++++++++++++ gcc/testsuite/g++.dg/cpp2a/concepts-lambda17.C | 14 ++++++ 2 files changed, 75 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp2a/concepts-lambda16.C create mode 100644 gcc/testsuite/g++.dg/cpp2a/concepts-lambda17.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-lambda16.C b/gcc/testsuite/g++.dg/cpp2a/concepts-lambda16.C new file mode 100644 index 0000000..01fda6e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/concepts-lambda16.C @@ -0,0 +1,61 @@ +// PR c++/99874 +// { dg-do compile { target c++20 } } + +template +struct A { + static inline auto a = [] (U) { + return [] (V) requires requires (T t, U u, V v) { t + u + v; } { }; + }; + + template + static inline auto b = [] (U) { + return [] (V) requires requires (T t, U u, V v, W w) { t + u + v + w; } { }; + }; + + static auto f() { + return [] (U) { + return [] (V) requires requires (T t, U u, V v) { t + u + v; } { }; + }; + } + + template + static auto g() { + return [] (U) { + return [] (V) requires requires (T t, U u, V v, W w) { t + u + v + w; } { }; + }; + } +}; + +template +auto a = [] (U) { + return [] (V) requires requires (T t, U u, V v) { t + u + v; } { }; +}; + +template +auto b = [] (U) { + return [] (V) { + return [] { + return [] () requires requires (T t, U u, V v) { t + u + v; } { }; + }; + }; +}; + +int main() { + A::a(0)(0); + A::a(0)(nullptr); // { dg-error "no match" } + + A::b(0)(0); + A::b(0)(nullptr); // { dg-error "no match" } + + A::f()(0)(0); + A::f()(0)(nullptr); // { dg-error "no match" } + + A::g()(0)(0); + A::g()(0)(nullptr); // { dg-error "no match" } + + a(0)(0); + a(0)(nullptr); // { dg-error "no match" } + + b(0)(0)(); + b(0)(nullptr)()(); // { dg-error "no match" } +} diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-lambda17.C b/gcc/testsuite/g++.dg/cpp2a/concepts-lambda17.C new file mode 100644 index 0000000..32ae1e1 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/concepts-lambda17.C @@ -0,0 +1,14 @@ +// { dg-do compile { target c++20 } } + +template +struct A { static const bool value = T::value; }; + +template +void f() { + // Verify we don't substitute into a lambda's constraints when + // regenerating it, which would lead to a hard error here. + [] () requires (T::value && A::value) || true { }(); + [] (U) requires (U::value && A::value) || true { }(0); +} + +template void f(); -- cgit v1.1 From 5f7c2d20b5bd33d7afacb56e18111edb3256c903 Mon Sep 17 00:00:00 2001 From: David Edelsohn Date: Wed, 7 Apr 2021 21:34:02 -0400 Subject: aix: revert TLS common change GCC uses TLS common for both public common / BSS and local common / BSS. This patch reverts to use .comm directive to allocate TLS common / BSS. This also changes the priority of section selection to use BSS before data section. gcc/ChangeLog: * config/rs6000/rs6000.c (rs6000_xcoff_select_section): Select TLS BSS before TLS data. * config/rs6000/xcoff.h (ASM_OUTPUT_TLS_COMMON): Use .comm. gcc/testsuite/ChangeLog: * g++.dg/gomp/tls-5.C: Expect tbss failure on AIX. --- gcc/testsuite/g++.dg/gomp/tls-5.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/gomp/tls-5.C b/gcc/testsuite/g++.dg/gomp/tls-5.C index eb187b6..81431e8 100644 --- a/gcc/testsuite/g++.dg/gomp/tls-5.C +++ b/gcc/testsuite/g++.dg/gomp/tls-5.C @@ -1,7 +1,7 @@ // The reference temp should be TLS, not normal data. // { dg-require-effective-target c++11 } // { dg-final { scan-assembler-not "\\.data" { target tls_native xfail powerpc-*-aix* } } } -// { dg-final { scan-assembler-symbol-section {^_?ir$} {^\.tbss|\[TL\]} { target tls_native } } } +// { dg-final { scan-assembler-symbol-section {^_?ir$} {^\.tbss} { target tls_native xfail powerpc-*-aix* } } } // { dg-final { scan-assembler-symbol-section {^_?_ZGR2ir_$} {^\.tdata|\[TL\]} { target tls_native } } } extern int&& ir; -- cgit v1.1 From 019a922063f26784d5a070d9198a1f937b8a8343 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 9 Apr 2021 00:16:56 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 136 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b5de7aa..d28b98b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,139 @@ +2021-04-08 David Edelsohn + + * g++.dg/gomp/tls-5.C: Expect tbss failure on AIX. + +2021-04-08 Patrick Palka + + PR c++/99874 + * g++.dg/cpp2a/concepts-lambda16.C: New test. + * g++.dg/cpp2a/concepts-lambda17.C: New test. + +2021-04-08 Patrick Palka + + PR c++/97679 + * g++.dg/cpp2a/concepts-ctad3.C: New test. + +2021-04-08 Richard Sandiford + + * lib/scanasm.exp (scan-lto-assembler): Update expected name + of dump file. + +2021-04-08 Richard Sandiford + + * lib/target-supports.exp + (check_effective_target_stdint_types_mbig_endian): New proc. + * gcc.target/aarch64/advsimd-intrinsics/bf16_get-be.c: Require + stdint_types_mbig_endian. + * gcc.target/aarch64/advsimd-intrinsics/bfdot-2.c: Likewise. + * gcc.target/aarch64/advsimd-intrinsics/vdot-3-2.c: Likewise. + +2021-04-08 Jason Merrill + + PR c++/91849 + * g++.dg/conversion/pr66211.C: Adjust diagnostic. + * g++.dg/conversion/ref7.C: New test. + +2021-04-08 Jakub Jelinek + + PR c++/99859 + * g++.dg/cpp1y/constexpr-99859-1.C: New test. + * g++.dg/cpp1y/constexpr-99859-2.C: New test. + * g++.dg/cpp2a/constexpr-new18.C: New test. + * g++.dg/cpp2a/constexpr-new19.C: New test. + +2021-04-08 Richard Sandiford + + * gcc.dg/vect/pr99102.c: Add -fdump-tree-vect-details. + +2021-04-08 Richard Sandiford + + * gcc.target/aarch64/sve/acle/general-c/func_redef_1.c: Remove + "was here" from error message. + * gcc.target/aarch64/sve/acle/general-c/func_redef_2.c: Likewise. + * gcc.target/aarch64/sve/acle/general-c/func_redef_3.c: Likewise. + * gcc.target/aarch64/sve/acle/general-c/func_redef_6.c: Likewise. + * gcc.target/aarch64/sve/acle/general-c/type_redef_1.c: Likewise. + * gcc.target/aarch64/sve/acle/general-c/type_redef_2.c: Likewise. + * gcc.target/aarch64/sve/acle/general-c/type_redef_3.c: Likewise. + * gcc.target/aarch64/sve/acle/general-c/type_redef_4.c: Likewise. + * gcc.target/aarch64/sve/acle/general-c/type_redef_5.c: Likewise. + * gcc.target/aarch64/sve/acle/general-c/type_redef_6.c: Likewise. + * gcc.target/aarch64/sve/acle/general-c/type_redef_8.c: Likewise. + * gcc.target/aarch64/sve/acle/general-c/type_redef_9.c: Likewise. + * gcc.target/aarch64/sve/acle/general-c/type_redef_10.c: Likewise. + * gcc.target/aarch64/sve/acle/general-c/type_redef_13.c: Likewise. + +2021-04-08 Richard Sandiford + + * gcc.target/aarch64/asimd-mull-elem.c: Add +nosve. + * gcc.target/aarch64/pr98772.c: Likewise. + * gcc.target/aarch64/simd/vect_su_add_sub.c: Likewise. + +2021-04-08 Richard Sandiford + + * gcc.target/aarch64/sve/mul_2.c: Adjust negative constants to avoid + conversion to shifts and adds. + +2021-04-08 David Malcolm + + PR analyzer/99042 + PR analyzer/99774 + * gcc.dg/analyzer/pr99042.c: New test. + * gcc.dg/analyzer/pr99774-1.c: New test. + * gcc.dg/analyzer/pr99774-2.c: New test. + +2021-04-08 Iain Buclaw + + * gdc.dg/gdc108.d: Update test. + * gdc.dg/gdc142.d: Likewise. + * gdc.dg/pr90136a.d: Likewise. + * gdc.dg/pr90136b.d: Likewise. + * gdc.dg/pr90136c.d: Likewise. + * gdc.dg/pr95173.d: Likewise. + * gdc.dg/attr_allocsize1.d: New test. + * gdc.dg/attr_allocsize2.d: New test. + * gdc.dg/attr_alwaysinline1.d: New test. + * gdc.dg/attr_cold1.d: New test. + * gdc.dg/attr_exclusions1.d: New test. + * gdc.dg/attr_exclusions2.d: New test. + * gdc.dg/attr_flatten1.d: New test. + * gdc.dg/attr_module.d: New test. + * gdc.dg/attr_noclone1.d: New test. + * gdc.dg/attr_noicf1.d: New test. + * gdc.dg/attr_noinline1.d: New test. + * gdc.dg/attr_noipa1.d: New test. + * gdc.dg/attr_noplt1.d: New test. + * gdc.dg/attr_optimize1.d: New test. + * gdc.dg/attr_optimize2.d: New test. + * gdc.dg/attr_optimize3.d: New test. + * gdc.dg/attr_optimize4.d: New test. + * gdc.dg/attr_restrict1.d: New test. + * gdc.dg/attr_section1.d: New test. + * gdc.dg/attr_symver1.d: New test. + * gdc.dg/attr_target1.d: New test. + * gdc.dg/attr_targetclones1.d: New test. + * gdc.dg/attr_used1.d: New test. + * gdc.dg/attr_used2.d: New test. + * gdc.dg/attr_weak1.d: New test. + * gdc.dg/imports/attributes.d: New test. + +2021-04-08 Jason Merrill + + PR c++/94529 + * g++.dg/template/mem-spec2.C: New test. + +2021-04-08 Marek Polacek + + PR c++/99844 + * g++.dg/cpp2a/explicit16.C: Use c++20. + * g++.dg/cpp0x/noexcept66.C: New test. + * g++.dg/cpp2a/explicit17.C: New test. + +2021-04-08 Alex Coplan + + PR target/99647 + * gcc.c-torture/compile/pr99647.c: New test. + 2021-04-07 Jason Merrill PR c++/41723 -- cgit v1.1 From d31f485dedc86773152d0384bc6ba5583b259a42 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Fri, 9 Apr 2021 10:18:24 +0200 Subject: Fortran: Fix fndecl with -fcoarray=lib [PR99817] gcc/fortran/ChangeLog: PR fortran/99817 * trans-types.c (gfc_get_function_type): Also generate hidden coarray argument for character arguments. gcc/testsuite/ChangeLog: PR fortran/99817 * gfortran.dg/coarray/dummy_2.f90: New test. --- gcc/testsuite/gfortran.dg/coarray/dummy_2.f90 | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/coarray/dummy_2.f90 (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gfortran.dg/coarray/dummy_2.f90 b/gcc/testsuite/gfortran.dg/coarray/dummy_2.f90 new file mode 100644 index 0000000..3526374 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/coarray/dummy_2.f90 @@ -0,0 +1,26 @@ +! { dg-do compile } +! +! PR fortran/99817 +! +! Contributed by G. Steinmetz +! +subroutine s1 (x) + character(*) :: x(*)[*] +end + +subroutine s2 (x) + character(*), dimension(*), codimension[*] :: x + integer :: i + i = len(x) +end + +subroutine s3 (x, y) + character(*), dimension(:) :: x[*] + character(*) :: y +end + +subroutine s4 (x, y, z) + character(*), dimension(:) :: x[2, *] + character(*), dimension(*) :: y + character(*) :: z +end -- cgit v1.1 From f44a2713da7ea8f5abde5b3a98ddf1ab97b9175a Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Fri, 9 Apr 2021 13:43:15 +0100 Subject: testsuite: Skip gfortran.dg/ieee/ieee_[68].f90 for Arm targets [PR78314] For the reasons discussed in PR78314, ieee_support_halting doesn't work correctly for arm* and aarch64*. I think the easiest thing is to skip these tests until the PR is fixed. This doesn't mean that the PR is unimportant. It just doesn't seem useful to have the unpredictable failures described in the PR trail given that the problem is known and has been analysed. gcc/testsuite/ PR libfortran/78314 * gfortran.dg/ieee/ieee_6.f90: Skip for arm* and aarch64*. * gfortran.dg/ieee/ieee_8.f90: Likewise. --- gcc/testsuite/gfortran.dg/ieee/ieee_6.f90 | 1 + gcc/testsuite/gfortran.dg/ieee/ieee_8.f90 | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gfortran.dg/ieee/ieee_6.f90 b/gcc/testsuite/gfortran.dg/ieee/ieee_6.f90 index 96ceaff..1af7ed3 100644 --- a/gcc/testsuite/gfortran.dg/ieee/ieee_6.f90 +++ b/gcc/testsuite/gfortran.dg/ieee/ieee_6.f90 @@ -1,4 +1,5 @@ ! { dg-do run } +! { dg-skip-if "PR libfortran/78314" { aarch64*-*-gnu* arm*-*-gnueabi arm*-*-gnueabihf } } ! ! This test will fail on older x86_64 glibc (< 2.20), due to this bug: ! https://sourceware.org/bugzilla/show_bug.cgi?id=16198 diff --git a/gcc/testsuite/gfortran.dg/ieee/ieee_8.f90 b/gcc/testsuite/gfortran.dg/ieee/ieee_8.f90 index d847b1b..4a11581 100644 --- a/gcc/testsuite/gfortran.dg/ieee/ieee_8.f90 +++ b/gcc/testsuite/gfortran.dg/ieee/ieee_8.f90 @@ -1,5 +1,5 @@ -! { dg-do run { xfail aarch64*-*-gnu* arm*-*-gnueabi arm*-*-gnueabihf } } -! XFAIL because of PR libfortran/78449. +! { dg-do run } +! { dg-skip-if "PR libfortran/78314" { aarch64*-*-gnu* arm*-*-gnueabi arm*-*-gnueabihf } } module foo use :: ieee_exceptions -- cgit v1.1 From 9a54db29387c4e936ab99499bf4d3e1649e92800 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Fri, 9 Apr 2021 13:43:16 +0100 Subject: testsuite: XFAIL two insv_1.c tests [PR87763] This patch XFAILs the remaining regressions in PR87763. We should still fix them at some point, but that's not GCC 11 material. gcc/testsuite/ PR target/87763 * gcc.target/aarch64/insv_1.c: XFAIL two scan tests. --- gcc/testsuite/gcc.target/aarch64/insv_1.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/aarch64/insv_1.c b/gcc/testsuite/gcc.target/aarch64/insv_1.c index 9efa22e..a1d26b0 100644 --- a/gcc/testsuite/gcc.target/aarch64/insv_1.c +++ b/gcc/testsuite/gcc.target/aarch64/insv_1.c @@ -16,7 +16,7 @@ typedef struct bitfield bitfield bfi1 (bitfield a) { - /* { dg-final { scan-assembler "bfi\tx\[0-9\]+, x\[0-9\]+, 0, 8" } } */ + /* { dg-final { scan-assembler "bfi\tx\[0-9\]+, x\[0-9\]+, 0, 8" { xfail *-*-* } } } */ a.eight = 3; return a; } @@ -24,7 +24,7 @@ bfi1 (bitfield a) bitfield bfi2 (bitfield a) { - /* { dg-final { scan-assembler "bfi\tx\[0-9\]+, x\[0-9\]+, 16, 5" } } */ + /* { dg-final { scan-assembler "bfi\tx\[0-9\]+, x\[0-9\]+, 16, 5" { xfail *-*-* } } } */ a.five = 7; return a; } -- cgit v1.1 From 7e45c45d9ccf9d0af2ce29fc5016506ba30676c0 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Fri, 9 Apr 2021 13:43:16 +0100 Subject: testsuite: Tweak mem-shift-canonical.c mem-shift-canonical.c started failing after the fix for PR97684. We used to generate things like: add x7, x1, x5, lsl 2 // 54 [c=4 l=4] *add_lsl_di ld1 {v0.s}[1], [x7] // 18 [c=4 l=4] aarch64_simd_vec_setv4si/2 where the add_lsl_di was generated by LRA. After PR97684 we generate: ldr s1, [x1, x5, lsl 2] // 17 [c=4 l=4] *zero_extendsidi2_aarch64/3 ins v0.s[1], v1.s[0] // 18 [c=4 l=4] aarch64_simd_vec_setv4si/0 Which one is better is an interesting question. However, it was really only a fluke that we generated the original code. The pseudo that becomes s1 in the new code above has a REG_EQUIV note: (insn 17 16 18 3 (set (reg:SI 111 [ MEM[(int *)b_25(D) + ivtmp.9_30 * 4] ]) (mem:SI (plus:DI (mult:DI (reg:DI 101 [ ivtmp.9 ]) (const_int 4 [0x4])) (reg/v/f:DI 105 [ b ])) [2 MEM[(int *)b_25(D) + ivtmp.9_30 * 4]+0 S4 A32])) "gcc/testsuite/gcc.target/aarch64/mem-shift-canonical.c":21:18 52 {*movsi_aarch64} (expr_list:REG_EQUIV (mem:SI (plus:DI (mult:DI (reg:DI 101 [ ivtmp.9 ]) (const_int 4 [0x4])) (reg/v/f:DI 105 [ b ])) [2 MEM[(int *)b_25(D) + ivtmp.9_30 * 4]+0 S4 A32]) (nil))) (insn 18 17 19 3 (set (reg:V4SI 109 [ MEM[(int *)a_23(D) + ivtmp.9_30 * 4] ]) (vec_merge:V4SI (vec_duplicate:V4SI (reg:SI 111 [ MEM[(int *)b_25(D) + ivtmp.9_30 * 4] ])) (subreg:V4SI (reg:SI 110 [ MEM[(int *)a_23(D) + ivtmp.9_30 * 4] ]) 0) (const_int 2 [0x2]))) "gcc/testsuite/gcc.target/aarch64/mem-shift-canonical.c":21:18 1683 {aarch64_simd_vec_setv4si} (expr_list:REG_DEAD (reg:SI 111 [ MEM[(int *)b_25(D) + ivtmp.9_30 * 4] ]) (expr_list:REG_DEAD (reg:SI 110 [ MEM[(int *)a_23(D) + ivtmp.9_30 * 4] ]) (nil)))) Before the PR, IRA didn't allocate a register to r111 and so LRA rematerialised the REG_EQUIV note inside insn 18, leading to the reload. Now IRA allocates a register instead. So I think this is working as expected, in the sense that IRA is now doing what the backend asked it to do. If the backend prefers the first version (and it might not), it needs to do more than it's currently doing to promote the use of lane loads. E.g. it should probably have a combine define_split that splits the combination of insn 17 and insn 18 into an ADD + an LD1. I think for now the best thing is to use a different approach to triggering the original bug. The asm in the new test ICEs with the r11-2903 LRA patch reverted and passes with it applied. gcc/testsuite/ * gcc.target/aarch64/mem-shift-canonical.c: Use an asm instead of relying on vectorisation. --- .../gcc.target/aarch64/mem-shift-canonical.c | 26 +++++----------------- 1 file changed, 5 insertions(+), 21 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/aarch64/mem-shift-canonical.c b/gcc/testsuite/gcc.target/aarch64/mem-shift-canonical.c index 47479ff..e3c83e8 100644 --- a/gcc/testsuite/gcc.target/aarch64/mem-shift-canonical.c +++ b/gcc/testsuite/gcc.target/aarch64/mem-shift-canonical.c @@ -1,28 +1,12 @@ -/* This test is a copy of gcc.dg/torture/pr34330.c: here we are looking for - specific patterns being matched in the AArch64 backend. */ - /* { dg-do compile } */ -/* { dg-options "-Os -ftree-vectorize -dp" } */ +/* { dg-options "-O2 -dp" } */ /* { dg-require-effective-target lp64 } */ - -struct T -{ - int t; - struct { short s1, s2, s3, s4; } *s; -}; - void -foo (int *a, int *b, int *c, int *d, struct T *e) +f (int x0, int *x1, long x2) { - int i; - for (i = 0; i < e->t; i++) - { - e->s[i].s1 = a[i]; - e->s[i].s2 = b[i]; - e->s[i].s3 = c[i]; - e->s[i].s4 = d[i]; - } + asm volatile ("// foo %0 %1" + :: "r,w" (x0), "Q,m" (x1[x2])); } -/* { dg-final { scan-assembler-times "add_lsl_di" 3 } } */ +/* { dg-final { scan-assembler-times "add_lsl_di" 1 } } */ -- cgit v1.1 From a708de07a1075b4707e640466b987fd724e823b7 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Fri, 9 Apr 2021 13:43:17 +0100 Subject: testsuite: Fix gcc.dg/vect/pr65947-7.c This test was failing on aarch64 targets because we inlined the test function into main, making it vectorisable. gcc/testsuite/ * gcc.dg/vect/pr65947-7.c: Add a noipa attribute. Expect the loop to vectorized if vect_fold_extract_last. --- gcc/testsuite/gcc.dg/vect/pr65947-7.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/vect/pr65947-7.c b/gcc/testsuite/gcc.dg/vect/pr65947-7.c index 287f57e..16cdcd1 100644 --- a/gcc/testsuite/gcc.dg/vect/pr65947-7.c +++ b/gcc/testsuite/gcc.dg/vect/pr65947-7.c @@ -9,7 +9,7 @@ extern void abort (void) __attribute__ ((noreturn)); /* Condition reduction with comparison is a different type to the data. Will fail to vectorize. */ -int +int __attribute__ ((noipa)) condition_reduction (short *a, int min_v, int *b) { int last = N + 65; @@ -52,4 +52,5 @@ main (void) return 0; } -/* { dg-final { scan-tree-dump-not "LOOP VECTORIZED" "vect" } } */ +/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" { target vect_fold_extract_last } } } */ +/* { dg-final { scan-tree-dump-not "LOOP VECTORIZED" "vect" { target { ! vect_fold_extract_last } } } } */ -- cgit v1.1 From 00138f9b2b96b61f49605fa261012a330b2668b1 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Fri, 9 Apr 2021 13:43:18 +0100 Subject: testsuite: Add some vect_variable_length XFAILs This patch adds XFAILs for some tests that fail with variable-length vectors. For pr96573.c I'd wondered about instead extending the regexp. The code we generate isn't very good though, so it doesn't seem worth matching. (Fixing the bad code is on the todo list.) gcc/testsuite/ * g++.dg/tree-ssa/pr83518.C: XFAIL for vect_variable_length. * gcc.dg/pr96573.c: Likewise. * gcc.dg/tree-ssa/pr84512.c: Likewise. * gcc.dg/vect/bb-slp-43.c: Likewise. * gcc.dg/vect/slp-reduc-11.c: Likewise. --- gcc/testsuite/g++.dg/tree-ssa/pr83518.C | 2 +- gcc/testsuite/gcc.dg/pr96573.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/pr84512.c | 2 +- gcc/testsuite/gcc.dg/vect/bb-slp-43.c | 2 +- gcc/testsuite/gcc.dg/vect/slp-reduc-11.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr83518.C b/gcc/testsuite/g++.dg/tree-ssa/pr83518.C index 3e153c5..b8a2bd1 100644 --- a/gcc/testsuite/g++.dg/tree-ssa/pr83518.C +++ b/gcc/testsuite/g++.dg/tree-ssa/pr83518.C @@ -24,4 +24,4 @@ unsigned test() return sum; } -/* { dg-final { scan-tree-dump "return 15;" "optimized" } } */ +/* { dg-final { scan-tree-dump "return 15;" "optimized" { xfail vect_variable_length } } } */ diff --git a/gcc/testsuite/gcc.dg/pr96573.c b/gcc/testsuite/gcc.dg/pr96573.c index 63db69d..c7d8f9e 100644 --- a/gcc/testsuite/gcc.dg/pr96573.c +++ b/gcc/testsuite/gcc.dg/pr96573.c @@ -2,7 +2,7 @@ /* { dg-do compile { target { lp64 || ilp32 } } } */ /* { dg-require-effective-target bswap } */ /* { dg-options "-O3 -fdump-tree-optimized" } */ -/* { dg-final { scan-tree-dump "__builtin_bswap\|VEC_PERM_EXPR\[^\n\r]*7, 6, 5, 4, 3, 2, 1, 0" "optimized" } } */ +/* { dg-final { scan-tree-dump "__builtin_bswap\|VEC_PERM_EXPR\[^\n\r]*7, 6, 5, 4, 3, 2, 1, 0" "optimized" { xfail vect_variable_length } } } */ typedef __SIZE_TYPE__ size_t; diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr84512.c b/gcc/testsuite/gcc.dg/tree-ssa/pr84512.c index 3c02701..496c78b 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr84512.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr84512.c @@ -13,4 +13,4 @@ int foo() } /* Listed targets xfailed due to PR84958. */ -/* { dg-final { scan-tree-dump "return 285;" "optimized" { xfail { amdgcn*-*-* } } } } */ +/* { dg-final { scan-tree-dump "return 285;" "optimized" { xfail { amdgcn*-*-* || vect_variable_length } } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-43.c b/gcc/testsuite/gcc.dg/vect/bb-slp-43.c index 40bd2e0..a65d951 100644 --- a/gcc/testsuite/gcc.dg/vect/bb-slp-43.c +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-43.c @@ -14,4 +14,4 @@ f (int *restrict x, short *restrict y) } /* { dg-final { scan-tree-dump-not "mixed mask and nonmask" "slp2" } } */ -/* { dg-final { scan-tree-dump-not "vector operands from scalars" "slp2" { target { { vect_int && vect_bool_cmp } && { vect_unpack && vect_hw_misalign } } } } } */ +/* { dg-final { scan-tree-dump-not "vector operands from scalars" "slp2" { target { { vect_int && vect_bool_cmp } && { vect_unpack && vect_hw_misalign } } xfail vect_variable_length } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/slp-reduc-11.c b/gcc/testsuite/gcc.dg/vect/slp-reduc-11.c index a2f86fb..260d65c 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-reduc-11.c +++ b/gcc/testsuite/gcc.dg/vect/slp-reduc-11.c @@ -16,5 +16,5 @@ double dotprod(const double *a, const double *b, unsigned long long n) /* We should use a SLP reduction even without -ffast-math by using a VF of one. */ -/* { dg-final { scan-tree-dump "vectorizing stmts using SLP" "vect" } } */ +/* { dg-final { scan-tree-dump "vectorizing stmts using SLP" "vect" { xfail vect_variable_length } } } */ /* { dg-final { scan-tree-dump "vectorized 1 loops" "vect" } } */ -- cgit v1.1 From b9af08feac045565a7d3adfcd74e9478e4b33bd2 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Fri, 9 Apr 2021 13:43:19 +0100 Subject: testsuite: Expect more Livermore loops to be vectorised with SVE With SVE we can vectorise an additional loop. (Well, more really, since the count doesn't include epilogue loops for SVE.) gcc/testsuite/ * gfortran.dg/vect/vect-8.f90: Expect 24 loops to be vectorized with SVE. --- gcc/testsuite/gfortran.dg/vect/vect-8.f90 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gfortran.dg/vect/vect-8.f90 b/gcc/testsuite/gfortran.dg/vect/vect-8.f90 index b10c4fc..9994805 100644 --- a/gcc/testsuite/gfortran.dg/vect/vect-8.f90 +++ b/gcc/testsuite/gfortran.dg/vect/vect-8.f90 @@ -704,6 +704,7 @@ CALL track('KERNEL ') RETURN END SUBROUTINE kernel -! { dg-final { scan-tree-dump-times "vectorized 23 loops" 1 "vect" { target aarch64*-*-* } } } +! { dg-final { scan-tree-dump-times "vectorized 24 loops" 1 "vect" { target aarch64_sve } } } +! { dg-final { scan-tree-dump-times "vectorized 23 loops" 1 "vect" { target { aarch64*-*-* && { ! aarch64_sve } } } } } ! { dg-final { scan-tree-dump-times "vectorized 2\[23\] loops" 1 "vect" { target { vect_intdouble_cvt && { ! aarch64*-*-* } } } } } ! { dg-final { scan-tree-dump-times "vectorized 17 loops" 1 "vect" { target { { ! vect_intdouble_cvt } && { ! aarch64*-*-* } } } } } -- cgit v1.1 From 64a8135d44354be22a94859a9acc728206ec94e6 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Fri, 9 Apr 2021 13:43:19 +0100 Subject: testsuite: Remove bfloat_cpp_typecheck.C XFAILs These tests are passing on all my runs, and it looks like they are for Christophe's runs too. We can reapply with a tighter target selector if this is still a problem for some configurations. gcc/testsuite/ * g++.target/aarch64/bfloat_cpp_typecheck.C: Remove XFAILs. --- gcc/testsuite/g++.target/aarch64/bfloat_cpp_typecheck.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.target/aarch64/bfloat_cpp_typecheck.C b/gcc/testsuite/g++.target/aarch64/bfloat_cpp_typecheck.C index 9203d91..e112a38 100644 --- a/gcc/testsuite/g++.target/aarch64/bfloat_cpp_typecheck.C +++ b/gcc/testsuite/g++.target/aarch64/bfloat_cpp_typecheck.C @@ -7,8 +7,8 @@ void foo (void) { - bfloat16_t (); /* { dg-bogus {invalid conversion to type 'bfloat16_t'} "" { xfail *-*-* } } */ - bfloat16_t a = bfloat16_t(); /* { dg-bogus {invalid conversion to type 'bfloat16_t'} "" { xfail *-*-* } } */ + bfloat16_t (); /* { dg-bogus {invalid conversion to type 'bfloat16_t'} "" } */ + bfloat16_t a = bfloat16_t(); /* { dg-bogus {invalid conversion to type 'bfloat16_t'} "" } */ bfloat16_t (0x1234); /* { dg-error {invalid conversion to type 'bfloat16_t'} } */ bfloat16_t (0.1); /* { dg-error {invalid conversion to type 'bfloat16_t'} } */ } -- cgit v1.1 From 2dd7c570e67ce47702db4c5f776f02e0b35d7dd4 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Fri, 9 Apr 2021 13:43:20 +0100 Subject: testsuite: Guard gcc.target/aarch64/pr70398.c Not all hosts can link static executables. It depends on which development libraries are installed. gcc/testsuite/ * gcc.target/aarch64/pr70398.c: Require a target that can link static executables. --- gcc/testsuite/gcc.target/aarch64/pr70398.c | 1 + 1 file changed, 1 insertion(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/aarch64/pr70398.c b/gcc/testsuite/gcc.target/aarch64/pr70398.c index dbe5ad1..784a670 100644 --- a/gcc/testsuite/gcc.target/aarch64/pr70398.c +++ b/gcc/testsuite/gcc.target/aarch64/pr70398.c @@ -1,4 +1,5 @@ /* { dg-do run } */ +/* { dg-require-effective-target static } */ /* { dg-options "-O -fno-tree-loop-optimize -fno-tree-ter -static" } */ unsigned int in[8 * 8] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -- cgit v1.1 From 625dadaf5df5a2ae0d8c5660fd1eec8ba354479c Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Thu, 8 Apr 2021 14:39:28 -0400 Subject: c++: Fix two issues with auto function parameter [PR99806] When we have a member function with auto parameter like this: struct S { void f(auto); }; cp_parser_member_declaration -> grokfield produces a FUNCTION_DECL "void S::foo(auto:1)", and then finish_fully_implicit_template turns that FUNCTION_DECL into a TEMPLATE_DECL. The bug here is that we only call cp_parser_save_default_args for a FUNCTION_DECL. As a consequence, abbrev10.C is rejected because we complain that the default argument has not been defined, and abbrev11.C ICEs, because we don't re-parse the delayed noexcept, so the DEFERRED_PARSE tree leaks into tsubst* where we crash. This patch fixes both issues. gcc/cp/ChangeLog: PR c++/99806 * parser.c (cp_parser_member_declaration): Call cp_parser_save_default_args even for function templates. Use STRIP_TEMPLATE on the declaration we're passing. gcc/testsuite/ChangeLog: PR c++/99806 * g++.dg/concepts/abbrev10.C: New test. * g++.dg/concepts/abbrev11.C: New test. --- gcc/testsuite/g++.dg/concepts/abbrev10.C | 18 ++++++++++++++++++ gcc/testsuite/g++.dg/concepts/abbrev11.C | 10 ++++++++++ 2 files changed, 28 insertions(+) create mode 100644 gcc/testsuite/g++.dg/concepts/abbrev10.C create mode 100644 gcc/testsuite/g++.dg/concepts/abbrev11.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/concepts/abbrev10.C b/gcc/testsuite/g++.dg/concepts/abbrev10.C new file mode 100644 index 0000000..b611346 --- /dev/null +++ b/gcc/testsuite/g++.dg/concepts/abbrev10.C @@ -0,0 +1,18 @@ +// PR c++/99806 +// { dg-do compile { target c++14 } } +// { dg-additional-options "-fconcepts" } + +struct S { + void f(auto, auto, int = 3); + void f2(auto, auto, int = 3) { } + template static T g(T, auto, int = 3); +}; + +void +g () +{ + S::g(1, 2); + S s; + s.f(1, 2); + s.f2(1, 2); +} diff --git a/gcc/testsuite/g++.dg/concepts/abbrev11.C b/gcc/testsuite/g++.dg/concepts/abbrev11.C new file mode 100644 index 0000000..ddb4793 --- /dev/null +++ b/gcc/testsuite/g++.dg/concepts/abbrev11.C @@ -0,0 +1,10 @@ +// PR c++/99806 +// { dg-do compile { target c++14 } } +// { dg-additional-options "-fconcepts" } + +template concept C = requires (T a) { a.f(0); }; +struct S { + void f(auto) noexcept(B); + static constexpr bool B = true; +}; +static_assert(C, ""); -- cgit v1.1 From 00c3c31be43c018870569a599200a8af84956487 Mon Sep 17 00:00:00 2001 From: Patrick Palka Date: Fri, 9 Apr 2021 11:37:42 -0400 Subject: c++: Add testcase for already fixed PR [PR90215] We accept this testcase after r11-7985. gcc/testsuite/ChangeLog: PR c++/90215 * g++.dg/cpp1z/fold-lambda4.C: New test. --- gcc/testsuite/g++.dg/cpp1z/fold-lambda4.C | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1z/fold-lambda4.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp1z/fold-lambda4.C b/gcc/testsuite/g++.dg/cpp1z/fold-lambda4.C new file mode 100644 index 0000000..b8bae86 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/fold-lambda4.C @@ -0,0 +1,30 @@ +// PR c++/90215 +// { dg-do compile { target c++17 } } + +struct X +{ + template + void f(F f) + { + f(0); + } +}; + +template +void bug(Xs... xs) +{ + int i; + + [&](auto&... ys) + { + (xs.f([&](auto) + { + ys; + }), ...); + }(i); +} + +int main() +{ + bug(X{}); +} -- cgit v1.1 From b04093adb28bd6ee8b0390e840219fd2bba134db Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Fri, 9 Apr 2021 11:40:48 -0600 Subject: PR middle-end/55288 - Improve handling/suppression of maybe-uninitialized warnings gcc/testsuite/ChangeLog: PR middle-end/55288 * g++.dg/warn/uninit-pr55288.C: New test. --- gcc/testsuite/g++.dg/warn/uninit-pr55288.C | 43 ++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 gcc/testsuite/g++.dg/warn/uninit-pr55288.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/warn/uninit-pr55288.C b/gcc/testsuite/g++.dg/warn/uninit-pr55288.C new file mode 100644 index 0000000..12fbc56 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/uninit-pr55288.C @@ -0,0 +1,43 @@ +/* PR tree-optimization/55288 - Improve handling/suppression of + maybe-uninitialized warnings + { dg-do compile } + { dg-options "-O2 -Wall" } */ + +struct iterator +{ + operator int (); + iterator operator++ (int); +}; + +void bar (int); + +static void foo (int x) +{ + bar (x); // { dg-bogus "uninitialized" } +} + +int baz (iterator j, iterator end, int p) +{ + bool valid = false; + int q; + for (; j != end; j++) { + if (p > j) { + if (not valid) + p = j; + break; + } + else if (p == j) { + valid = true; + q = -1; + } + else { + valid = true; + q = j; + } + } + + if (valid) + foo (q); + + return p; +} -- cgit v1.1 From 3115aba8d856faadaab5c79bc4823a39ebc21bb2 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 10 Apr 2021 00:16:23 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 64 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d28b98b..8b339a8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,67 @@ +2021-04-09 Martin Sebor + + PR middle-end/55288 + * g++.dg/warn/uninit-pr55288.C: New test. + +2021-04-09 Patrick Palka + + PR c++/90215 + * g++.dg/cpp1z/fold-lambda4.C: New test. + +2021-04-09 Marek Polacek + + PR c++/99806 + * g++.dg/concepts/abbrev10.C: New test. + * g++.dg/concepts/abbrev11.C: New test. + +2021-04-09 Richard Sandiford + + * gcc.target/aarch64/pr70398.c: Require a target that can link + static executables. + +2021-04-09 Richard Sandiford + + * g++.target/aarch64/bfloat_cpp_typecheck.C: Remove XFAILs. + +2021-04-09 Richard Sandiford + + * gfortran.dg/vect/vect-8.f90: Expect 24 loops to be vectorized + with SVE. + +2021-04-09 Richard Sandiford + + * g++.dg/tree-ssa/pr83518.C: XFAIL for vect_variable_length. + * gcc.dg/pr96573.c: Likewise. + * gcc.dg/tree-ssa/pr84512.c: Likewise. + * gcc.dg/vect/bb-slp-43.c: Likewise. + * gcc.dg/vect/slp-reduc-11.c: Likewise. + +2021-04-09 Richard Sandiford + + * gcc.dg/vect/pr65947-7.c: Add a noipa attribute. Expect the + loop to vectorized if vect_fold_extract_last. + +2021-04-09 Richard Sandiford + + * gcc.target/aarch64/mem-shift-canonical.c: Use an asm instead + of relying on vectorisation. + +2021-04-09 Richard Sandiford + + PR target/87763 + * gcc.target/aarch64/insv_1.c: XFAIL two scan tests. + +2021-04-09 Richard Sandiford + + PR libfortran/78314 + * gfortran.dg/ieee/ieee_6.f90: Skip for arm* and aarch64*. + * gfortran.dg/ieee/ieee_8.f90: Likewise. + +2021-04-09 Tobias Burnus + + PR fortran/99817 + * gfortran.dg/coarray/dummy_2.f90: New test. + 2021-04-08 David Edelsohn * g++.dg/gomp/tls-5.C: Expect tbss failure on AIX. -- cgit v1.1 From e89055f90cff9fb6f565b9374e1ab74f805682fb Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 9 Apr 2021 16:43:50 -0400 Subject: c++: pack in base-specifier in lambda [PR100006] Normally cp_parser_base_clause prevents unexpanded packs, but in a lambda check_for_bare_parameter_packs allows it. Then we weren't finding the pack when scanning the lambda body. This doesn't fix a valid variant like template void sink (Ts&&...); template void f() { sink ([] { struct S : Ts { }; }...); } int main() { f(); } but that's a much bigger project. gcc/cp/ChangeLog: PR c++/100006 * pt.c (find_parameter_packs_r) [TAG_DEFN]: Look into bases. gcc/testsuite/ChangeLog: PR c++/100006 * g++.dg/cpp0x/lambda/lambda-variadic13.C: New test. --- gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic13.C | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic13.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic13.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic13.C new file mode 100644 index 0000000..ac4e631 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic13.C @@ -0,0 +1,11 @@ +// PR c++/100006 +// { dg-do compile { target c++14 } } + +template +void f() { + [] { struct S : Ts { }; }; // { dg-error "not expanded" } +} + +int main() { + f<>(); +} -- cgit v1.1 From 1a19d334ce493ec2ce2daeac74beef63fd67e2bc Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 9 Apr 2021 18:02:38 -0400 Subject: c++: deduction guide using alias [PR99180] alias_ctad_tweaks was expecting that all deduction guides for the class would be suitable for deduction from the alias definition; in this case, the deduction guide uses 'true' and the alias B uses 'false', so deduction fails. But that's OK, we just don't use that deduction guide. I also noticed that we were giving up on deduction entirely if substitution failed for some guide; we should only give up on that particular deduction guide. We ought to give a better diagnostic about this case when deduction fails, but that can wait. gcc/cp/ChangeLog: PR c++/99180 PR c++/93295 PR c++/93867 PR c++/99118 PR c++/96873 * pt.c (alias_ctad_tweaks): Handle failure better. gcc/testsuite/ChangeLog: PR c++/99180 PR c++/93295 PR c++/93867 PR c++/95486 * g++.dg/cpp2a/class-deduction-alias5.C: New test. * g++.dg/cpp2a/class-deduction-alias6.C: New test. * g++.dg/cpp2a/class-deduction-alias7.C: New test. * g++.dg/cpp2a/class-deduction-alias8.C: New test. --- .../g++.dg/cpp2a/class-deduction-alias5.C | 18 ++++++++++++ .../g++.dg/cpp2a/class-deduction-alias6.C | 11 ++++++++ .../g++.dg/cpp2a/class-deduction-alias7.C | 32 ++++++++++++++++++++++ .../g++.dg/cpp2a/class-deduction-alias8.C | 14 ++++++++++ 4 files changed, 75 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp2a/class-deduction-alias5.C create mode 100644 gcc/testsuite/g++.dg/cpp2a/class-deduction-alias6.C create mode 100644 gcc/testsuite/g++.dg/cpp2a/class-deduction-alias7.C create mode 100644 gcc/testsuite/g++.dg/cpp2a/class-deduction-alias8.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias5.C b/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias5.C new file mode 100644 index 0000000..69143a3 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias5.C @@ -0,0 +1,18 @@ +// PR c++/99180 +// { dg-do compile { target c++17 } } + +template +struct A { + A(Ts...) {} +}; + +template +using B = A; + +template +A(Ts...) -> A; + +int main() { + B{}; // { dg-error "alias" "" { target c++17_down } } + return 0; +} diff --git a/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias6.C b/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias6.C new file mode 100644 index 0000000..26a38641 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias6.C @@ -0,0 +1,11 @@ +// PR c++/93295 +// { dg-do compile { target c++20 } } + +template +struct Foo { + Foo(T) {} +}; + +template Foo(T) -> Foo; +template using Bar = Foo; +Bar b{0}; diff --git a/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias7.C b/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias7.C new file mode 100644 index 0000000..0d8bff7 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias7.C @@ -0,0 +1,32 @@ +// PR c++/93867 +// { dg-do compile { target c++20 } } + +template +struct basic_fixed_string +{ + constexpr basic_fixed_string(const CharT *p) { + for (int i = 0; i < N; ++i) { + m_data[i] = p[i]; + } + } + + CharT m_data[N] {}; +}; + +template +basic_fixed_string(const CharT (&)[N]) -> basic_fixed_string; + +template +using fixed_string = basic_fixed_string; + +template +constexpr int foo() +{ + return 42; +} + +int main(int argc, char const *argv[]) +{ + foo<"hello">(); + return 0; +} diff --git a/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias8.C b/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias8.C new file mode 100644 index 0000000..ec005956 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias8.C @@ -0,0 +1,14 @@ +// PR c++/95486 +// { dg-do compile { target c++20 } } + +template +struct X { X(U) requires __is_same(U, int) {} }; + +template +X(U) -> X; + +template +using Y = X; + +Y y{1}; +Y z{'a'}; // { dg-error "failed|no match" } -- cgit v1.1 From 7a493fcd27d6a1af896c4f5ef4ab1e0afe8a839d Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Sat, 10 Apr 2021 12:46:09 +0200 Subject: rtlanal: Another fix for VOIDmode MEMs [PR98601] This is a sequel to the PR85022 changes, inline-asm can (unfortunately) introduce VOIDmode MEMs and in PR85022 they have been changed so that we don't pretend we know their size (as opposed to assuming they have zero size). This time we ICE in rtx_addr_can_trap_p_1 because it assumes that all memory but BLKmode has known size. The patch just treats VOIDmode MEMs like BLKmode in that regard. And, the STRICT_ALIGNMENT change is needed because VOIDmode has GET_MODE_SIZE of 0 and we don't want to check if something is a multiple of 0. 2021-04-10 Jakub Jelinek PR rtl-optimization/98601 * rtlanal.c (rtx_addr_can_trap_p_1): Allow in assert unknown size not just for BLKmode, but also for VOIDmode. For STRICT_ALIGNMENT unaligned_mems handle VOIDmode like BLKmode. * gcc.dg/torture/pr98601.c: New test. --- gcc/testsuite/gcc.dg/torture/pr98601.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/torture/pr98601.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/torture/pr98601.c b/gcc/testsuite/gcc.dg/torture/pr98601.c new file mode 100644 index 0000000..ee9d076 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr98601.c @@ -0,0 +1,14 @@ +/* PR rtl-optimization/98601 */ +/* { dg-do compile } */ + +void +foo (void *p) +{ + asm ("" : "=m" (*p)); /* { dg-warning "dereferencing 'void \\*' pointer" } */ +} + +void +bar (void *p) +{ + asm volatile ("" : : "m" (*p)); /* { dg-warning "dereferencing 'void \\*' pointer" } */ +} -- cgit v1.1 From 22aede7a1228617661105048a91fddd8797e141b Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Sat, 10 Apr 2021 12:49:01 +0200 Subject: expand: Fix up LTO ICE with COMPOUND_LITERAL_EXPR [PR99849] The gimplifier optimizes away COMPOUND_LITERAL_EXPRs, but they can remain in the form of ADDR_EXPR of COMPOUND_LITERAL_EXPRs in static initializers. By the TREE_STATIC check I meant to check that the underlying decl of the compound literal is a global rather than automatic variable which obviously can't be referenced in static initializers, but unfortunately with LTO it might end up in another partition and thus be DECL_EXTERNAL instead. 2021-04-10 Jakub Jelinek PR lto/99849 * expr.c (expand_expr_addr_expr_1): Test is_global_var rather than just TREE_STATIC on COMPOUND_LITERAL_EXPR_DECLs. * gcc.dg/lto/pr99849_0.c: New test. --- gcc/testsuite/gcc.dg/lto/pr99849_0.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/lto/pr99849_0.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/lto/pr99849_0.c b/gcc/testsuite/gcc.dg/lto/pr99849_0.c new file mode 100644 index 0000000..d489cee --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr99849_0.c @@ -0,0 +1,23 @@ +/* PR lto/99849 */ +/* { dg-lto-do link } */ +/* { dg-require-effective-target fpic } */ +/* { dg-require-effective-target shared } */ +/* { dg-extra-ld-options { -shared } } */ +/* { dg-lto-options { { -flto -flto-partition=1to1 -O2 -Wno-incompatible-pointer-types -Wno-discarded-qualifiers -fPIC } } } */ + +struct { struct A *a; } *b; +struct B { int *b; }; +struct C { int *c; }; +const struct D { struct C d; } d; +struct A { struct { struct C e; }; }; +struct E { void *e; } e = { &( &(const struct D) { (void *) &d })->d }; +struct C f = { &( &(const struct D) { (void *) &d })->d }; +struct A g[] = { &e, &f }; +void foo () { b->a = g; } +struct E h = { foo }; +void bar (); +int baz () { bar (h); } +struct B i = { (int *) baz }; +void qux (); +void corge () { qux (i); } +void *j __attribute__((__used__)) = corge; -- cgit v1.1 From 71958f740f1b8c47a86ea222418abee395d254a0 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Fri, 9 Apr 2021 11:44:32 -0700 Subject: x86: Define _serialize as macro Define _serialize as macro for callers with general-regs-only target attribute to avoid inline failure with always_inline attribute. gcc/ PR target/99744 * config/i386/serializeintrin.h (_serialize): Defined as macro. gcc/testsuite/ PR target/99744 * gcc.target/i386/pr99744-2.c: New test. --- gcc/testsuite/gcc.target/i386/pr99744-2.c | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr99744-2.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/i386/pr99744-2.c b/gcc/testsuite/gcc.target/i386/pr99744-2.c new file mode 100644 index 0000000..9cbefb0 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr99744-2.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mserialize" } */ + +#include + +__attribute__ ((target("general-regs-only"))) +void +foo1 (void) +{ + _serialize (); +} -- cgit v1.1 From 0344b5b822b310921a432b9ffcb9ea0b3964820d Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Thu, 8 Apr 2021 20:24:07 +0200 Subject: d: Merge upstream dmd 0450061c8 D front-end changes: - Fix ICE in forward referenced type members of structs. - Fix ICE passing a member template mixin identifier as alias argument. - Fix ICE when `__traits' prints error involving a Parameter. - Fix bugs found in `__traits(allMembers)' returning wrong result. - Detect and shortcut Alias and AliasSeq template patterns. Reviewed-on: https://github.com/dlang/dmd/pull/12405 https://github.com/dlang/dmd/pull/12411 gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 0450061c8. --- .../gdc.test/compilable/imports/pkg16044/package.d | 4 ++ .../compilable/imports/pkg16044/sub/package.d | 4 ++ gcc/testsuite/gdc.test/compilable/issue16044.d | 9 +++++ gcc/testsuite/gdc.test/compilable/issue20915.d | 10 +++++ gcc/testsuite/gdc.test/compilable/issue21813a.d | 13 ++++++ gcc/testsuite/gdc.test/compilable/issue21813b.d | 13 ++++++ gcc/testsuite/gdc.test/compilable/test19145.d | 14 +++++++ gcc/testsuite/gdc.test/compilable/test20894.d | 46 ++++++++++++++++++++++ gcc/testsuite/gdc.test/compilable/test21812.d | 10 +++++ .../gdc.test/fail_compilation/diag19196.d | 16 ++++++++ .../gdc.test/fail_compilation/test16228.d | 17 ++++++-- .../gdc.test/fail_compilation/test20919.d | 13 ++++++ 12 files changed, 166 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gdc.test/compilable/imports/pkg16044/package.d create mode 100644 gcc/testsuite/gdc.test/compilable/imports/pkg16044/sub/package.d create mode 100644 gcc/testsuite/gdc.test/compilable/issue16044.d create mode 100644 gcc/testsuite/gdc.test/compilable/issue20915.d create mode 100644 gcc/testsuite/gdc.test/compilable/issue21813a.d create mode 100644 gcc/testsuite/gdc.test/compilable/issue21813b.d create mode 100644 gcc/testsuite/gdc.test/compilable/test19145.d create mode 100644 gcc/testsuite/gdc.test/compilable/test20894.d create mode 100644 gcc/testsuite/gdc.test/compilable/test21812.d create mode 100644 gcc/testsuite/gdc.test/fail_compilation/diag19196.d create mode 100644 gcc/testsuite/gdc.test/fail_compilation/test20919.d (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gdc.test/compilable/imports/pkg16044/package.d b/gcc/testsuite/gdc.test/compilable/imports/pkg16044/package.d new file mode 100644 index 0000000..a517957 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/imports/pkg16044/package.d @@ -0,0 +1,4 @@ +module pkg16044; + +int test1; +int test2; diff --git a/gcc/testsuite/gdc.test/compilable/imports/pkg16044/sub/package.d b/gcc/testsuite/gdc.test/compilable/imports/pkg16044/sub/package.d new file mode 100644 index 0000000..4c96e12 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/imports/pkg16044/sub/package.d @@ -0,0 +1,4 @@ +module pkg16044.sub; + +int test3; +int test4; diff --git a/gcc/testsuite/gdc.test/compilable/issue16044.d b/gcc/testsuite/gdc.test/compilable/issue16044.d new file mode 100644 index 0000000..e959e2e --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/issue16044.d @@ -0,0 +1,9 @@ +// REQUIRED_ARGS: -Icompilable/imports +// EXTRA_FILES: imports/pkg16044/package.d imports/pkg16044/sub/package.d +module issue16044; // https://issues.dlang.org/show_bug.cgi?id=16044 + +import pkg16044; +import pkg16044.sub; + +static assert([__traits(allMembers, pkg16044)] == ["object", "test1", "test2"]); +static assert([__traits(allMembers, pkg16044.sub)] == ["object", "test3", "test4"]); diff --git a/gcc/testsuite/gdc.test/compilable/issue20915.d b/gcc/testsuite/gdc.test/compilable/issue20915.d new file mode 100644 index 0000000..dd8b7b5 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/issue20915.d @@ -0,0 +1,10 @@ +module issue20915; + +// prior to the PR adding this test case, +// locally defined version and debug idents were included. +version = illegal; +debug = illegal; + +alias Seq(T...) = T; + +static assert (__traits(allMembers, issue20915) == Seq!("object", "Seq")); diff --git a/gcc/testsuite/gdc.test/compilable/issue21813a.d b/gcc/testsuite/gdc.test/compilable/issue21813a.d new file mode 100644 index 0000000..f07b47a --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/issue21813a.d @@ -0,0 +1,13 @@ +// https://issues.dlang.org/show_bug.cgi?id=21813 +Target.OS defaultTargetOS() +{ + return Target.OS.linux; +} + +struct Target +{ + enum OS { linux } + OS os = defaultTargetOS(); + void deinitialize() { this = this.init; } + @property isPOSIX() scope @nogc { } +} diff --git a/gcc/testsuite/gdc.test/compilable/issue21813b.d b/gcc/testsuite/gdc.test/compilable/issue21813b.d new file mode 100644 index 0000000..ef22697 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/issue21813b.d @@ -0,0 +1,13 @@ +// https://issues.dlang.org/show_bug.cgi?id=21813 +Target.OS defaultTargetOS() +{ + return Target.OS.linux; +} + +struct Target +{ + enum OS { linux } + OS os = defaultTargetOS(); + @property isPOSIX() scope @nogc { } +} + diff --git a/gcc/testsuite/gdc.test/compilable/test19145.d b/gcc/testsuite/gdc.test/compilable/test19145.d new file mode 100644 index 0000000..ef5faa8 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test19145.d @@ -0,0 +1,14 @@ +// https://issues.dlang.org/show_bug.cgi?id=19415 + +struct S +{ + int x; + S foo() return { return S(x); } + this(this) @disable; +} + +S bar() +{ + S s; + return s; // Error: struct `S` is not copyable because it is annotated with @disable +} diff --git a/gcc/testsuite/gdc.test/compilable/test20894.d b/gcc/testsuite/gdc.test/compilable/test20894.d new file mode 100644 index 0000000..e8dad45 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test20894.d @@ -0,0 +1,46 @@ +// https://issues.dlang.org/show_bug.cgi?id=20894 + +mixin template MT() +{ + int a; + alias b = char; + void c() {} +} + +struct S +{ + mixin MT mt; +} + +void main() +{ + auto r = S(); + enum c = S(); + + foo!(S.mt); + foo!(r.mt); + foo!(c.mt); // OK <- ICE + + foo!(mixin("S.mt")); + foo!(mixin("r.mt")); // OK <- ICE + foo!(mixin("c.mt")); // OK <- ICE + + // some checks + foo!(r.mt, c.mt); + foo!(mixin("r.mt"), c.mt); + foo!(r.mt, mixin("c.mt")); + foo!(S.mt, mixin("c.mt")); +} + +alias Tup(T...) = T; + +void foo(A...)() +{ + static if (A.length == 2) + { + static assert(__traits(isSame, A[0], A[1])); + enum members = __traits(allMembers, A[0]); + static assert(members == __traits(allMembers, A[1])); + static assert(members == Tup!("a", "b", "c")); + } +} diff --git a/gcc/testsuite/gdc.test/compilable/test21812.d b/gcc/testsuite/gdc.test/compilable/test21812.d new file mode 100644 index 0000000..9cf33f5 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test21812.d @@ -0,0 +1,10 @@ +// https://issues.dlang.org/show_bug.cgi?id=21812 + +struct S(A...) +{ + A args; +} + +static assert(__traits(allMembers, S!(int, float)) == AliasSeq!("args")); + +alias AliasSeq(T...) = T; diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag19196.d b/gcc/testsuite/gdc.test/fail_compilation/diag19196.d new file mode 100644 index 0000000..857f9a4 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/diag19196.d @@ -0,0 +1,16 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/diag19196.d(11): Error: unable to determine fields of `B` because of forward references +fail_compilation/diag19196.d(15): Error: template instance `diag19196.Foo!(B)` error instantiating +--- +*/ +module diag19196; +struct Foo(T) +{ + alias F = typeof(T.tupleof); +} +struct B +{ + Foo!B b; +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/test16228.d b/gcc/testsuite/gdc.test/fail_compilation/test16228.d index 6aa79a2..63951e6 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test16228.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test16228.d @@ -1,13 +1,13 @@ /* REQUIRED_ARGS: -dip25 TEST_OUTPUT: --- -fail_compilation/test16228.d(22): Error: function type 'return int()' has 'return' but does not return any indirections -fail_compilation/test16228.d(23): Error: function test16228.S.foo static member has no 'this' to which 'return' can apply +fail_compilation/test16228.d(23): Error: function `test16228.S.bar` `static` member has no `this` to which `return` can apply --- */ + // https://issues.dlang.org/show_bug.cgi?id=16228 int* wrap ( return ref int input ) @@ -20,5 +20,16 @@ struct S int x; int foo() return { return 3; } - static ref int foo() return { return x; } + static ref int bar() return { return x; } +} + + +// https://issues.dlang.org/show_bug.cgi?id=18963 + +T Identity(T)(return T t) { return t; } + +void bar(int i, void* p) +{ + Identity(p); + Identity(i); } diff --git a/gcc/testsuite/gdc.test/fail_compilation/test20919.d b/gcc/testsuite/gdc.test/fail_compilation/test20919.d new file mode 100644 index 0000000..2f1bad1 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/test20919.d @@ -0,0 +1,13 @@ +/* TEST_OUTPUT: +--- +fail_compilation/test20919.d(12): Error: `__traits(getAttributes, int a)` does not give a valid type +--- +*/ +// https://issues.dlang.org/show_bug.cgi?id=20919 + +void foo(int a) {} + +static if (is(typeof(foo) params == __parameters)) +{ + __traits(getAttributes, params) a; +} -- cgit v1.1 From 9f7d77bd6d65aa1cf2e195d3776052705c6e636b Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Sat, 10 Apr 2021 17:01:54 +0200 Subject: c: Avoid clobbering TREE_TYPE (error_mark_node) [PR99990] The following testcase ICEs during error recovery, because finish_decl overwrites TREE_TYPE (error_mark_node), which better should stay always to be error_mark_node. 2021-04-10 Jakub Jelinek PR c/99990 * c-decl.c (finish_decl): Don't overwrite TREE_TYPE of error_mark_node. * gcc.dg/pr99990.c: New test. --- gcc/testsuite/gcc.dg/pr99990.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr99990.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/pr99990.c b/gcc/testsuite/gcc.dg/pr99990.c new file mode 100644 index 0000000..6878b00 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr99990.c @@ -0,0 +1,12 @@ +/* PR c/99990 */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +#include + +void +foo () +{ + va_arg (0, long); /* { dg-error "first argument to 'va_arg' not of type 'va_list'" } */ + void *b[] = 0; /* { dg-error "invalid initializer" } */ +} -- cgit v1.1 From ec633d3777bd71f7bde5e671b61ec18e5b7b43ea Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Sat, 10 Apr 2021 16:23:23 -0400 Subject: analyzer: fix ICE on assignment from STRING_CST when building path [PR100011] gcc/analyzer/ChangeLog: PR analyzer/100011 * region-model.cc (region_model::on_assignment): Avoid NULL dereference if ctxt is NULL when assigning from a STRING_CST. gcc/testsuite/ChangeLog: PR analyzer/100011 * gcc.dg/analyzer/pr100011.c: New test. --- gcc/testsuite/gcc.dg/analyzer/pr100011.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/analyzer/pr100011.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/analyzer/pr100011.c b/gcc/testsuite/gcc.dg/analyzer/pr100011.c new file mode 100644 index 0000000..228cfdf --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/pr100011.c @@ -0,0 +1,16 @@ +/* { dg-require-effective-target signal } */ + +#include +#include + +void terminate(int sig) +{ + char buf[64] = { 0 }; + exit(1); /* { dg-warning "call to 'exit' from within signal handler" } */ +} + +int main(int argc, char **argv) +{ + signal(0, terminate); /* { dg-message "registering 'terminate' as signal handler" } */ + return 0; +} -- cgit v1.1 From 82198676c80764ca7cf05f891afaee83b9179dd1 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Sat, 10 Apr 2021 10:55:58 -0400 Subject: c++: ICE with invalid use of 'this' with static memfn [PR98800] Here instantiation of the fake 'this' parameter we used when parsing the trailing return type of func() was failing because there is no actual 'this' parameter in the instantiation. For PR97399 I told Patrick to do the 'this' injection even for statics, but now I think I was wrong; the out-of-class definition case I was concerned about does not break with this patch. And we don't set current_class_ptr in the body of a static member function. And the OMP code should continue to parse 'this' and complain about it rather than give a syntax error. gcc/cp/ChangeLog: PR c++/98800 PR c++/97399 * parser.c (cp_parser_direct_declarator): Don't inject_this_parameter if static_p. (cp_parser_omp_var_list_no_open): Parse 'this' even if current_class_ptr isn't set for a better diagnostic. gcc/testsuite/ChangeLog: PR c++/98800 * g++.dg/gomp/this-1.C: Adjust diagnostic. * g++.dg/cpp0x/constexpr-this1.C: New test. --- gcc/testsuite/g++.dg/cpp0x/constexpr-this1.C | 10 ++++++++++ gcc/testsuite/g++.dg/gomp/this-1.C | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-this1.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-this1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-this1.C new file mode 100644 index 0000000..e50218d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-this1.C @@ -0,0 +1,10 @@ +// PR c++/98800 +// { dg-do compile { target c++11 } } + +template struct enable_if_t {}; +struct tmp { + template constexpr bool is_integral(); + template static auto func() -> enable_if_t()>; // { dg-error "without object" } +}; +template constexpr bool tmp::is_integral() { return true; } +int main() { tmp::func(); } // { dg-error "no match" } diff --git a/gcc/testsuite/g++.dg/gomp/this-1.C b/gcc/testsuite/g++.dg/gomp/this-1.C index 30ab8b3..e7bd583 100644 --- a/gcc/testsuite/g++.dg/gomp/this-1.C +++ b/gcc/testsuite/g++.dg/gomp/this-1.C @@ -3,7 +3,7 @@ struct S { - #pragma omp declare simd linear(this) // { dg-error "is not a function argument" } + #pragma omp declare simd linear(this) // { dg-error "invalid use of .this" } static void foo (); void bar (); }; @@ -35,7 +35,7 @@ S::bar () template struct T { - #pragma omp declare simd linear(this) // { dg-error "is not a function argument" } + #pragma omp declare simd linear(this) // { dg-error "invalid use of .this" } static void foo (); void bar (); }; -- cgit v1.1 From 1d54b13841774aa40f5d0a5ab87b19e7e1276d42 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sun, 11 Apr 2021 00:16:24 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8b339a8..a994245 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,50 @@ +2021-04-10 Jason Merrill + + PR c++/98800 + * g++.dg/gomp/this-1.C: Adjust diagnostic. + * g++.dg/cpp0x/constexpr-this1.C: New test. + +2021-04-10 David Malcolm + + PR analyzer/100011 + * gcc.dg/analyzer/pr100011.c: New test. + +2021-04-10 Jakub Jelinek + + PR c/99990 + * gcc.dg/pr99990.c: New test. + +2021-04-10 H.J. Lu + + PR target/99744 + * gcc.target/i386/pr99744-2.c: New test. + +2021-04-10 Jakub Jelinek + + PR lto/99849 + * gcc.dg/lto/pr99849_0.c: New test. + +2021-04-10 Jakub Jelinek + + PR rtl-optimization/98601 + * gcc.dg/torture/pr98601.c: New test. + +2021-04-10 Jason Merrill + + PR c++/99180 + PR c++/93295 + PR c++/93867 + PR c++/95486 + * g++.dg/cpp2a/class-deduction-alias5.C: New test. + * g++.dg/cpp2a/class-deduction-alias6.C: New test. + * g++.dg/cpp2a/class-deduction-alias7.C: New test. + * g++.dg/cpp2a/class-deduction-alias8.C: New test. + +2021-04-10 Jason Merrill + + PR c++/100006 + * g++.dg/cpp0x/lambda/lambda-variadic13.C: New test. + 2021-04-09 Martin Sebor PR middle-end/55288 -- cgit v1.1 From 936d500dfc17f58f2507ecd0f7f26e4f197052ee Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Sat, 10 Apr 2021 14:00:15 -0400 Subject: c++: ICE with anonymous union [PR97974] Here lookup got confused by finding a conversion operator from lookup_anon_field. Let's avoid this by pruning functions from CLASSTYPE_MEMBER_VEC as well as TYPE_FIELDS. gcc/cp/ChangeLog: PR c++/97974 * decl.c (fixup_anonymous_aggr): Prune all functions from CLASSTYPE_MEMBER_VEC. gcc/testsuite/ChangeLog: PR c++/97974 * g++.dg/lookup/pr84962.C: Adjust diagnostic. * g++.dg/other/anon-union5.C: New test. --- gcc/testsuite/g++.dg/lookup/pr84962.C | 2 +- gcc/testsuite/g++.dg/other/anon-union5.C | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/other/anon-union5.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/lookup/pr84962.C b/gcc/testsuite/g++.dg/lookup/pr84962.C index b9b7a31..c22b95c 100644 --- a/gcc/testsuite/g++.dg/lookup/pr84962.C +++ b/gcc/testsuite/g++.dg/lookup/pr84962.C @@ -9,6 +9,6 @@ struct X { // { dg-error "public non-static data member" "" { target *-*-* } .-1 } }; - int : a; // { dg-error "non-integral" } + int : a; // { dg-error "" } }; diff --git a/gcc/testsuite/g++.dg/other/anon-union5.C b/gcc/testsuite/g++.dg/other/anon-union5.C new file mode 100644 index 0000000..616dea8 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/anon-union5.C @@ -0,0 +1,9 @@ +// PR c++/97974 + +struct A { + union { + operator int (); // { dg-error "anonymous union" } + int a; + }; + operator int; // { dg-error "" } +}; -- cgit v1.1 From ac200799acb5cd2fb9e1758f6bf5fff1978daaeb Mon Sep 17 00:00:00 2001 From: Hafiz Abid Qadeer Date: Thu, 8 Apr 2021 17:31:30 +0100 Subject: [OpenACC] Fix an ICE where a loop with GT condition is collapsed. We have seen an ICE both on trunk and devel/omp/gcc-10 branches which can be reprodued with this simple testcase. It occurs if an OpenACC loop has a collapse clause and any of the loop being collapsed uses GT or GE condition. This issue is specific to OpenACC. int main (void) { int ix, iy; int dim_x = 16, dim_y = 16; { for (iy = dim_y - 1; iy > 0; --iy) for (ix = dim_x - 1; ix > 0; --ix) ; } } The problem is caused by a failing assertion in expand_oacc_collapse_init. It checks that cond_code for fd->loop should be same as cond_code for all the loops that are being collapsed. As the cond_code for fd->loop is LT_EXPR with collapse clause (set at the end of omp_extract_for_data), this assertion forces that all the loop in collapse clause should use < operator. There does not seem to be anything in the code which demands this condition as loop with > condition works ok otherwise. I digged old mailing list a bit but could not find any discussion on this change. Looking at the code, expand_oacc_for checks that fd->loop->cond_code is either LT_EXPR or GT_EXPR. I guess the original intention was to have similar checks on the loop which are being collapsed. But the way check was written does not acheive that. I have fixed it by modifying the check in the assertion to be same as check on fd->loop->cond_code. I tested goacc and libgomp (with nvptx offloading) and did not see any regression. I have added new tests to check collapse with GT/GE condition. PR middle-end/98088 gcc/ * omp-expand.c (expand_oacc_collapse_init): Update condition in a gcc_assert. gcc/testsuite/ * c-c++-common/goacc/collapse-2.c: New. libgomp/ * testsuite/libgomp.oacc-c-c++-common/collapse-2.c: Add check for loop with GT/GE condition. * testsuite/libgomp.oacc-c-c++-common/collapse-3.c: Likewise. --- gcc/testsuite/c-c++-common/goacc/collapse-2.c | 56 +++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 gcc/testsuite/c-c++-common/goacc/collapse-2.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/c-c++-common/goacc/collapse-2.c b/gcc/testsuite/c-c++-common/goacc/collapse-2.c new file mode 100644 index 0000000..e46028c --- /dev/null +++ b/gcc/testsuite/c-c++-common/goacc/collapse-2.c @@ -0,0 +1,56 @@ +/* Test for ICE as reported in PR98088. */ + +int i, j; + +void +f1 (void) +{ + #pragma acc parallel + #pragma acc loop collapse (2) + for (i = 5; i > 5; i--) + for (j = 5; j > 0; j--) + ; +} + +void +f2 (void) +{ + #pragma acc parallel + #pragma acc loop collapse (2) + for (i = 0; i < 5; i++) + for (j = 5; j > 0; j--) + ; +} + +void +f3 (void) +{ + #pragma acc parallel + #pragma acc loop collapse (2) + for (i = 5; i >= 0; i--) + for (j = 5; j >= 0; j--) + ; +} + +void f4 () +{ + #pragma acc parallel loop tile(2, 3) + for (int i = 0; i > 8; i++) + for (int j = 0; j > 8; j++); +} + +void f5 () +{ + #pragma acc parallel loop tile(2, 3) + for (int i = 0; i > 8; i++) + for (long j = 0; j > 8; j++); +} + +void +f6 (int a[32][32]) +{ + #pragma acc parallel loop collapse(2) + for (int i = 16; i > 8; i--) + for (int j = 16; j > 8; j--) + a[i][j] = i + j; +} -- cgit v1.1 From a0ecde220da1edf7062ec429aa2c7a5b4103e92f Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 12 Apr 2021 00:16:27 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a994245..646e092 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2021-04-11 Hafiz Abid Qadeer + + PR middle-end/98088 + * c-c++-common/goacc/collapse-2.c: New. + +2021-04-11 Jason Merrill + + PR c++/97974 + * g++.dg/lookup/pr84962.C: Adjust diagnostic. + * g++.dg/other/anon-union5.C: New test. + 2021-04-10 Jason Merrill PR c++/98800 -- cgit v1.1 From c02c39fad02c386f6e687e28282973f580fc95ac Mon Sep 17 00:00:00 2001 From: "Cui,Lili" Date: Mon, 12 Apr 2021 09:59:25 +0800 Subject: Add rocketlake to gcc. gcc/ * common/config/i386/cpuinfo.h (get_intel_cpu): Handle rocketlake. * common/config/i386/i386-common.c (processor_names): Add rocketlake. (processor_alias_table): Add rocketlake. * common/config/i386/i386-cpuinfo.h (processor_subtypes): Add INTEL_COREI7_ROCKETLAKE. * config.gcc: Add -march=rocketlake. * config/i386/i386-c.c (ix86_target_macros_internal): Handle rocketlake. * config/i386/i386-options.c (m_ROCKETLAKE) : Define. (processor_cost_table): Add rocketlake cost. * config/i386/i386.h (ix86_size_cost) : Define TARGET_ROCKETLAKE. (processor_type) : Add PROCESSOR_ROCKETLAKE. (PTA_ROCKETLAKE): Ditto. * doc/extend.texi: Add rocketlake. * doc/invoke.texi: Add rocketlake. gcc/testsuite/ * gcc.target/i386/funcspec-56.inc: Handle new march. * g++.target/i386/mv16.C: Handle new march --- gcc/testsuite/g++.target/i386/mv16.C | 6 ++++++ gcc/testsuite/gcc.target/i386/funcspec-56.inc | 1 + 2 files changed, 7 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.target/i386/mv16.C b/gcc/testsuite/g++.target/i386/mv16.C index 9b29a1a..6839287 100644 --- a/gcc/testsuite/g++.target/i386/mv16.C +++ b/gcc/testsuite/g++.target/i386/mv16.C @@ -88,6 +88,10 @@ int __attribute__ ((target("arch=alderlake"))) foo () { return 23; } +int __attribute__ ((target("arch=rocketlake"))) foo () { + return 24; +} + int main () { int val = foo (); @@ -124,6 +128,8 @@ int main () assert (val == 22); else if (__builtin_cpu_is ("alderlake")) assert (val == 23); + else if (__builtin_cpu_is ("rocketlake")) + assert (val == 24); else assert (val == 0); diff --git a/gcc/testsuite/gcc.target/i386/funcspec-56.inc b/gcc/testsuite/gcc.target/i386/funcspec-56.inc index 5d4800f..79265c7 100644 --- a/gcc/testsuite/gcc.target/i386/funcspec-56.inc +++ b/gcc/testsuite/gcc.target/i386/funcspec-56.inc @@ -181,6 +181,7 @@ extern void test_arch_tigerlake (void) __attribute__((__target__("arch= extern void test_arch_cooperlake (void) __attribute__((__target__("arch=cooperlake"))); extern void test_arch_sapphirerapids (void) __attribute__((__target__("arch=sapphirerapids"))); extern void test_arch_alderlake (void) __attribute__((__target__("arch=alderlake"))); +extern void test_arch_rocketlake (void) __attribute__((__target__("arch=rocketlake"))); extern void test_arch_k8 (void) __attribute__((__target__("arch=k8"))); extern void test_arch_k8_sse3 (void) __attribute__((__target__("arch=k8-sse3"))); extern void test_arch_opteron (void) __attribute__((__target__("arch=opteron"))); -- cgit v1.1 From 598359f627dec765eb74e31d9e96901a68bbfb97 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Mon, 12 Apr 2021 10:49:41 +0200 Subject: ASAN: do not unpoison in OpenMP context gcc/ChangeLog: PR sanitizer/99877 * gimplify.c (gimplify_expr): Right now, we unpoison all variables before a goto . We should not do it if we are in a omp context. gcc/testsuite/ChangeLog: PR sanitizer/99877 * g++.dg/asan/pr99877.C: New test. --- gcc/testsuite/g++.dg/asan/pr99877.C | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 gcc/testsuite/g++.dg/asan/pr99877.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/asan/pr99877.C b/gcc/testsuite/g++.dg/asan/pr99877.C new file mode 100644 index 0000000..95a8641 --- /dev/null +++ b/gcc/testsuite/g++.dg/asan/pr99877.C @@ -0,0 +1,19 @@ +/* PR sanitizer/99877*/ +/* { dg-options "-fsanitize=address -fopenmp -O2" } */ + +struct vector +{ + int size (); +}; +int +main () +{ + vector outqueue; +#pragma omp parallel + { + goto continueloop; + continueloop:; + } + for (; outqueue.size ();) + ; +} -- cgit v1.1 From 84081e2c6bd43a6790f751755865cf4227adac7c Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Sat, 10 Apr 2021 02:10:32 -0400 Subject: c++: premature overload resolution [PR93085] We can't resolve the call to foo<42> before instantiation of G, because the template parameter of #1 has dependent type. But we were missing that in our dependency check, because the tree walk of DECL_TEMPLATE_PARMS doesn't look into the types of template parameters. So look at them directly. gcc/cp/ChangeLog: PR c++/93085 * pt.c (uses_outer_template_parms): Handle non-type and template template parameters specifically. gcc/testsuite/ChangeLog: PR c++/93085 * g++.dg/template/dependent-tmpl1.C: New test. --- gcc/testsuite/g++.dg/template/dependent-tmpl1.C | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 gcc/testsuite/g++.dg/template/dependent-tmpl1.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/template/dependent-tmpl1.C b/gcc/testsuite/g++.dg/template/dependent-tmpl1.C new file mode 100644 index 0000000..7b800b6 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/dependent-tmpl1.C @@ -0,0 +1,9 @@ +// PR c++/93085 +// { dg-do compile { target c++11 } } + +template +struct G { + template static int foo(); // #1 + template static int foo(); // #2 + int x = foo<42>(); // OK +}; -- cgit v1.1 From 9c1c8ad8339d551ac91a7af5614f29b9a687189a Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 13 Apr 2021 01:00:48 +0200 Subject: combine: Don't fold away side-effects in simplify_and_const_int_1 [PR99830] Here is an alternate patch for the PR99830 bug. As discussed on IRC and in the PR, the reason why a (clobber:TI (const_int 0)) has been propagated into the debug insns is that it got optimized away during simplification from the i3 instruction pattern. And that happened because simplify_and_const_int_1 (SImode, varop, 255) with varop of (ashift:SI (subreg:SI (and:TI (clobber:TI (const_int 0 [0])) (const_int 255 [0xff])) 0) (const_int 16 [0x10])) was called and through nonzero_bits determined that (whatever << 16) & 255 is const0_rtx. It is, but if there are side-effects in varop and such clobbers are considered as such, we shouldn't optimize those away. 2021-04-13 Jakub Jelinek PR debug/99830 * combine.c (simplify_and_const_int_1): Don't optimize varop away if it has side-effects. * gcc.dg/pr99830.c: New test. --- gcc/testsuite/gcc.dg/pr99830.c | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr99830.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/pr99830.c b/gcc/testsuite/gcc.dg/pr99830.c new file mode 100644 index 0000000..75226f5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr99830.c @@ -0,0 +1,10 @@ +/* PR debug/99830 */ +/* { dg-do compile { target int128 } } */ +/* { dg-options "-O2 -fno-expensive-optimizations -fno-split-wide-types -g" } */ + +int foo (long a, __int128 b, short c, int d, unsigned e, __int128 f) +{ + __builtin_memmove (2 + (char *) &f, foo, 1); + c >>= (char) f; + return c; +} -- cgit v1.1 From ffc4155b6e45b8ab71d49a4b584f7cacb693e6b9 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 13 Apr 2021 01:01:45 +0200 Subject: combine: Fix up expand_compound_operation [PR99905] The following testcase is miscompiled on x86_64-linux. expand_compound_operation is called on (zero_extract:DI (mem/c:TI (reg/f:DI 16 argp) [3 i+0 S16 A128]) (const_int 16 [0x10]) (const_int 63 [0x3f])) so mode is DImode, inner_mode is TImode, pos 63, len 16 and modewidth 64. A couple of lines above the problematic spot we have: if (modewidth >= pos + len) { tem = gen_lowpart (mode, XEXP (x, 0)); where the code uses gen_lowpart and then shift left/right to extract it in mode. But the guarding condition is false - 64 >= 63 + 16 and so we enter the next condition, where the code shifts XEXP (x, 0) right by pos and then adds AND. It does so incorrectly though. Given the modewidth < pos + len, inner_mode must be necessarily larger than mode and XEXP (x, 0) has the innermode, but it was calling simplify_shift_const with mode rather than inner_mode, which meant inconsistent arguments to simplify_shift_const and in this case made a DImode MEM shift out of it. The following patch fixes it, by doing the shift in inner_mode properly and then after the shift doing the lowpart subreg and masking already in mode. 2021-04-13 Jakub Jelinek PR rtl-optimization/99905 * combine.c (expand_compound_operation): If pos + len > modewidth, perform the right shift by pos in inner_mode and then convert to mode, instead of trying to simplify a shift of rtx with inner_mode by pos as if it was a shift in mode. * gcc.target/i386/pr99905.c: New test. --- gcc/testsuite/gcc.target/i386/pr99905.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr99905.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/i386/pr99905.c b/gcc/testsuite/gcc.target/i386/pr99905.c new file mode 100644 index 0000000..6d1b230 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr99905.c @@ -0,0 +1,33 @@ +/* PR rtl-optimization/99905 */ +/* { dg-do run { target int128 } } */ +/* { dg-options "-Os -mno-mmx -mno-sse" } */ + +typedef unsigned char U; +typedef unsigned char __attribute__((__vector_size__ (8))) A; +typedef unsigned char __attribute__((__vector_size__ (16))) B; +typedef unsigned char __attribute__((__vector_size__ (32))) C; +typedef unsigned int __attribute__((__vector_size__ (8))) D; +typedef unsigned long long __attribute__((__vector_size__ (8))) E; +typedef unsigned __int128 I; +typedef unsigned long long L; + +D gv; +I gi; + +L __attribute__((__noipa__)) +foo (int ua, int ub, int uc, int ud, E ue, I i) +{ + D d = (U) __builtin_bswap16 (i >> 63) + gv; + B y = ((union { C a; B b[2];}) (C){ }).b[0] + (B) gi; + A z = ((union { B a; A b[2];}) y).b[0] + (A) d; + return (L)z; +} + +int +main () +{ + L x = foo (0, 0, 0, 0, (E) { }, (I) 0x100 << 63); + if (x != 0x100000001) + __builtin_abort (); + return 0; +} -- cgit v1.1 From 287ad814d7703a26d5623a9deafd5932c248d49c Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 13 Apr 2021 00:16:21 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 646e092..9f9a25f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,28 @@ +2021-04-12 Jakub Jelinek + + PR rtl-optimization/99905 + * gcc.target/i386/pr99905.c: New test. + +2021-04-12 Jakub Jelinek + + PR debug/99830 + * gcc.dg/pr99830.c: New test. + +2021-04-12 Jason Merrill + + PR c++/93085 + * g++.dg/template/dependent-tmpl1.C: New test. + +2021-04-12 Martin Liska + + PR sanitizer/99877 + * g++.dg/asan/pr99877.C: New test. + +2021-04-12 Cui,Lili + + * gcc.target/i386/funcspec-56.inc: Handle new march. + * g++.target/i386/mv16.C: Handle new march + 2021-04-11 Hafiz Abid Qadeer PR middle-end/98088 -- cgit v1.1 From 17f3c2b8ac477b07ca0aafbc7d74ba305dc1ee33 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Mon, 12 Apr 2021 21:13:40 -0400 Subject: gimple UIDs, LTO and -fanalyzer [PR98599] gimple.h has this comment for gimple's uid field: /* UID of this statement. This is used by passes that want to assign IDs to statements. It must be assigned and used by each pass. By default it should be assumed to contain garbage. */ unsigned uid; and gimple_set_uid has: Please note that this UID property is supposed to be undefined at pass boundaries. This means that a given pass should not assume it contains any useful value when the pass starts and thus can set it to any value it sees fit. which suggests that any pass can use the uid field as an arbitrary scratch space. PR analyzer/98599 reports a case where this error occurs in LTO mode: fatal error: Cgraph edge statement index out of range on certain inputs with -fanalyzer. The error occurs in the LTRANS phase after -fanalyzer runs in the WPA phase. The analyzer pass writes to the uid fields of all stmts. The error occurs when LTRANS is streaming callgraph edges back in. The LTO format uses stmt uids to associate call stmts with callgraph edges between WPA and LTRANS. For example, in lto-cgraph.c, lto_output_edge writes out the gimple_uid, and input_edge reads it back in. lto_prepare_function_for_streaming has code to renumber the stmt UIDs when the code is streamed back out, but for some reason this isn't called for clones: 307 /* Do body modifications needed for streaming before we fork out 308 worker processes. */ 309 FOR_EACH_FUNCTION_WITH_GIMPLE_BODY (node) 310 if (!node->clone_of && gimple_has_body_p (node->decl)) 311 lto_prepare_function_for_streaming (node); Hence the combination of -fanalyzer and -flto will fail in LTRANS's stream-in if any function clones are encountered. It's not fully clear to me why this isn't done for clones, and what the correct fix should be to allow arbitrary changes to uids within WPA passes. In the meantime, this patch works around the issue by updating the analyzer to save and restore the UIDs, fixing the error. gcc/analyzer/ChangeLog: PR analyzer/98599 * supergraph.cc (saved_uids::make_uid_unique): New. (saved_uids::restore_uids): New. (supergraph::supergraph): Replace assignments to stmt->uid with calls to m_stmt_uids.make_uid_unique. (supergraph::~supergraph): New. * supergraph.h (class saved_uids): New. (supergraph::~supergraph): New decl. (supergraph::m_stmt_uids): New field. gcc/testsuite/ChangeLog: PR analyzer/98599 * gcc.dg/analyzer/pr98599-a.c: New test. * gcc.dg/analyzer/pr98599-b.c: New test. --- gcc/testsuite/gcc.dg/analyzer/pr98599-a.c | 8 ++++++++ gcc/testsuite/gcc.dg/analyzer/pr98599-b.c | 1 + 2 files changed, 9 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/analyzer/pr98599-a.c create mode 100644 gcc/testsuite/gcc.dg/analyzer/pr98599-b.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/analyzer/pr98599-a.c b/gcc/testsuite/gcc.dg/analyzer/pr98599-a.c new file mode 100644 index 0000000..2bbf37b --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/pr98599-a.c @@ -0,0 +1,8 @@ +/* { dg-do link } */ +/* { dg-require-effective-target lto } */ +/* { dg-additional-options "-Os -flto" } */ +/* { dg-additional-sources pr98599-b.c } */ + +int b(int x); +int a() { b(5); } +int main() { a(); } diff --git a/gcc/testsuite/gcc.dg/analyzer/pr98599-b.c b/gcc/testsuite/gcc.dg/analyzer/pr98599-b.c new file mode 100644 index 0000000..cfdeb3b --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/pr98599-b.c @@ -0,0 +1 @@ +int b(int x) { return x; } -- cgit v1.1 From 07b27384de56ce2f6a93007d018743ef9d5c8cc4 Mon Sep 17 00:00:00 2001 From: Hans-Peter Nilsson Date: Tue, 13 Apr 2021 04:08:08 +0200 Subject: gcc.dg/analyzer/data-model-1.c: Inverse xfail for cris-*-*, PR99212 See PR99212. Now, cris-elf isn't the only target for which this line shows a failure; pru-unknown-elf and m68k-unknown-linux-gnu are two others. I'll leave adjustments to the respective maintainers, but trivially appending more triplets should work: no extra bracketing needed. A specific effective_target specifier would as always be perferable, but I couldn't without accountable effort find out what was the common factor. Besides cris-elf, sanity-checked for native x86_64-*-linux*. gcc/testsuite: PR analyzer/99212 * gcc.dg/analyzer/data-model-1.c (test_45): Inverse xfail at line 971 for cris-*-*. --- gcc/testsuite/gcc.dg/analyzer/data-model-1.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-1.c b/gcc/testsuite/gcc.dg/analyzer/data-model-1.c index afd1556..c0f5463 100644 --- a/gcc/testsuite/gcc.dg/analyzer/data-model-1.c +++ b/gcc/testsuite/gcc.dg/analyzer/data-model-1.c @@ -968,8 +968,8 @@ void test_45 (void) { struct ubits bits; bits.b0 = 1; - __analyzer_eval (bits.b0 == 1); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */ - /* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */ + __analyzer_eval (bits.b0 == 1); /* { dg-warning "TRUE" "desired, PR99212" { xfail { ! { cris-*-* } } } } */ + /* { dg-warning "UNKNOWN" "status quo, PR99212" { target { *-*-* } xfail { cris-*-* } } .-1 } */ // TODO(xfail): ^^^^ bits.b456 = 5; -- cgit v1.1 From 59d9aa6d2efe7c52b6a986eb3e1977c1fb3c5753 Mon Sep 17 00:00:00 2001 From: Patrick Palka Date: Mon, 12 Apr 2021 22:54:55 -0400 Subject: c++: constraints are unevaluated operands [PR99961] According to [temp.concept]/6 and [temp.pre]/9, a concept definition and a requires clause are both unevaluated contexts, and hence satisfaction deals only with unevaluated operands, so we should set cp_unevaluated in these three situations. gcc/cp/ChangeLog: PR c++/99961 PR c++/99994 * constraint.cc (satisfy_normalized_constraints): Set cp_unevaluated. * parser.c (cp_parser_concept_definition): Likewise. (cp_parser_requires_clause_opt): Likewise. gcc/testsuite/ChangeLog: PR c++/99961 PR c++/99994 * g++.dg/cpp2a/concepts-uneval1.C: New test. * g++.dg/cpp2a/concepts-uneval2.C: New test. --- gcc/testsuite/g++.dg/cpp2a/concepts-uneval1.C | 10 ++++++++++ gcc/testsuite/g++.dg/cpp2a/concepts-uneval2.C | 8 ++++++++ 2 files changed, 18 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp2a/concepts-uneval1.C create mode 100644 gcc/testsuite/g++.dg/cpp2a/concepts-uneval2.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-uneval1.C b/gcc/testsuite/g++.dg/cpp2a/concepts-uneval1.C new file mode 100644 index 0000000..4c5f1b5 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/concepts-uneval1.C @@ -0,0 +1,10 @@ +// PR c++/99961 +// { dg-do compile { target c++20 } } + +struct A { static const int x = 42; bool y; }; + +void f(auto a) requires (a.x == 42) { } +template void f(A); + +template concept C = V || A::y; +static_assert(C); diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-uneval2.C b/gcc/testsuite/g++.dg/cpp2a/concepts-uneval2.C new file mode 100644 index 0000000..4793bd6 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/concepts-uneval2.C @@ -0,0 +1,8 @@ +// PR c++/99994 +// { dg-do compile { target c++20 } } + +int main() { + auto f = [](int) { return true; }; + int n = [&](auto i) requires (f(sizeof(i))) { return 99; }(12); + int m = [](auto i) requires (f(sizeof(i))) { return 99; }(12); +} -- cgit v1.1 From c755e1b3eadaf1c7e751a2c7ce1d418c6db8463a Mon Sep 17 00:00:00 2001 From: Patrick Palka Date: Mon, 12 Apr 2021 23:22:03 -0400 Subject: c++: variadic class template placeholder deduction [PR97134] do_class_deduction handles specially the case where we're deducing one placeholder from another equivalent one, but here the initializer passed to do_class_deduction is wrapped in an EXPR_PACK_EXPANSION (we're being called from unify during get_partial_spec_bindings). This patch makes do_class_deduction look through EXPR_PACK_EXPANSIONs so that we detect this case as well. gcc/cp/ChangeLog: PR c++/97134 * pt.c (do_class_deduction): Look through EXPR_PACK_EXPANSION when checking if the initializer is an equivalent class placeholder template parameter. gcc/testsuite/ChangeLog: PR c++/97134 * g++.dg/cpp2a/nontype-class43.C: New test. --- gcc/testsuite/g++.dg/cpp2a/nontype-class43.C | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp2a/nontype-class43.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-class43.C b/gcc/testsuite/g++.dg/cpp2a/nontype-class43.C new file mode 100644 index 0000000..f51684f --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/nontype-class43.C @@ -0,0 +1,11 @@ +// PR c++/97134 +// { dg-do compile { target c++20 } } + +template +struct templ {}; + +template +struct wrapper {}; + +template requires true +struct wrapper {}; -- cgit v1.1 From f6ba5d039f988babdd99b5cdfb4557c380e57d69 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 13 Apr 2021 12:43:39 +0200 Subject: aarch64: Restore bfxil optimization [PR100028] Similarly to PR87763 for bfi, the GCC 9 combiner changes to not combine moves from hard registers regressed the following testcase where we no longer recognize bfxil and emit 3 instructions instead. The following patch adds define_insn patterns that match what the combiner is trying to match in these cases. I haven't been able to see patterns with the other order of the IOR operands, seems the IL is canonicalized this way no matter what is written in the source. 2021-04-13 Jakub Jelinek PR target/100028 * config/aarch64/aarch64.md (*aarch64_bfxil_extr, *aarch64_bfxilsi_extrdi): New define_insn patterns. * gcc.target/aarch64/pr100028.c: New test. --- gcc/testsuite/gcc.target/aarch64/pr100028.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 gcc/testsuite/gcc.target/aarch64/pr100028.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/aarch64/pr100028.c b/gcc/testsuite/gcc.target/aarch64/pr100028.c new file mode 100644 index 0000000..a25b929 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr100028.c @@ -0,0 +1,22 @@ +/* PR target/100028 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +#define W 3 +#define L 11 + +int +foo (int d, int s) +{ + int wmask = (1 << W) - 1; + return (d & ~wmask) | ((s >> L) & wmask); +} + +long long int +bar (long long int d, long long int s) +{ + long long int wmask = (1LL << W) - 1; + return (d & ~wmask) | ((s >> L) & wmask); +} + +/* { dg-final { scan-assembler-times {\tbfxil\t} 2 } } */ -- cgit v1.1 From 4acb3af3669db4ca79ffc97cd615fcea205bcccb Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Tue, 13 Apr 2021 05:03:19 -0700 Subject: preprocessor: Fix column adjustment [PR 99446] This ICE was because when adjusting a column offset we could advance into a linemap for a different file. We only checked the next line map was not for a line further advanced in any file, forgetting that it could be for an earlier line in a different file. The testcase needed adjusting as column 512 was unrepresentable, once that was taken into consideration. PR preprocessor/99446 libcpp/ * line-map.c (line-map.c): Do not advance to linemaps for different files. gcc/testsuite/ * g++.dg/diagnostic/pr72803.C: Adjust expected column. --- gcc/testsuite/g++.dg/diagnostic/pr72803.C | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/diagnostic/pr72803.C b/gcc/testsuite/g++.dg/diagnostic/pr72803.C index 0a9a390..ca522b7 100644 --- a/gcc/testsuite/g++.dg/diagnostic/pr72803.C +++ b/gcc/testsuite/g++.dg/diagnostic/pr72803.C @@ -5,5 +5,6 @@ class test { // The line directive appears to be necessary to trigger the ICE // { dg-error "style of line directive is a GCC extension" "" { target *-*-* } .-2 } -/* Verify that we get the correct line and column for the diagnostic. */ -// { dg-error "512: expected .;. after class definition" "" { target *-*-* } 3 } +/* Verify that we get the best line and column for the diagnostic. + 512 is not representable in the line-maps created for this test. */ +// { dg-error "511: expected .;. after class definition" "" { target *-*-* } 3 } -- cgit v1.1 From 0851ac6df0596df1e3b640e58094cf94ebb790b8 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 12 Apr 2021 17:43:51 -0400 Subject: c++: constexpr, inheritance, and local class [PR91933] Here we complained about referring to nm3 from the local class member function because referring to the base class subobject involved taking the variable's address. Let's shortcut this case to avoid that. gcc/cp/ChangeLog: PR c++/91933 * class.c (build_base_path): Shortcut simple non-pointer case. gcc/testsuite/ChangeLog: PR c++/91933 * g++.dg/cpp0x/constexpr-base7.C: New test. --- gcc/testsuite/g++.dg/cpp0x/constexpr-base7.C | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-base7.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-base7.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-base7.C new file mode 100644 index 0000000..14e026e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-base7.C @@ -0,0 +1,15 @@ +// PR c++/91933 +// { dg-do compile { target c++11 } } + +struct NoMut1 { int a, b; }; +struct NoMut3 : NoMut1 { + constexpr NoMut3(int a, int b) : NoMut1{a, b} {} +}; +void mutable_subobjects() { + constexpr NoMut3 nm3 = {1, 2}; + struct A { + void f() { + static_assert(nm3.a == 1, ""); + } + }; +} -- cgit v1.1 From f9810422f6768b914aabfcbffe64f535bdd18452 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 13 Apr 2021 12:05:53 +0200 Subject: tree-optimization/100053 - fix predication in VN This avoids doing optimistic dominance queries involving non-executable backedges when validating recorded predicated values in VN because we have no way to force re-evaluating validity when optimistically not executable edges become executable later. 2021-04-13 Richard Biener PR tree-optimization/100053 * tree-ssa-sccvn.c (vn_nary_op_get_predicated_value): Do not use optimistic dominance queries for backedges to validate predicated values. (dominated_by_p_w_unex): Add parameter to ignore executable state on backedges. (rpo_elim::eliminate_avail): Adjust. * gcc.dg/torture/pr100053.c: New testcase. * gcc.dg/tree-ssa/ssa-fre-93.c: Likewise. --- gcc/testsuite/gcc.dg/torture/pr100053.c | 25 +++++++++++++++++++++++++ gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-93.c | 21 +++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/torture/pr100053.c create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-93.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/torture/pr100053.c b/gcc/testsuite/gcc.dg/torture/pr100053.c new file mode 100644 index 0000000..3d17675 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr100053.c @@ -0,0 +1,25 @@ +/* { dg-do run } */ + +int __attribute__((returns_twice,noipa)) x() { return 0; } +void __attribute__((noipa)) ar() {} +void __attribute__((noipa)) as() { __builtin_abort (); } +int a1, a2, a3; +void __attribute__((noipa)) v(int init) +{ + if (!init) { + as(); + if (a1) + goto aq; + x (); + } + ar(); +aq: + if (!init) + as(); +} + +int main() +{ + v(1); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-93.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-93.c new file mode 100644 index 0000000..7f66b7e --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-93.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-fre1" } */ + +void bar (); +void foo (int pred, int *other) +{ + *other = 0; + if (*other) + goto cnt; + if (pred) + { + *other = 1; +cnt: + if (!pred) + bar (); + } +} + +/* The first VN pass should figure that if (!pred) is false because + if (*other) is and thus the predicate test is redundant. */ +/* { dg-final { scan-tree-dump-not "bar" "fre1" } } */ -- cgit v1.1 From 8913b2c2bcded39427ff27e6dfc276ae8555f6b8 Mon Sep 17 00:00:00 2001 From: Patrick Palka Date: Tue, 13 Apr 2021 12:35:33 -0400 Subject: c++: Reject alias CTAD in C++17 [PR99008] Here, in C++17 mode, we only pedwarn about the use of alias CTAD and then later ICE from alias_ctad_tweaks when attempting to constrain the guides. Since the construction of the guides of an alias template effectively relies on concepts, we shouldn't be permissive about alias CTAD in C++17 mode, so this patch turns the pertinent pedwarn in do_class_deduction into an error. In order to get a consistent diagnostic for B() vs the other forms in the added testcase, I had to remove the special handling of CTAD with empty initializer in build_functional_cast_1 so that we always pass 'complain' to do_auto_deduction. gcc/cp/ChangeLog: PR c++/99008 * pt.c (do_class_deduction): Reject alias CTAD in C++17 mode rather than issuing a pedwarn. * typeck2.c (build_functional_cast_1): Handle CTAD uniformly for consistent diagnostics. gcc/testsuite/ChangeLog: PR c++/99008 * g++.dg/parse/template2.C: Adjust expected diagnostic. * g++.dg/template/error8.C: Likewise. * g++.dg/cpp1z/class-deduction84.C: New test. --- gcc/testsuite/g++.dg/cpp1z/class-deduction84.C | 9 +++++++++ gcc/testsuite/g++.dg/parse/template2.C | 2 +- gcc/testsuite/g++.dg/template/error8.C | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp1z/class-deduction84.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction84.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction84.C new file mode 100644 index 0000000..29f25e5 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction84.C @@ -0,0 +1,9 @@ +// PR c++/99008 +// { dg-do compile { target c++17 } } + +template struct A { A(int = 0); }; +template using B = A; +auto x = B{}; // { dg-error "alias template deduction only available with" "" { target c++17_only } } +auto y = B(); // { dg-error "alias template deduction only available with" "" { target c++17_only } } +auto z = B{1}; // { dg-error "alias template deduction only available with" "" { target c++17_only } } +auto w = B(1); // { dg-error "alias template deduction only available with" "" { target c++17_only } } diff --git a/gcc/testsuite/g++.dg/parse/template2.C b/gcc/testsuite/g++.dg/parse/template2.C index 3cb27a8..3cafd9f 100644 --- a/gcc/testsuite/g++.dg/parse/template2.C +++ b/gcc/testsuite/g++.dg/parse/template2.C @@ -3,6 +3,6 @@ namespace N { } int main() { - N::C(); // { dg-error "6:cannot deduce template arguments" "" { target c++17 } } + N::C(); // { dg-error "8:class template argument deduction failed|no match" "" { target c++17 } } // { dg-error "7:missing template arguments" "" { target c++14_down } .-1 } } diff --git a/gcc/testsuite/g++.dg/template/error8.C b/gcc/testsuite/g++.dg/template/error8.C index 6cae360..de1534c 100644 --- a/gcc/testsuite/g++.dg/template/error8.C +++ b/gcc/testsuite/g++.dg/template/error8.C @@ -3,6 +3,6 @@ template struct S {}; void f() { - throw S (); // { dg-error "9:cannot deduce template arguments" "" { target c++17 } } + throw S (); // { dg-error "12:class template argument deduction failed|no match" "" { target c++17 } } // { dg-error "11:missing template arguments" "" { target c++14_down } .-1 } } -- cgit v1.1 From 6173f713a35d5450f0e2acfdaec695b42632aeed Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 13 Apr 2021 12:33:39 -0400 Subject: c++: generic lambda in template fn with DMI [PR100054] get_nsdmi instantiates default member initializers on demand. It tries to push into the context of the class before doing so, so access checking works properly, but since my patch for 90479 not for local classes. We should only be doing this when any template parameters have arguments. But in this case, we get here while regenerating a generic lambda, so processing_template_decl is true, even though the class and its DMI are non-dependent at this point. And so we crashed. So let's do more of the pushing into the context of the class even for local classes. gcc/cp/ChangeLog: PR c++/100054 PR c++/90479 * init.c (get_nsdmi): Do more context adjustment for local classes. gcc/testsuite/ChangeLog: PR c++/100054 * g++.dg/cpp1y/lambda-generic-local-class1.C: New test. --- gcc/testsuite/g++.dg/cpp1y/lambda-generic-local-class1.C | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1y/lambda-generic-local-class1.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-local-class1.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-local-class1.C new file mode 100644 index 0000000..7498327 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-local-class1.C @@ -0,0 +1,10 @@ +// PR c++/100054 +// { dg-do compile { target c++14 } } + +template +void f() { + struct A { T m{}; }; + [](auto){ return A{}; }; +} + +template void f(); -- cgit v1.1 From 4df918798b445e86305b63f86f5312a18e4017c5 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 13 Apr 2021 20:42:07 +0200 Subject: testsuite: Add testcase for already fixed PR97121 This was fixed by r11-5866 aka PR96299 fix. 2021-04-13 Jakub Jelinek PR c++/97121 * g++.dg/cpp2a/spaceship-err6.C: New test. --- gcc/testsuite/g++.dg/cpp2a/spaceship-err6.C | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp2a/spaceship-err6.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp2a/spaceship-err6.C b/gcc/testsuite/g++.dg/cpp2a/spaceship-err6.C new file mode 100644 index 0000000..57fbdb33 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/spaceship-err6.C @@ -0,0 +1,20 @@ +// PR c++/97121 +// { dg-do compile { target c++20 } } + +#include + +class MyClass +{ + int mValue; // { dg-error "three-way comparison of 'MyClass::mValue' has type 'std::strong_ordering', which does not convert to 'bool'" } + +public: + MyClass(int value): mValue(value) {} + + bool operator<=>(const MyClass&) const = default; +}; + +int main() +{ + MyClass a = 10, b = 15; + return (a < b); // { dg-error "use of deleted function 'constexpr bool MyClass::operator<=>\\\(const MyClass&\\\) const'" } +} -- cgit v1.1 From 34ec63f1b5c2a4d39aa3b13ade96bcd44e294066 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 13 Apr 2021 14:49:29 -0400 Subject: c++: alias template equivalence and cv-quals [PR100032] We also need to check that the cv-qualifiers are the same. gcc/cp/ChangeLog: PR c++/100032 * pt.c (get_underlying_template): Compare TYPE_QUALS. gcc/testsuite/ChangeLog: PR c++/100032 * g++.dg/cpp0x/alias-decl-equiv1.C: New test. --- gcc/testsuite/g++.dg/cpp0x/alias-decl-equiv1.C | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/alias-decl-equiv1.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-equiv1.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-equiv1.C new file mode 100644 index 0000000..ae27c43 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-equiv1.C @@ -0,0 +1,13 @@ +// PR c++/100032 +// { dg-do compile { target c++11 } } + +template class> struct X { }; +template struct Y { }; +template using Z = const Y; + +template using W = Z; +using U = X; +using U = X; + +using T = X; +using T = X; // { dg-error "conflicting declaration" } -- cgit v1.1 From 96d73645c77e7784ebd12527322d52b6b7eedb06 Mon Sep 17 00:00:00 2001 From: Patrick Palka Date: Tue, 13 Apr 2021 15:40:08 -0400 Subject: c++: Adjust expected diagnostics for old-deja tests [PR99008] I missed adjusting these tests in the recently committed r11-8155. gcc/testsuite/ChangeLog: PR c++/99008 * g++.old-deja/g++.ns/crash3.C: Adjust expected diagnostic. * g++.old-deja/g++.ns/template7.C: Likewise. * g++.old-deja/g++.pt/crash8.C: Likewise. --- gcc/testsuite/g++.old-deja/g++.ns/crash3.C | 2 +- gcc/testsuite/g++.old-deja/g++.ns/template7.C | 2 +- gcc/testsuite/g++.old-deja/g++.pt/crash8.C | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.old-deja/g++.ns/crash3.C b/gcc/testsuite/g++.old-deja/g++.ns/crash3.C index 189298d..b5e6323 100644 --- a/gcc/testsuite/g++.old-deja/g++.ns/crash3.C +++ b/gcc/testsuite/g++.old-deja/g++.ns/crash3.C @@ -6,6 +6,6 @@ namespace N { void f() { - N::S(); // { dg-error "6:cannot deduce template arguments" "" { target c++17 } } invalid use of template + N::S(); // { dg-error "8:class template argument deduction failed|no match" "" { target c++17 } } invalid use of template // { dg-error "7:missing template arguments" "" { target c++14_down } .-1 } } diff --git a/gcc/testsuite/g++.old-deja/g++.ns/template7.C b/gcc/testsuite/g++.old-deja/g++.ns/template7.C index 71366b7..441a412 100644 --- a/gcc/testsuite/g++.old-deja/g++.ns/template7.C +++ b/gcc/testsuite/g++.old-deja/g++.ns/template7.C @@ -8,6 +8,6 @@ namespace foo { } void baz() { - foo::bar(); // { dg-error "8:cannot deduce template arguments" "" { target c++17 } } template used as expression + foo::bar(); // { dg-error "12:class template argument deduction failed|no match" "" { target c++17 } } template used as expression // { dg-error "11:missing template arguments" "" { target c++14_down } .-1 } } diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash8.C b/gcc/testsuite/g++.old-deja/g++.pt/crash8.C index 7b4eff5..678a728 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/crash8.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/crash8.C @@ -21,11 +21,11 @@ void doit(T x) { q2 = TestClass2(); TestClass1 p1; - p1 = TestClass1(); // { dg-error "8:cannot deduce template arguments" "" { target c++17 } } template used as expression + p1 = TestClass1(); // { dg-error "19:class template argument deduction failed|no match" "" { target c++17 } } template used as expression // { dg-error "18:missing template arguments" "" { target c++14_down } .-1 } TestClass2 p2; - p2 = TestClass2(); // { dg-error "8:cannot deduce template arguments" "" { target c++17 } } template used as expression + p2 = TestClass2(); // { dg-error "19:class template argument deduction failed|no match" "" { target c++17 } } template used as expression // { dg-error "18:missing template arguments" "" { target c++14_down } .-1 } } -- cgit v1.1 From 8084ab15a3e300e3b2c537e56e0f3a1b00778aec Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Tue, 13 Apr 2021 13:46:21 -0600 Subject: PR middle-end/86058 - TARGET_MEM_REF causing incorrect message for -Wmaybe-uninitialized warning gcc/testsuite/ChangeLog: PR middle-end/86058 * gcc.dg/pr86058.c: New test. --- gcc/testsuite/gcc.dg/pr86058.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr86058.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/pr86058.c b/gcc/testsuite/gcc.dg/pr86058.c new file mode 100644 index 0000000..0b030b0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr86058.c @@ -0,0 +1,18 @@ +/* PR middle-end/86058 - TARGET_MEM_REF causing incorrect message for + -Wmaybe-uninitialized warning + { dg-do compile } + { dg-options "-O2 -Wuninitialized -Wmaybe-uninitialized" } */ + +extern void foo (int *); + +void zip (int *out, int indx) +{ + int arr[10]; + + for (int i = 0; i < indx; ++i) + out[i] = arr[i] + 1; // { dg-warning "'arr\\\[i]' may be used uninitialized" "pr?????" { xfail *-*-* } } + // { dg-warning "'arr' may be used uninitialized" "actual" { target *-*-* } .-1 } + + foo (arr); + foo (out); +} -- cgit v1.1 From af7128621e54f04b90589bb0c3e1ef271c239265 Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Tue, 13 Apr 2021 14:53:26 -0600 Subject: PR tree-optimization/82800 - Incorrect warning on "may be used uninitialized in variadic template code gcc/testsuite/ChangeLog: PR tree-optimization/82800 * g++.dg/warn/uninit-pr82800.C: New test. --- gcc/testsuite/g++.dg/warn/uninit-pr82800.C | 43 ++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 gcc/testsuite/g++.dg/warn/uninit-pr82800.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/warn/uninit-pr82800.C b/gcc/testsuite/g++.dg/warn/uninit-pr82800.C new file mode 100644 index 0000000..dc3ce5d --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/uninit-pr82800.C @@ -0,0 +1,43 @@ +/* PR 82800 - Incorrect warning on "may be used uninitialized in + variadic template code + { dg-do compile { target c++11 } } + { dg-options "-O2 -Wall" } */ + +typedef __SIZE_TYPE__ size_t; + +extern "C" int rand (); + +struct Maker +{ + double makeConst() + { + return pick(0, 0, 0, 0, 0, 0, 1); // { dg-bogus "uninitialized" } + } + + template + T pick(T first, Args... args) + { + return pickGivenNum(rand(), first, args...); + } + + template + T pickGivenNum(size_t num, T first) + { + if (num != 0) __builtin_abort(); + return first; + } + + template + T pickGivenNum(size_t num, T first, Args... args) + { + if (num == 0) return first; + return pickGivenNum(num - 1, args...); + } +}; + +int main () +{ + Maker maker; + maker.makeConst(); + maker.makeConst(); +} -- cgit v1.1 From 6d0d35d518a12ee43c1fbd77df73a66d02305a69 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 14 Apr 2021 00:16:24 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 84 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9f9a25f..1f79bc3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,87 @@ +2021-04-13 Martin Sebor + + PR tree-optimization/82800 + * g++.dg/warn/uninit-pr82800.C: New test. + +2021-04-13 Martin Sebor + + PR middle-end/86058 + * gcc.dg/pr86058.c: New test. + +2021-04-13 Patrick Palka + + PR c++/99008 + * g++.old-deja/g++.ns/crash3.C: Adjust expected diagnostic. + * g++.old-deja/g++.ns/template7.C: Likewise. + * g++.old-deja/g++.pt/crash8.C: Likewise. + +2021-04-13 Jason Merrill + + PR c++/100032 + * g++.dg/cpp0x/alias-decl-equiv1.C: New test. + +2021-04-13 Jakub Jelinek + + PR c++/97121 + * g++.dg/cpp2a/spaceship-err6.C: New test. + +2021-04-13 Jason Merrill + + PR c++/100054 + * g++.dg/cpp1y/lambda-generic-local-class1.C: New test. + +2021-04-13 Patrick Palka + + PR c++/99008 + * g++.dg/parse/template2.C: Adjust expected diagnostic. + * g++.dg/template/error8.C: Likewise. + * g++.dg/cpp1z/class-deduction84.C: New test. + +2021-04-13 Richard Biener + + PR tree-optimization/100053 + * gcc.dg/torture/pr100053.c: New testcase. + * gcc.dg/tree-ssa/ssa-fre-93.c: Likewise. + +2021-04-13 Jason Merrill + + PR c++/91933 + * g++.dg/cpp0x/constexpr-base7.C: New test. + +2021-04-13 Nathan Sidwell + + PR preprocessor/99446 + * g++.dg/diagnostic/pr72803.C: Adjust expected column. + +2021-04-13 Jakub Jelinek + + PR target/100028 + * gcc.target/aarch64/pr100028.c: New test. + +2021-04-13 Patrick Palka + + PR c++/97134 + * g++.dg/cpp2a/nontype-class43.C: New test. + +2021-04-13 Patrick Palka + + PR c++/99961 + PR c++/99994 + * g++.dg/cpp2a/concepts-uneval1.C: New test. + * g++.dg/cpp2a/concepts-uneval2.C: New test. + +2021-04-13 Hans-Peter Nilsson + + PR analyzer/99212 + * gcc.dg/analyzer/data-model-1.c (test_45): Inverse xfail at + line 971 for cris-*-*. + +2021-04-13 David Malcolm + + PR analyzer/98599 + * gcc.dg/analyzer/pr98599-a.c: New test. + * gcc.dg/analyzer/pr98599-b.c: New test. + 2021-04-12 Jakub Jelinek PR rtl-optimization/99905 -- cgit v1.1 From 006783f4b165dff25aae3697920fcf54754dddd4 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 13 Apr 2021 16:18:54 -0400 Subject: c++: debug location of variable cleanups [PR88742] PR49951 complained about the debugger jumping back to the declaration of a local variable when we run its destructor. That was fixed in 4.7, but broke again in 4.8. PR58123 fixed an inconsistency in the behavior, but not the jumping around. This patch addresses the issue by setting EXPR_LOCATION on a cleanup destructor call to the location of the closing brace of the compound-statement, or whatever token ends the scope of the variable. The change to cp_parser_compound_statement is so input_location is the } rather than the ; of the last substatement. gcc/cp/ChangeLog: PR c++/88742 PR c++/49951 PR c++/58123 * semantics.c (set_cleanup_locs): New. (do_poplevel): Call it. * parser.c (cp_parser_compound_statement): Consume the } before finish_compound_stmt. gcc/testsuite/ChangeLog: PR c++/88742 * g++.dg/debug/cleanup1.C: New test. * c-c++-common/Wimplicit-fallthrough-6.c: Adjust diagnostic line. * c-c++-common/Wimplicit-fallthrough-7.c: Likewise. * g++.dg/cpp2a/constexpr-dtor3.C: Likewise. * g++.dg/ext/constexpr-attr-cleanup1.C: Likewise. * g++.dg/tm/inherit2.C: Likewise. * g++.dg/tm/unsafe1.C: Likewise. * g++.dg/warn/Wimplicit-fallthrough-1.C: Likewise. * g++.dg/gcov/gcov-2.C: Adjust coverage counts. --- .../c-c++-common/Wimplicit-fallthrough-6.c | 16 ++++----- .../c-c++-common/Wimplicit-fallthrough-7.c | 4 +-- gcc/testsuite/g++.dg/cpp2a/constexpr-dtor3.C | 4 +-- gcc/testsuite/g++.dg/debug/cleanup1.C | 41 ++++++++++++++++++++++ gcc/testsuite/g++.dg/ext/constexpr-attr-cleanup1.C | 4 +-- gcc/testsuite/g++.dg/gcov/gcov-2.C | 4 +-- gcc/testsuite/g++.dg/tm/inherit2.C | 4 +-- gcc/testsuite/g++.dg/tm/unsafe1.C | 4 +-- .../g++.dg/warn/Wimplicit-fallthrough-1.C | 4 +-- 9 files changed, 63 insertions(+), 22 deletions(-) create mode 100644 gcc/testsuite/g++.dg/debug/cleanup1.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-6.c b/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-6.c index 32d5feb..9593f67 100644 --- a/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-6.c +++ b/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-6.c @@ -121,8 +121,8 @@ L1: int j = 0; bar (j); if (j == 8) - return; /* { dg-warning "statement may fall through" "" { target c++ } } */ - } + return; + } /* { dg-warning "statement may fall through" "" { target c++ } } */ case 2: bar (99); } @@ -151,8 +151,8 @@ L1: if (j == 8) bar (1); else - return; /* { dg-warning "statement may fall through" "" { target c++ } } */ - } + return; + } /* { dg-warning "statement may fall through" "" { target c++ } } */ case 2: bar (99); } @@ -181,8 +181,8 @@ L1: if (j == 8) bar (1); else - bar (2); /* { dg-warning "statement may fall through" "" { target c++ } } */ - } + bar (2); + } /* { dg-warning "statement may fall through" "" { target c++ } } */ case 2: bar (99); } @@ -281,8 +281,8 @@ L1: case 1: { /* { dg-warning "statement may fall through" "" { target c } } */ int j = 9; - switch (j); /* { dg-warning "statement may fall through" "" { target c++ } } */ - } + switch (j); + } /* { dg-warning "statement may fall through" "" { target c++ } } */ case 2: bar (99); } diff --git a/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-7.c b/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-7.c index a602216..343b625 100644 --- a/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-7.c +++ b/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-7.c @@ -22,8 +22,8 @@ f (int i) { case 1: { /* { dg-warning "statement may fall through" "" { target c } } */ - int a[i]; /* { dg-warning "statement may fall through" "" { target c++ } } */ - } + int a[i]; + } /* { dg-warning "statement may fall through" "" { target c++ } } */ case 2: bar (99); } diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-dtor3.C b/gcc/testsuite/g++.dg/cpp2a/constexpr-dtor3.C index 193ae93..7700bb7 100644 --- a/gcc/testsuite/g++.dg/cpp2a/constexpr-dtor3.C +++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-dtor3.C @@ -149,9 +149,9 @@ constexpr int x3 = f3 (); constexpr int f4 () { - W7 w13 = 5; // { dg-message "in 'constexpr' expansion of" } + W7 w13 = 5; return 0; -} +} // { dg-message "in 'constexpr' expansion of" } constexpr int x4 = f4 (); // { dg-message "in 'constexpr' expansion of" } diff --git a/gcc/testsuite/g++.dg/debug/cleanup1.C b/gcc/testsuite/g++.dg/debug/cleanup1.C new file mode 100644 index 0000000..ae0515a --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/cleanup1.C @@ -0,0 +1,41 @@ +// PR c++/88742 +// { dg-additional-options -fdump-tree-gimple-lineno } + + +class C { +public: + C() {} + ~C() {} + operator int() { return 1; } +}; + +int main() { + C a; + C b; + C c; + + if (C e = C()) + { + if (C d = C()) + { + } + else + { + return 42; + } // { dg-final { scan-tree-dump-times ":25:9. C::~C" 1 "gimple" } } + } // { dg-final { scan-tree-dump-times ":26:5. C::~C" 1 "gimple" } } + + while (C f = C()) + { + break; + } // { dg-final { scan-tree-dump-times ":31:5. C::~C" 1 "gimple" } } + + for (C h = C(); C i = C(); ) + break; // { dg-final { scan-tree-dump-times ":34:10. C::~C" 2 "gimple" } } + + switch (C g = C()) + { + default: + break; + } // { dg-final { scan-tree-dump-times ":40:5. C::~C" 1 "gimple" } } +} // { dg-final { scan-tree-dump-times ":41:1. C::~C" 3 "gimple" } } diff --git a/gcc/testsuite/g++.dg/ext/constexpr-attr-cleanup1.C b/gcc/testsuite/g++.dg/ext/constexpr-attr-cleanup1.C index b6e7c69..ab5fd17 100644 --- a/gcc/testsuite/g++.dg/ext/constexpr-attr-cleanup1.C +++ b/gcc/testsuite/g++.dg/ext/constexpr-attr-cleanup1.C @@ -15,9 +15,9 @@ cleanup2 (int *x) constexpr bool foo () { - int a __attribute__((cleanup (cleanup))) = 1; // { dg-message "in 'constexpr' expansion of" } + int a __attribute__((cleanup (cleanup))) = 1; return true; -} +} // { dg-message "in 'constexpr' expansion of" } constexpr bool bar () diff --git a/gcc/testsuite/g++.dg/gcov/gcov-2.C b/gcc/testsuite/g++.dg/gcov/gcov-2.C index 6d002f5..2b4cdd8 100644 --- a/gcc/testsuite/g++.dg/gcov/gcov-2.C +++ b/gcc/testsuite/g++.dg/gcov/gcov-2.C @@ -20,9 +20,9 @@ private: void foo() { - C c; /* count(2) */ + C c; /* count(1) */ c.seti (1); /* count(1) */ -} +} /* count(1) */ int main() { diff --git a/gcc/testsuite/g++.dg/tm/inherit2.C b/gcc/testsuite/g++.dg/tm/inherit2.C index 3b696a9..366f9b3 100644 --- a/gcc/testsuite/g++.dg/tm/inherit2.C +++ b/gcc/testsuite/g++.dg/tm/inherit2.C @@ -26,8 +26,8 @@ int main() B b; // ok D1 d1; // ok B& b1 = d1; - D2 x; // { dg-error "" "destructor of D2 is not transaction-safe" } + D2 x; b1.f(); // ok, calls D1::f() delete b2; // undefined behavior: calls unsafe destructor of D2 - } + } // { dg-error "" "destructor of D2 is not transaction-safe" } } diff --git a/gcc/testsuite/g++.dg/tm/unsafe1.C b/gcc/testsuite/g++.dg/tm/unsafe1.C index 49dd564..710fb1a 100644 --- a/gcc/testsuite/g++.dg/tm/unsafe1.C +++ b/gcc/testsuite/g++.dg/tm/unsafe1.C @@ -5,8 +5,8 @@ struct S { virtual ~S(); }; void f() transaction_safe { - S s; // { dg-error "unsafe" "invocation of unsafe destructor" } -} + S s; +} // { dg-error "unsafe" "invocation of unsafe destructor" } int g(int x) { // is transaction-safe if (x <= 0) diff --git a/gcc/testsuite/g++.dg/warn/Wimplicit-fallthrough-1.C b/gcc/testsuite/g++.dg/warn/Wimplicit-fallthrough-1.C index 053ed68..b5ebd3d 100644 --- a/gcc/testsuite/g++.dg/warn/Wimplicit-fallthrough-1.C +++ b/gcc/testsuite/g++.dg/warn/Wimplicit-fallthrough-1.C @@ -25,8 +25,8 @@ fn2 () switch (0) { case 0: { - A b; // { dg-warning "statement may fall through" } - } + A b; + } // { dg-warning "statement may fall through" } default: a = 0; } -- cgit v1.1 From 0589be0c59767cf4cbb0ef0e7d918cf6aa3d606c Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 13 Apr 2021 20:32:13 -0400 Subject: c++: DWARF ICE with defaulted specialization [PR90674] Here when we merged the specialization with the implicit instantiation declaration, we wrongly kept the value of DECL_INITIALIZED_IN_CLASS_P from the latter. gcc/cp/ChangeLog: PR c++/90674 * decl.c (duplicate_decls): Don't propagate DECL_INITIALIZED_IN_CLASS_P to a specialization. gcc/testsuite/ChangeLog: PR c++/90674 * g++.dg/debug/defaulted1.C: New test. --- gcc/testsuite/g++.dg/debug/defaulted1.C | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 gcc/testsuite/g++.dg/debug/defaulted1.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/debug/defaulted1.C b/gcc/testsuite/g++.dg/debug/defaulted1.C new file mode 100644 index 0000000..3ea7ae7 --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/defaulted1.C @@ -0,0 +1,10 @@ +// PR c++/90674 +// { dg-do compile { target c++11 } } + +template +struct C { + C() {} +}; + +template<> +C::C() = default; -- cgit v1.1 From e1666ebd9ad31dbd8b9b933c883bdd882cfd1522 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 13 Apr 2021 22:28:32 -0400 Subject: c++: lambda in non-type template parm type [PR99478] In this testcase, the non-type template parameter has the type of a lambda-expression. This makes no sense because a lambda in template context is specified to be distinct between different specializations of the template, even if the lambda is non-dependent, but here which specialization we are dealing with depends on which lambda we have, and vice versa. gcc/cp/ChangeLog: PR c++/99478 * parser.c (cp_parser_lambda_expression): Reject lambda in template parameter type. gcc/testsuite/ChangeLog: PR c++/99478 * g++.dg/cpp2a/lambda-uneval14.C: New test. --- gcc/testsuite/g++.dg/cpp2a/lambda-uneval14.C | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp2a/lambda-uneval14.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp2a/lambda-uneval14.C b/gcc/testsuite/g++.dg/cpp2a/lambda-uneval14.C new file mode 100644 index 0000000..a180359 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/lambda-uneval14.C @@ -0,0 +1,6 @@ +// PR c++/99478 +// { dg-do compile { target c++20 } } + +template auto f() {} // { dg-error "lambda" } + +int main() { f<{}>(); } // { dg-prune-output "no match" } -- cgit v1.1 From 2ccc05a5141506fde0e20dec702c717fd67bf6ee Mon Sep 17 00:00:00 2001 From: Patrick Palka Date: Wed, 14 Apr 2021 08:54:30 -0400 Subject: c++: Fix deduction with reference NTTP [PR83476] In the testcase ref11.C below, during deduction for the call f(a), uses_deducible_template_parms returns false for the dependent specialization A because the generic template argument V here is wrapped in an implicit INDIRECT_REF (formed from template_parm_to_arg). Since uses_deducible_template_parms returns false, unify_one_argument exits early without ever attempting to deduce 'n' for 'V'. This patch fixes this by making deducible_expression look through such implicit INDIRECT_REFs. gcc/cp/ChangeLog: PR c++/83476 PR c++/99885 * pt.c (deducible_expression): Look through implicit INDIRECT_REFs as well. gcc/testsuite/ChangeLog: PR c++/83476 PR c++/99885 * g++.dg/cpp1z/class-deduction85.C: New test. * g++.dg/template/ref11.C: New test. --- gcc/testsuite/g++.dg/cpp1z/class-deduction85.C | 16 ++++++++++++++++ gcc/testsuite/g++.dg/template/ref11.C | 9 +++++++++ 2 files changed, 25 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1z/class-deduction85.C create mode 100644 gcc/testsuite/g++.dg/template/ref11.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction85.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction85.C new file mode 100644 index 0000000..0b22f8e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction85.C @@ -0,0 +1,16 @@ +// PR c++/99885 +// { dg-do compile { target c++17 } } + +template +struct Foo {}; + +template +struct Bar { + constexpr auto foo() const -> Foo { + return {}; + } +}; + +constexpr int a = 1; +constexpr Bar bar; +Foo foo = bar.foo(); // <-- CTAD failure diff --git a/gcc/testsuite/g++.dg/template/ref11.C b/gcc/testsuite/g++.dg/template/ref11.C new file mode 100644 index 0000000..c43c67e --- /dev/null +++ b/gcc/testsuite/g++.dg/template/ref11.C @@ -0,0 +1,9 @@ +// PR c++/83476 + +int n; +template struct A {}; +template void f(A); +int main() { + A a; + f(a); +} -- cgit v1.1 From 3191c1f4488d1f7563b563d7ae2a102a26f16d82 Mon Sep 17 00:00:00 2001 From: Andreas Krebbel Date: Wed, 14 Apr 2021 16:07:17 +0200 Subject: IBM Z: Fix error checking for immediate builtin operands This fixes the error checking for two of the vector builtins which accept irregular (e.g. non-contigiuous) ranges of values. gcc/ChangeLog: * config/s390/s390-builtins.def (O_M5, O_M12, ...): Add new macros for mask operand types. (s390_vec_permi_s64, s390_vec_permi_b64, s390_vec_permi_u64) (s390_vec_permi_dbl, s390_vpdi): Use the M5 type for the immediate operand. (s390_vec_msum_u128, s390_vmslg): Use the M12 type for the immediate operand. * config/s390/s390.c (s390_const_operand_ok): Check the new operand types and generate a list of valid values. gcc/testsuite/ChangeLog: * gcc.target/s390/zvector/imm-range-error-1.c: New test. * gcc.target/s390/zvector/vec_msum_u128-1.c: New test. --- .../gcc.target/s390/zvector/imm-range-error-1.c | 26 +++++++++++++ .../gcc.target/s390/zvector/vec_msum_u128-1.c | 45 ++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 gcc/testsuite/gcc.target/s390/zvector/imm-range-error-1.c create mode 100644 gcc/testsuite/gcc.target/s390/zvector/vec_msum_u128-1.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/s390/zvector/imm-range-error-1.c b/gcc/testsuite/gcc.target/s390/zvector/imm-range-error-1.c new file mode 100644 index 0000000..1fe68f5 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/zvector/imm-range-error-1.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -mzarch -march=z14 -mzvector" } */ + +#include + +__vector unsigned char q; +__vector unsigned short int h; +__vector unsigned int s; +__vector unsigned long long d; + +int +main () +{ + vec_msum_u128 (d, d, q, 5); /* { dg-error "constant argument 4 for builtin '__builtin_s390_vec_msum_u128' is invalid \\(0, 4, 8, 12\\)" } */ + + /* Using the resolved low-level builtins here makes the errors to be + triggered from s390_expand_builtin. Otherwise they would come + from the parser already preventing other errors from showing + up. */ + __builtin_s390_vrepb (q, 17); /* { dg-error "constant argument 2 for builtin '__builtin_s390_vrepb' is out of range \\(0..15\\)" } */ + __builtin_s390_vreph (h, 8); /* { dg-error "constant argument 2 for builtin '__builtin_s390_vreph' is out of range \\(0..7\\)" } */ + __builtin_s390_vrepf (s, 4); /* { dg-error "constant argument 2 for builtin '__builtin_s390_vrepf' is out of range \\(0..3\\)" } */ + __builtin_s390_vrepg (d, 2); /* { dg-error "constant argument 2 for builtin '__builtin_s390_vrepg' is out of range \\(0..1\\)" } */ + + __builtin_s390_vpdi (d, d, 2); /* { dg-error "constant argument 3 for builtin '__builtin_s390_vpdi' is invalid \\(0, 1, 4, 5\\)" } */ +} diff --git a/gcc/testsuite/gcc.target/s390/zvector/vec_msum_u128-1.c b/gcc/testsuite/gcc.target/s390/zvector/vec_msum_u128-1.c new file mode 100644 index 0000000..2f5fbca --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/zvector/vec_msum_u128-1.c @@ -0,0 +1,45 @@ +/* { dg-do run } */ +/* { dg-require-effective-target s390_vxe } */ +/* { dg-options "-O3 -mzarch -march=z14 -mzvector --save-temps" } */ + +#include + +typedef vector unsigned char uv16qi; +typedef vector unsigned long long uv2di; + +uv2di a = (uv2di){ 12, 42 }; +uv2di b = (uv2di){ 54, 120 }; +uv2di c = (uv2di){ 0, 200 }; + +int +main () +{ + uv2di result; + + result = (uv2di)vec_msum_u128 (a, b, (uv16qi)c, 0); + + if (result[1] != a[0] * b[0] + a[1] * b[1] + c[1]) + __builtin_abort(); + + result = (uv2di)vec_msum_u128 (a, b, (uv16qi)c, 4); + + if (result[1] != a[0] * b[0] + a[1] * b[1] * 2 + c[1]) + __builtin_abort(); + + result = (uv2di)vec_msum_u128 (a, b, (uv16qi)c, 8); + + if (result[1] != a[0] * b[0] * 2 + a[1] * b[1] + c[1]) + __builtin_abort(); + + result = (uv2di)vec_msum_u128 (a, b, (uv16qi)c, 12); + + if (result[1] != a[0] * b[0] * 2 + a[1] * b[1] * 2 + c[1]) + __builtin_abort(); + + return 0; +} + +/* { dg-final { scan-assembler-times "vmslg\t.*0" 1 } } */ +/* { dg-final { scan-assembler-times "vmslg\t.*4" 1 } } */ +/* { dg-final { scan-assembler-times "vmslg\t.*8" 1 } } */ +/* { dg-final { scan-assembler-times "vmslg\t.*12" 1 } } */ -- cgit v1.1 From a065e0bb092a010664777394530ab1a52bb5293b Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Wed, 14 Apr 2021 16:19:46 +0100 Subject: aarch64: Handle more SVE vector constants [PR99246] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR99246 is about a case in which we failed to handle a CONST_VECTOR with NELTS_PER_PATTERN==2, i.e. a vector with a “foreground†sequence of N vectors followed by a repeating “background†sequence of N vectors. At the moment, it's difficult to produce these vectors directly, but I'm hoping that for GCC 12 we'll do more folding, which will in turn make this easier to test and easier to optimise. Until then, the patch simply relies on the testcase in the PR. gcc/ PR target/99246 * config/aarch64/aarch64.c (aarch64_expand_sve_const_vector_sel): New function. (aarch64_expand_sve_const_vector): Use it for nelts_per_pattern==2. gcc/testsuite/ PR target/99246 * gcc.target/aarch64/sve/acle/general/pr99246.c: New test. --- .../gcc.target/aarch64/sve/acle/general/pr99246.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr99246.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr99246.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr99246.c new file mode 100644 index 0000000..7f1079c --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr99246.c @@ -0,0 +1,17 @@ +/* { dg-options "-Os" } */ + +#include +extern char b[]; +int x; +void f() { + while (x) { + x = svaddv( + svnot_z(svnot_z(svptrue_pat_b8(SV_VL6), + svmov_z(svptrue_pat_b8(SV_VL1), + svptrue_pat_b16(SV_VL3))), + svptrue_pat_b64(SV_VL2)), + svdup_s32(8193)); + for (int j = x; j; j++) + b[j] = 0; + } +} -- cgit v1.1 From 785209fc464ee3efec2b2a8e8244b7292c251ad8 Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Wed, 14 Apr 2021 10:43:22 -0600 Subject: PR testsuite/100073 - test case gcc.dg/pr86058.c fails on arm, powerpc64 gcc/testsuite/ChangeLog: * gcc.dg/pr86058.c: Limit to just x86_64. --- gcc/testsuite/gcc.dg/pr86058.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/pr86058.c b/gcc/testsuite/gcc.dg/pr86058.c index 0b030b0..e39b720 100644 --- a/gcc/testsuite/gcc.dg/pr86058.c +++ b/gcc/testsuite/gcc.dg/pr86058.c @@ -1,8 +1,9 @@ /* PR middle-end/86058 - TARGET_MEM_REF causing incorrect message for -Wmaybe-uninitialized warning - { dg-do compile } + The test fails on a number of non-x86_64 targets due to pr100073. + { dg-do compile { target x86_64-*-* } } { dg-options "-O2 -Wuninitialized -Wmaybe-uninitialized" } */ - + extern void foo (int *); void zip (int *out, int indx) @@ -10,9 +11,9 @@ void zip (int *out, int indx) int arr[10]; for (int i = 0; i < indx; ++i) - out[i] = arr[i] + 1; // { dg-warning "'arr\\\[i]' may be used uninitialized" "pr?????" { xfail *-*-* } } + out[i] = arr[i] + 1; // { dg-warning "'arr\\\[i]' may be used uninitialized" "pr99944" { xfail *-*-* } } // { dg-warning "'arr' may be used uninitialized" "actual" { target *-*-* } .-1 } - + foo (arr); foo (out); } -- cgit v1.1 From f99f64f69db49ce6343d79a39eab28dcc6b91865 Mon Sep 17 00:00:00 2001 From: "Vladimir N. Makarov" Date: Wed, 14 Apr 2021 13:21:40 -0400 Subject: [PR100066] Check paradoxical subreg when splitting hard reg live range When splitting live range of a hard reg, LRA actually split multi-register containing the hard reg. So we need to check the biggest used mode of the hard reg on paradoxical subregister when the natural and the biggest mode are ordered. gcc/ChangeLog: PR rtl-optimization/100066 * lra-constraints.c (split_reg): Check paradoxical_subreg_p for ordered modes when choosing splitting mode for hard reg. gcc/testsuite/ChangeLog: PR rtl-optimization/100066 * gcc.target/i386/pr100066.c: New. --- gcc/testsuite/gcc.target/i386/pr100066.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr100066.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/i386/pr100066.c b/gcc/testsuite/gcc.target/i386/pr100066.c new file mode 100644 index 0000000..a795864 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr100066.c @@ -0,0 +1,13 @@ +/* { dg-do compile { target { int128 } } } */ +/* { dg-options "-O1 -w" } */ +int pm; + +void +w3 (int, int, int); + +void +e6 (__int128 rt, long int mo) +{ + mo += rt / 0; + w3 (pm / mo, pm, 0); +} -- cgit v1.1 From 9b53edc796d284b6adec7f2996772dbddf4c341e Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 14 Apr 2021 09:30:05 -0400 Subject: c++: non-static member, array bound, sizeof [PR93314] N2253 allowed referring to non-static data members without an object in unevaluated operands like that of sizeof, but in a constant-expression context like an array bound or template argument within such an unevaluated operand we do actually need a value, so that permission cannot apply. gcc/cp/ChangeLog: PR c++/93314 * semantics.c (finish_id_expression_1): Clear cp_unevaluated_operand for a non-static data member in a constant-expression. gcc/testsuite/ChangeLog: PR c++/93314 * g++.dg/parse/uneval1.C: New test. --- gcc/testsuite/g++.dg/parse/uneval1.C | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 gcc/testsuite/g++.dg/parse/uneval1.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/parse/uneval1.C b/gcc/testsuite/g++.dg/parse/uneval1.C new file mode 100644 index 0000000..dfc1bb4 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/uneval1.C @@ -0,0 +1,14 @@ +// PR c++/93314 + +struct S { + int m; + static int f() { + return sizeof(char[m]); // { dg-error "S::m" } + } +}; + +int main() +{ + return S().f() + + sizeof(char[S::m]); // { dg-error "S::m" } +} -- cgit v1.1 From 00a2774923c1dc5666cd26bb9b8c37b1b7dd689d Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 14 Apr 2021 14:14:31 -0400 Subject: c++: premature overload resolution redux [PR100078] My patch for PR93085 didn't consider that a default template argument can also make a template dependent. gcc/cp/ChangeLog: PR c++/100078 PR c++/93085 * pt.c (uses_outer_template_parms): Also look at default template argument. gcc/testsuite/ChangeLog: PR c++/100078 * g++.dg/template/dependent-tmpl2.C: New test. --- gcc/testsuite/g++.dg/template/dependent-tmpl2.C | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 gcc/testsuite/g++.dg/template/dependent-tmpl2.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/template/dependent-tmpl2.C b/gcc/testsuite/g++.dg/template/dependent-tmpl2.C new file mode 100644 index 0000000..040ddb4 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/dependent-tmpl2.C @@ -0,0 +1,10 @@ +// PR c++/100078 +// { dg-do compile { target c++11 } } + +template struct enable_if; +template struct HashMapBucket { + template + static typename enable_if::type selectStructure() { + selectStructure(); + } +}; -- cgit v1.1 From a87d3f964df31d4fbceb822c6d293e85c117d992 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Wed, 14 Apr 2021 20:06:45 +0100 Subject: Check for matching CONST_VECTOR encodings [PR99929] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR99929 is one of those “how did we get away with this for so long†bugs: the equality routines weren't checking whether two variable-length CONST_VECTORs had the same encoding. This meant that: { 1, 0, 0, 0, 0, 0, ... } would appear to be equal to: { 1, 0, 1, 0, 1, 0, ... } since both are represented using the elements { 1, 0 }. gcc/ PR rtl-optimization/99929 * rtl.h (same_vector_encodings_p): New function. * cse.c (exp_equiv_p): Check that CONST_VECTORs have the same encoding. * cselib.c (rtx_equal_for_cselib_1): Likewise. * jump.c (rtx_renumbered_equal_p): Likewise. * lra-constraints.c (operands_match_p): Likewise. * reload.c (operands_match_p): Likewise. * rtl.c (rtx_equal_p_cb, rtx_equal_p): Likewise. gcc/testsuite/ * gcc.target/aarch64/sve/pr99929_1.c: New file. * gcc.target/aarch64/sve/pr99929_2.c: Likewise. --- gcc/testsuite/gcc.target/aarch64/sve/pr99929_1.c | 16 ++++++++++++++++ gcc/testsuite/gcc.target/aarch64/sve/pr99929_2.c | 5 +++++ 2 files changed, 21 insertions(+) create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/pr99929_1.c create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/pr99929_2.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr99929_1.c b/gcc/testsuite/gcc.target/aarch64/sve/pr99929_1.c new file mode 100644 index 0000000..1fe1813 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/pr99929_1.c @@ -0,0 +1,16 @@ +/* { dg-do run { target aarch64_sve_hw } } */ +/* { dg-options "-O2 -ftree-vectorize" } */ + +#include + +static void e(short *g, short p2) { *g ^= p2; } +static short m[23]; +int main() { + for (unsigned i = 0; i < 23; ++i) + m[i] = 4; + if (svaddv(svptrue_pat_b32(SV_VL1), svdup_u32(1)) != 1) + __builtin_abort(); + for (unsigned i = 0; i < 3; ++i) + e(m, m[i]); + return 0; +} diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr99929_2.c b/gcc/testsuite/gcc.target/aarch64/sve/pr99929_2.c new file mode 100644 index 0000000..50d432d --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/pr99929_2.c @@ -0,0 +1,5 @@ +/* { dg-options "-O2 -ftree-vectorize" } */ + +#include "pr99929_1.c" + +/* { dg-final { scan-assembler {\tptrue\tp[0-7].[bhsd], vl1\n} } } */ -- cgit v1.1 From df3b1289521e6f24d5151fc5f7b135b8bf3009bc Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 15 Apr 2021 00:16:47 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 64 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1f79bc3..d9e9168 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,67 @@ +2021-04-14 Richard Sandiford + + * gcc.target/aarch64/sve/pr99929_1.c: New file. + * gcc.target/aarch64/sve/pr99929_2.c: Likewise. + +2021-04-14 Jason Merrill + + PR c++/100078 + * g++.dg/template/dependent-tmpl2.C: New test. + +2021-04-14 Jason Merrill + + PR c++/93314 + * g++.dg/parse/uneval1.C: New test. + +2021-04-14 Vladimir N. Makarov + + PR rtl-optimization/100066 + * gcc.target/i386/pr100066.c: New. + +2021-04-14 Martin Sebor + + * gcc.dg/pr86058.c: Limit to just x86_64. + +2021-04-14 Richard Sandiford + + PR target/99246 + * gcc.target/aarch64/sve/acle/general/pr99246.c: New test. + +2021-04-14 Andreas Krebbel + + * gcc.target/s390/zvector/imm-range-error-1.c: New test. + * gcc.target/s390/zvector/vec_msum_u128-1.c: New test. + +2021-04-14 Patrick Palka + + PR c++/83476 + PR c++/99885 + * g++.dg/cpp1z/class-deduction85.C: New test. + * g++.dg/template/ref11.C: New test. + +2021-04-14 Jason Merrill + + PR c++/99478 + * g++.dg/cpp2a/lambda-uneval14.C: New test. + +2021-04-14 Jason Merrill + + PR c++/90674 + * g++.dg/debug/defaulted1.C: New test. + +2021-04-14 Jason Merrill + + PR c++/88742 + * g++.dg/debug/cleanup1.C: New test. + * c-c++-common/Wimplicit-fallthrough-6.c: Adjust diagnostic line. + * c-c++-common/Wimplicit-fallthrough-7.c: Likewise. + * g++.dg/cpp2a/constexpr-dtor3.C: Likewise. + * g++.dg/ext/constexpr-attr-cleanup1.C: Likewise. + * g++.dg/tm/inherit2.C: Likewise. + * g++.dg/tm/unsafe1.C: Likewise. + * g++.dg/warn/Wimplicit-fallthrough-1.C: Likewise. + * g++.dg/gcov/gcov-2.C: Adjust coverage counts. + 2021-04-13 Martin Sebor PR tree-optimization/82800 -- cgit v1.1 From 417c36cfd620bf2b047852c2aa9ac49004aed2bc Mon Sep 17 00:00:00 2001 From: Stefan Schulze Frielinghaus Date: Thu, 15 Apr 2021 08:03:47 +0200 Subject: re PR tree-optimization/93210 (Sub-optimal code optimization on struct/combound constexpr (gcc vs. clang)) Regarding test gcc.dg/pr93210.c, on different targets GIMPLE code may slightly differ which is why the scan-tree-dump-times directive may fail. For example, for a RETURN_EXPR on x86_64 we have return 0x11100f0e0d0c0a090807060504030201; whereas on IBM Z the first operand is a RESULT_DECL like = 0x102030405060708090a0c0d0e0f1011; return ; gcc/testsuite/ChangeLog: * gcc.dg/pr93210.c: Adapt regex in order to also support a RESULT_DECL as an operand for a RETURN_EXPR. --- gcc/testsuite/gcc.dg/pr93210.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/pr93210.c b/gcc/testsuite/gcc.dg/pr93210.c index ec4194b..134d32b 100644 --- a/gcc/testsuite/gcc.dg/pr93210.c +++ b/gcc/testsuite/gcc.dg/pr93210.c @@ -1,7 +1,7 @@ /* PR tree-optimization/93210 */ /* { dg-do run } */ /* { dg-options "-O2 -fdump-tree-optimized" } */ -/* { dg-final { scan-tree-dump-times "return \[0-9]\[0-9a-fA-FxX]*;" 31 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "(?:return| =) \[0-9]\[0-9a-fA-FxX]*;" 31 "optimized" } } */ #ifdef __SIZEOF_INT128__ typedef unsigned __int128 L; -- cgit v1.1 From 39d23b7960e4efb11bbe1eff056ae9da0884c539 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 15 Apr 2021 10:45:09 +0200 Subject: aarch64: Fix several *_ashl3 related regressions [PR100056] Before combiner added 2 to 2 combinations, the following testcase functions have been all compiled into 2 instructions, zero/sign extensions or and followed by orr with lsl, e.g. for the first function Trying 7 -> 8: 7: r96:SI=r94:SI<<0xb 8: r95:SI=r96:SI|r94:SI REG_DEAD r96:SI REG_DEAD r94:SI Successfully matched this instruction: (set (reg:SI 95) (ior:SI (ashift:SI (reg/v:SI 94 [ i ]) (const_int 11 [0xb])) (reg/v:SI 94 [ i ]))) is the important successful try_combine and so we end up with and w0, w0, 255 orr w0, w0, w0, lsl 11 in the body. With 2 to 2 combination, before that can trigger, another successful combination: Trying 2 -> 7: 2: r94:SI=zero_extend(x0:QI) REG_DEAD x0:QI 7: r96:SI=r94:SI<<0xb is replaced with: (set (reg/v:SI 94 [ i ]) (zero_extend:SI (reg:QI 0 x0 [ i ]))) and (set (reg:SI 96) (and:SI (ashift:SI (reg:SI 0 x0 [ i ]) (const_int 11 [0xb])) (const_int 522240 [0x7f800]))) and in the end results in 3 instructions in the body: and w1, w0, 255 ubfiz w0, w0, 11, 8 orr w0, w0, w1 The following combine splitters help undo that when combiner tries to combine 3 instructions - the zero/sign extend or and, the other insn from the 2 to 2 combination ([us]bfiz) and the logical op, the CPUs don't have an insn to do everything in one op, but we can split it back into the zero/sign extend or and followed by logical with lsl. 2021-04-15 Jakub Jelinek PR target/100056 * config/aarch64/aarch64.md (*_3): Add combine splitters for *_ashl3 with ZERO_EXTEND, SIGN_EXTEND or AND. * gcc.target/aarch64/pr100056.c: New test. --- gcc/testsuite/gcc.target/aarch64/pr100056.c | 58 +++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 gcc/testsuite/gcc.target/aarch64/pr100056.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/aarch64/pr100056.c b/gcc/testsuite/gcc.target/aarch64/pr100056.c new file mode 100644 index 0000000..0b77824 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr100056.c @@ -0,0 +1,58 @@ +/* PR target/100056 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +/* { dg-final { scan-assembler-not {\t[us]bfiz\tw[0-9]+, w[0-9]+, 11} } } */ + +int +or_shift_u8 (unsigned char i) +{ + return i | (i << 11); +} + +int +or_shift_u3a (unsigned i) +{ + i &= 7; + return i | (i << 11); +} + +int +or_shift_u3b (unsigned i) +{ + i = (i << 29) >> 29; + return i | (i << 11); +} + +int +or_shift_s16 (signed short i) +{ + return i | (i << 11); +} + +int +or_shift_s8 (signed char i) +{ + return i | (i << 11); +} + +int +or_shift_s13 (int i) +{ + i = (i << 19) >> 19; + return i | (i << 11); +} + +int +or_shift_s3 (int i) +{ + i = (i << 29) >> 29; + return i | (i << 11); +} + +int +or_shift_u8_asm (unsigned char x) +{ + unsigned char i = x; + asm volatile ("" : "+r" (i)); + return i | (i << 11); +} -- cgit v1.1 From a3317f7b3c02907a122f89879e5b6e90c386e64d Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Thu, 15 Apr 2021 11:37:38 +0100 Subject: c: Don't drop vector attributes that affect type identity [PR98852] types are distinct from GNU vector types in at least their mangling. However, there used to be nothing explicit in the VECTOR_TYPE itself to indicate the difference: we simply treated them as distinct TYPE_MAIN_VARIANTs. This caused problems like the ones reported in PR95726. The fix for that PR was to add type attributes to the types, in order to maintain the distinction between them and GNU vectors. However, this in turn caused PR98852, where c_common_type would unconditionally drop the attributes on the source types. This meant that: vector + vector had a GNU vector type rather than an vector type. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96377#c2 for Jakub's analysis of the history of this c_common_type code. TBH I'm not sure which case the build_type_attribute_variant code is handling, but I think we should at least avoid dropping attributes that affect type identity. I've tried to audit the C and target-specific attributes to look for other types that might be affected by this, but I couldn't see any. We are only dealing with: gcc_assert (code1 == VECTOR_TYPE || code1 == COMPLEX_TYPE || code1 == FIXED_POINT_TYPE || code1 == REAL_TYPE || code1 == INTEGER_TYPE); which excludes most affects_type_identity attributes. The closest was s390_vector_bool, but the handler for that attribute changes the type node and drops the attribute itself (*no_add_attrs = true). I put the main list handling into a separate function (remove_attributes_matching) because a later patch will need it for something else. gcc/ PR c/98852 * attribs.h (affects_type_identity_attributes): Declare. * attribs.c (remove_attributes_matching): New function. (affects_type_identity_attributes): Likewise. gcc/c/ PR c/98852 * c-typeck.c (c_common_type): Do not drop attributes that affect type identity. gcc/testsuite/ PR c/98852 * gcc.target/aarch64/advsimd-intrinsics/pr98852.c: New test. --- .../aarch64/advsimd-intrinsics/pr98852.c | 129 +++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/pr98852.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/pr98852.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/pr98852.c new file mode 100644 index 0000000..31e51b0d --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/pr98852.c @@ -0,0 +1,129 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-std=c99" } */ + +#include + +typedef __typeof(((int32x4_t *) 0)[0][0]) int32_elt; +typedef __typeof(((uint32x4_t *) 0)[0][0]) uint32_elt; + +typedef int32_elt gnu_int32x4_t __attribute__((vector_size(16))); +typedef uint32_elt gnu_uint32x4_t __attribute__((vector_size(16))); + +#define X_gnu_int32x4_t 1 +#define X_gnu_uint32x4_t 2 +#define X_int32x4_t 3 +#define X_uint32x4_t 4 + +#define CHECK(T) T: X_##T + +#define CHECK_TYPE(EXPR, TYPE) \ + do { \ + int x[_Generic (EXPR, \ + CHECK (gnu_int32x4_t), \ + CHECK (gnu_uint32x4_t), \ + CHECK (int32x4_t), \ + CHECK (uint32x4_t), \ + default : 0) == X_##TYPE ? 1 : -1]; \ + } while (0) + +void +f (gnu_int32x4_t sg, gnu_uint32x4_t ug, int32x4_t sn, uint32x4_t un, int c) +{ + CHECK_TYPE (sg, gnu_int32x4_t); + CHECK_TYPE (ug, gnu_uint32x4_t); + CHECK_TYPE (sn, int32x4_t); + CHECK_TYPE (un, uint32x4_t); + + CHECK_TYPE (sg + 1, gnu_int32x4_t); + CHECK_TYPE (ug + 1, gnu_uint32x4_t); + CHECK_TYPE (sn + 1, int32x4_t); + CHECK_TYPE (un + 1, uint32x4_t); + + CHECK_TYPE (1 + sg, gnu_int32x4_t); + CHECK_TYPE (1 + ug, gnu_uint32x4_t); + CHECK_TYPE (1 + sn, int32x4_t); + CHECK_TYPE (1 + un, uint32x4_t); + + CHECK_TYPE (sg + sg, gnu_int32x4_t); + CHECK_TYPE (ug + ug, gnu_uint32x4_t); + CHECK_TYPE (sn + sn, int32x4_t); + CHECK_TYPE (un + un, uint32x4_t); + + /* Traditional behavior for mixed signs is to pick the signedness of the + first operand. We don't have any Arm-specific reason for preferring that + behavior, but including the tests helps to demonstrate the points in the + comments below. */ + CHECK_TYPE (sg + ug, gnu_int32x4_t); + CHECK_TYPE (ug + sg, gnu_uint32x4_t); + CHECK_TYPE (sn + un, int32x4_t); + CHECK_TYPE (un + sn, uint32x4_t); + + /* Nothing specifies the type of mixed GNU and arm_neon.h operations, but: + + - it would be surprising if sg + un had a different signedness from + sg + ug + + - it would also be mildly surprising if sg + un had a different type from + both of its operands + + So in cases where the operands differ in both signedness and ABI, it seems + more consistent to ignore the ABI difference and apply the usual rules for + differences in sign. */ + CHECK_TYPE (sg + un, gnu_int32x4_t); + CHECK_TYPE (ug + sn, gnu_uint32x4_t); + CHECK_TYPE (sn + ug, int32x4_t); + CHECK_TYPE (un + sg, uint32x4_t); + + /* And if the first vector wins when operands differ in both signedness + and ABI, it seems more consistent to do the same if the operands differ + only in ABI. */ + CHECK_TYPE (sg + sn, gnu_int32x4_t); + CHECK_TYPE (ug + un, gnu_uint32x4_t); + CHECK_TYPE (sn + sg, int32x4_t); + CHECK_TYPE (un + ug, uint32x4_t); + + CHECK_TYPE (c ? sg + sg : sg, gnu_int32x4_t); + CHECK_TYPE (c ? ug + ug : ug, gnu_uint32x4_t); + CHECK_TYPE (c ? sn + sn : sn, int32x4_t); + CHECK_TYPE (c ? un + un : un, uint32x4_t); + + CHECK_TYPE (c ? sg + 1 : sg, gnu_int32x4_t); + CHECK_TYPE (c ? ug + 1 : ug, gnu_uint32x4_t); + CHECK_TYPE (c ? sn + 1 : sn, int32x4_t); + CHECK_TYPE (c ? un + 1 : un, uint32x4_t); + + CHECK_TYPE (c ? 1 + sg : sg, gnu_int32x4_t); + CHECK_TYPE (c ? 1 + ug : ug, gnu_uint32x4_t); + CHECK_TYPE (c ? 1 + sn : sn, int32x4_t); + CHECK_TYPE (c ? 1 + un : un, uint32x4_t); + + CHECK_TYPE (c ? sg : sg + sg, gnu_int32x4_t); + CHECK_TYPE (c ? ug : ug + ug, gnu_uint32x4_t); + CHECK_TYPE (c ? sn : sn + sn, int32x4_t); + CHECK_TYPE (c ? un : un + un, uint32x4_t); + + CHECK_TYPE (c ? sg : sg + 1, gnu_int32x4_t); + CHECK_TYPE (c ? ug : ug + 1, gnu_uint32x4_t); + CHECK_TYPE (c ? sn : sn + 1, int32x4_t); + CHECK_TYPE (c ? un : un + 1, uint32x4_t); + + CHECK_TYPE (c ? sg : 1 + sg, gnu_int32x4_t); + CHECK_TYPE (c ? ug : 1 + ug, gnu_uint32x4_t); + CHECK_TYPE (c ? sn : 1 + sn, int32x4_t); + CHECK_TYPE (c ? un : 1 + un, uint32x4_t); + + CHECK_TYPE (c ? sg + sg : sg + sg, gnu_int32x4_t); + CHECK_TYPE (c ? ug + ug : ug + ug, gnu_uint32x4_t); + CHECK_TYPE (c ? sn + sn : sn + sn, int32x4_t); + CHECK_TYPE (c ? un + un : un + un, uint32x4_t); + + CHECK_TYPE (c ? sg + sg : sg + 1, gnu_int32x4_t); + CHECK_TYPE (c ? ug + ug : ug + 1, gnu_uint32x4_t); + CHECK_TYPE (c ? sn + sn : sn + 1, int32x4_t); + CHECK_TYPE (c ? un + un : un + 1, uint32x4_t); + + CHECK_TYPE (c ? 1 + sg : sg + sg, gnu_int32x4_t); + CHECK_TYPE (c ? 1 + ug : ug + ug, gnu_uint32x4_t); + CHECK_TYPE (c ? 1 + sn : sn + sn, int32x4_t); + CHECK_TYPE (c ? 1 + un : un + un, uint32x4_t); +} -- cgit v1.1 From 1696fc1ea01d5c9dce96b5d3122921aab9308f59 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Thu, 15 Apr 2021 11:37:39 +0100 Subject: c++: Tweak merging of vector attributes that affect type identity [PR98852] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit types are distinct from GNU vector types in at least their mangling. However, there used to be nothing explicit in the VECTOR_TYPE itself to indicate the difference: we simply treated them as distinct TYPE_MAIN_VARIANTs. This caused problems like the ones reported in PR95726. The fix for that PR was to add type attributes to the types, in order to maintain the distinction between them and GNU vectors. However, this in turn caused PR98852, where cp_common_type would merge the type attributes from the two source types and attach the result to the common type. For example: unsigned vector with no attribute + signed vector with attribute X would get converted to: unsigned vector with attribute X That isn't what we want in this case, since X describes the mangling of the original type. But even if we dropped the mangling from X and worked it out from context, we would still have a situation in which the common type was provably distinct from both of the source types: it would take its -ness from one side and its signedness from the other. I guess there are other cases where the common type doesn't match either side, but I'm not sure it's the obvious behaviour here. It's also different from GCC 10.1 and earlier, where the unsigned vector “won†in its original form. This patch instead merges only the attributes that don't affect type identity. For now I've restricted it to vector types, since we're so close to GCC 11, but it might make sense to use this elsewhere. I've tried to audit the C and target-specific attributes to look for other types that might be affected by this, but I couldn't see any. The closest was s390_vector_bool, but the handler for that attribute changes the type node and drops the attribute itself (*no_add_attrs = true). gcc/ PR c++/98852 * attribs.h (restrict_type_identity_attributes_to): Declare. * attribs.c (restrict_type_identity_attributes_to): New function. gcc/cp/ PR c++/98852 * typeck.c (merge_type_attributes_from): New function. (cp_common_type): Use it for vector types. --- .../advsimd-intrinsics/advsimd-intrinsics.exp | 72 ++++++++++++++ .../aarch64/advsimd-intrinsics/pr98852.C | 110 +++++++++++++++++++++ 2 files changed, 182 insertions(+) create mode 100644 gcc/testsuite/g++.target/aarch64/advsimd-intrinsics/advsimd-intrinsics.exp create mode 100644 gcc/testsuite/g++.target/aarch64/advsimd-intrinsics/pr98852.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.target/aarch64/advsimd-intrinsics/advsimd-intrinsics.exp b/gcc/testsuite/g++.target/aarch64/advsimd-intrinsics/advsimd-intrinsics.exp new file mode 100644 index 0000000..268e221 --- /dev/null +++ b/gcc/testsuite/g++.target/aarch64/advsimd-intrinsics/advsimd-intrinsics.exp @@ -0,0 +1,72 @@ +# Copyright (C) 2014-2021 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + +# GCC testsuite that uses the `dg.exp' driver. + +# Exit immediately if this isn't an ARM or AArch64 target. +if {![istarget arm*-*-*] + && ![istarget aarch64*-*-*]} then { + return +} + +# Load support procs. +load_lib g++-dg.exp + +# Initialize `dg'. +load_lib c-torture.exp + +dg-init + +# The default action for a test is 'run'. Save current default. +global dg-do-what-default +set save-dg-do-what-default ${dg-do-what-default} + +# For ARM, make sure that we have a target compatible with NEON, and do +# not attempt to run execution tests if the hardware doesn't support it. +if {[istarget arm*-*-*]} then { + if {![check_effective_target_arm_neon_ok]} then { + return + } + if {![is-effective-target arm_neon_hw]} then { + set dg-do-what-default compile + } else { + set dg-do-what-default run + } +} else { + set dg-do-what-default run +} + +torture-init +set-torture-options $C_TORTURE_OPTIONS {{}} $LTO_TORTURE_OPTIONS + +# Make sure Neon flags are provided, if necessary. Use fp16 if we can. +# Use fp16 arithmetic operations if the hardware supports it. +if {[check_effective_target_arm_v8_2a_fp16_neon_hw]} then { + set additional_flags [add_options_for_arm_v8_2a_fp16_neon ""] +} elseif {[check_effective_target_arm_neon_fp16_ok]} then { + set additional_flags [add_options_for_arm_neon_fp16 ""] +} else { + set additional_flags [add_options_for_arm_neon ""] +} + +# Main loop. +gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.C]] \ + "" ${additional_flags} + +# All done. +set dg-do-what-default ${save-dg-do-what-default} +torture-finish +dg-finish diff --git a/gcc/testsuite/g++.target/aarch64/advsimd-intrinsics/pr98852.C b/gcc/testsuite/g++.target/aarch64/advsimd-intrinsics/pr98852.C new file mode 100644 index 0000000..0cb5c89 --- /dev/null +++ b/gcc/testsuite/g++.target/aarch64/advsimd-intrinsics/pr98852.C @@ -0,0 +1,110 @@ +/* { dg-do compile } */ + +#include + +using int32_elt = __typeof(((int32x4_t *) nullptr)[0][0]); +using uint32_elt = __typeof(((uint32x4_t *) nullptr)[0][0]); + +typedef int32_elt gnu_int32x4_t __attribute__((vector_size(16))); +typedef uint32_elt gnu_uint32x4_t __attribute__((vector_size(16))); + +template struct id; +template<> struct id { static const int value = 1; }; +template<> struct id { static const int value = 2; }; +template<> struct id { static const int value = 3; }; +template<> struct id { static const int value = 4; }; + +#define CHECK_TYPE(EXPR, TYPE) \ + static_assert(id::value == id::value, "foo") + +void +f (gnu_int32x4_t sg, gnu_uint32x4_t ug, int32x4_t sn, uint32x4_t un, bool c) +{ + CHECK_TYPE (sg, gnu_int32x4_t); + CHECK_TYPE (ug, gnu_uint32x4_t); + CHECK_TYPE (sn, int32x4_t); + CHECK_TYPE (un, uint32x4_t); + + CHECK_TYPE (sg + 1, gnu_int32x4_t); + CHECK_TYPE (ug + 1, gnu_uint32x4_t); + CHECK_TYPE (sn + 1, int32x4_t); + CHECK_TYPE (un + 1, uint32x4_t); + + CHECK_TYPE (1 + sg, gnu_int32x4_t); + CHECK_TYPE (1 + ug, gnu_uint32x4_t); + CHECK_TYPE (1 + sn, int32x4_t); + CHECK_TYPE (1 + un, uint32x4_t); + + CHECK_TYPE (sg + sg, gnu_int32x4_t); + CHECK_TYPE (ug + ug, gnu_uint32x4_t); + CHECK_TYPE (sn + sn, int32x4_t); + CHECK_TYPE (un + un, uint32x4_t); + + // In C++, unlike C, the behavior is to prefer unsigned types over + // signed types. + CHECK_TYPE (sg + ug, gnu_uint32x4_t); + CHECK_TYPE (ug + sg, gnu_uint32x4_t); + CHECK_TYPE (sn + un, uint32x4_t); + CHECK_TYPE (un + sn, uint32x4_t); + + // That being the case, it seems more consistent to do the same thing + // for mixed GNU and arm_neon.h operations. + CHECK_TYPE (sg + un, uint32x4_t); + CHECK_TYPE (un + sg, uint32x4_t); + CHECK_TYPE (sn + ug, gnu_uint32x4_t); + CHECK_TYPE (ug + sn, gnu_uint32x4_t); + + // If the types have the same signedness, the traditional behavior is + // to pick the first type if it is unsigned and the second type otherwise. + // This is not necessarily sensible, but dates back to at least GCC 9.1. + // We could probably change it. + CHECK_TYPE (sg + sn, int32x4_t); + CHECK_TYPE (sn + sg, gnu_int32x4_t); + CHECK_TYPE (un + ug, uint32x4_t); + CHECK_TYPE (ug + un, gnu_uint32x4_t); + + CHECK_TYPE (c ? sg + sg : sg, gnu_int32x4_t); + CHECK_TYPE (c ? ug + ug : ug, gnu_uint32x4_t); + CHECK_TYPE (c ? sn + sn : sn, int32x4_t); + CHECK_TYPE (c ? un + un : un, uint32x4_t); + + CHECK_TYPE (c ? sg + 1 : sg, gnu_int32x4_t); + CHECK_TYPE (c ? ug + 1 : ug, gnu_uint32x4_t); + CHECK_TYPE (c ? sn + 1 : sn, int32x4_t); + CHECK_TYPE (c ? un + 1 : un, uint32x4_t); + + CHECK_TYPE (c ? 1 + sg : sg, gnu_int32x4_t); + CHECK_TYPE (c ? 1 + ug : ug, gnu_uint32x4_t); + CHECK_TYPE (c ? 1 + sn : sn, int32x4_t); + CHECK_TYPE (c ? 1 + un : un, uint32x4_t); + + CHECK_TYPE (c ? sg : sg + sg, gnu_int32x4_t); + CHECK_TYPE (c ? ug : ug + ug, gnu_uint32x4_t); + CHECK_TYPE (c ? sn : sn + sn, int32x4_t); + CHECK_TYPE (c ? un : un + un, uint32x4_t); + + CHECK_TYPE (c ? sg : sg + 1, gnu_int32x4_t); + CHECK_TYPE (c ? ug : ug + 1, gnu_uint32x4_t); + CHECK_TYPE (c ? sn : sn + 1, int32x4_t); + CHECK_TYPE (c ? un : un + 1, uint32x4_t); + + CHECK_TYPE (c ? sg : 1 + sg, gnu_int32x4_t); + CHECK_TYPE (c ? ug : 1 + ug, gnu_uint32x4_t); + CHECK_TYPE (c ? sn : 1 + sn, int32x4_t); + CHECK_TYPE (c ? un : 1 + un, uint32x4_t); + + CHECK_TYPE (c ? sg + sg : sg + sg, gnu_int32x4_t); + CHECK_TYPE (c ? ug + ug : ug + ug, gnu_uint32x4_t); + CHECK_TYPE (c ? sn + sn : sn + sn, int32x4_t); + CHECK_TYPE (c ? un + un : un + un, uint32x4_t); + + CHECK_TYPE (c ? sg + sg : sg + 1, gnu_int32x4_t); + CHECK_TYPE (c ? ug + ug : ug + 1, gnu_uint32x4_t); + CHECK_TYPE (c ? sn + sn : sn + 1, int32x4_t); + CHECK_TYPE (c ? un + un : un + 1, uint32x4_t); + + CHECK_TYPE (c ? 1 + sg : sg + sg, gnu_int32x4_t); + CHECK_TYPE (c ? 1 + ug : ug + ug, gnu_uint32x4_t); + CHECK_TYPE (c ? 1 + sn : sn + sn, int32x4_t); + CHECK_TYPE (c ? 1 + un : un + un, uint32x4_t); +} -- cgit v1.1 From 4d1fa72894e3fbc5f331d2e8984e990307396124 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 15 Apr 2021 14:08:03 +0200 Subject: testsuite: enable pr86058.c also on i?86-*-* [PR100073] The test also works with -m32 or -mx32 the same as it does for -m64, therefore it should be enabled for i?86-*-* x86_64-*-* targets, x86_64-*-* alone is never right. 2021-04-15 Jakub Jelinek PR testsuite/100073 * gcc.dg/pr86058.c: Enable also on i?86-*-*. --- gcc/testsuite/gcc.dg/pr86058.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/pr86058.c b/gcc/testsuite/gcc.dg/pr86058.c index e39b720..89628c9 100644 --- a/gcc/testsuite/gcc.dg/pr86058.c +++ b/gcc/testsuite/gcc.dg/pr86058.c @@ -1,7 +1,7 @@ /* PR middle-end/86058 - TARGET_MEM_REF causing incorrect message for -Wmaybe-uninitialized warning - The test fails on a number of non-x86_64 targets due to pr100073. - { dg-do compile { target x86_64-*-* } } + The test fails on a number of non-x86 targets due to pr100073. + { dg-do compile { target i?86-*-* x86_64-*-* } } { dg-options "-O2 -Wuninitialized -Wmaybe-uninitialized" } */ extern void foo (int *); -- cgit v1.1 From ff1912238e28ed204570e0d33d3c3517491caf0f Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Thu, 15 Apr 2021 16:18:25 +0100 Subject: Make SVE tests work with --with-cpu A lot of the SVE assembly tests are for generic-tuned SVE codegen and so can fail when run on a toolchain configured with --with-cpu. This could easily be solved by forcing -mtune=generic, like we already do for -moverride=tune=none. However, the testsuite also has some useful execution tests that it would be better to run with as few flag changes as possible. Also, the flags in $sve_flags are printed as part of the test results, so each change to $sve_flags results in a change to the test summaries. This patch instead intercepts dg-options and tailors the list of additional options based on what the test is trying to do. It also gets rid of DEFAULT_CFLAGS, which are never useful for these tests. gcc/testsuite/ * lib/gcc-defs.exp (aarch64-arch-dg-options): New procedure. (aarch64-with-arch-dg-options): Likewise. * g++.target/aarch64/sve/aarch64-sve.exp: Run the tests inside aarch64-with-arch-dg-options. Move the default architecture flags to the final dg-runtest argument. * gcc.target/aarch64/sve/aarch64-sve.exp: Likewise. Dispense with DEFAULT_CFLAGS. * gcc.target/aarch64/sve2/aarch64-sve2.exp: Likewise. --- .../g++.target/aarch64/sve/aarch64-sve.exp | 10 ++-- .../gcc.target/aarch64/sve/aarch64-sve.exp | 19 ++----- .../gcc.target/aarch64/sve2/aarch64-sve2.exp | 14 ++--- gcc/testsuite/lib/gcc-defs.exp | 62 ++++++++++++++++++++++ 4 files changed, 76 insertions(+), 29 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.target/aarch64/sve/aarch64-sve.exp b/gcc/testsuite/g++.target/aarch64/sve/aarch64-sve.exp index d4761f2..2b85023 100644 --- a/gcc/testsuite/g++.target/aarch64/sve/aarch64-sve.exp +++ b/gcc/testsuite/g++.target/aarch64/sve/aarch64-sve.exp @@ -38,12 +38,10 @@ if { [check_effective_target_aarch64_sve] } { set sve_flags "-march=armv8.2-a+sve" } -# Turn off any codegen tweaks by default that may affect expected assembly. -# Tests relying on those should turn them on explicitly. -set sve_flags "$sve_flags -moverride=tune=none" - -# Main loop. -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.C]] $sve_flags "" +aarch64-with-arch-dg-options $sve_flags { + # Main loop. + dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.C]] "" $sve_flags +} # All done. dg-finish diff --git a/gcc/testsuite/gcc.target/aarch64/sve/aarch64-sve.exp b/gcc/testsuite/gcc.target/aarch64/sve/aarch64-sve.exp index 1d3f566..439a012 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/aarch64-sve.exp +++ b/gcc/testsuite/gcc.target/aarch64/sve/aarch64-sve.exp @@ -28,26 +28,15 @@ if {![istarget aarch64*-*-*] } then { # Load support procs. load_lib gcc-dg.exp -# If a testcase doesn't have special options, use these. -global DEFAULT_CFLAGS -if ![info exists DEFAULT_CFLAGS] then { - set DEFAULT_CFLAGS " -ansi -pedantic-errors" -} - # Initialize `dg'. dg-init -# Force SVE if we're not testing it already. if { [check_effective_target_aarch64_sve] } { set sve_flags "" } else { set sve_flags "-march=armv8.2-a+sve" } -# Turn off any codegen tweaks by default that may affect expected assembly. -# Tests relying on those should turn them on explicitly. -set sve_flags "$sve_flags -moverride=tune=none" - # Most of the code-quality tests are written for LP64. Just do the # correctness tests for ILP32. if { [check_effective_target_ilp32] } { @@ -56,9 +45,11 @@ if { [check_effective_target_ilp32] } { set pattern "*" } -# Main loop. -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/$pattern.\[cCS\]]] \ - $sve_flags $DEFAULT_CFLAGS +aarch64-with-arch-dg-options $sve_flags { + # Main loop. + dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/$pattern.\[cCS\]]] \ + "" $sve_flags +} # All done. dg-finish diff --git a/gcc/testsuite/gcc.target/aarch64/sve2/aarch64-sve2.exp b/gcc/testsuite/gcc.target/aarch64/sve2/aarch64-sve2.exp index fcff0d2..28d6155 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve2/aarch64-sve2.exp +++ b/gcc/testsuite/gcc.target/aarch64/sve2/aarch64-sve2.exp @@ -28,12 +28,6 @@ if {![istarget aarch64*-*-*] } then { # Load support procs. load_lib gcc-dg.exp -# If a testcase doesn't have special options, use these. -global DEFAULT_CFLAGS -if ![info exists DEFAULT_CFLAGS] then { - set DEFAULT_CFLAGS " -ansi -pedantic-errors" -} - # Initialize `dg'. dg-init @@ -44,9 +38,11 @@ if { [check_effective_target_aarch64_sve2] } { set sve2_flags "-march=armv8.5-a+sve2" } -# Main loop. -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cCS\]]] \ - $sve2_flags $DEFAULT_CFLAGS +aarch64-with-arch-dg-options $sve2_flags { + # Main loop. + dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cCS\]]] \ + "" $sve2_flags +} # All done. dg-finish diff --git a/gcc/testsuite/lib/gcc-defs.exp b/gcc/testsuite/lib/gcc-defs.exp index a36b30d..e9119f0 100644 --- a/gcc/testsuite/lib/gcc-defs.exp +++ b/gcc/testsuite/lib/gcc-defs.exp @@ -506,3 +506,65 @@ proc dg-check-dot { args } { pass "$testcase dg-check-dot $dotfile" } + +# Used by aarch64-with-arch-dg-options to intercept dg-options and make +# the changes required. See there for details. +proc aarch64-arch-dg-options { args } { + upvar dg-do-what do_what + global aarch64_default_testing_arch + + set add_arch 1 + set add_tune 1 + set checks_output [string equal [lindex $do_what 0] "compile"] + set options [lindex $args 1] + + foreach option [split $options] { + switch -glob -- $option { + -march=* { set add_arch 0 } + -mcpu=* { set add_arch 0; set add_tune 0 } + -mtune=* { set add_tune 0 } + -moverride=* { set add_tune 0 } + -save-temps { set checks_output 1 } + --save-temps { set checks_output 1 } + -fdump* { set checks_output 1 } + } + } + + if { $add_arch && ![string equal $aarch64_default_testing_arch ""] } { + # Force SVE if we're not testing it already. + append options " $aarch64_default_testing_arch" + } + + if { $add_tune && $checks_output } { + # Turn off any default tuning and codegen tweaks. + append options " -mtune=generic -moverride=tune=none" + } + + uplevel 1 aarch64-old-dg-options [lreplace $args 1 1 $options] +} + +# Run Tcl code CODE with dg-options modified to work better for some +# AArch64 tests. In particular: +# +# - If the dg-options do not specify an -march or -mcpu option, +# use the architecture options in ARCH (which might be empty). +# +# - If the dg-options do not specify an -mcpu, -mtune or -moverride option, +# and if the test appears to be checking assembly or dump output, +# force the test to use generic tuning. +# +# The idea is to handle toolchains that are configured with a default +# CPU or architecture that's different from the norm. +proc aarch64-with-arch-dg-options { arch code } { + global aarch64_default_testing_arch + + set aarch64_default_testing_arch $arch + + rename dg-options aarch64-old-dg-options + rename aarch64-arch-dg-options dg-options + + uplevel 1 $code + + rename dg-options aarch64-arch-dg-options + rename aarch64-old-dg-options dg-options +} -- cgit v1.1 From 4d224603d38d3e88f2a3c215b65c12c5f0da1d8d Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Thu, 15 Apr 2021 16:18:26 +0100 Subject: Make SVE ACLE tests work with --with-cpu This patch follows on from a previous one and adds -mtune=generic to the SVE ACLE assembler tests. These tests are pure assembly tests (execution tests are elsewhere) and they already require dg-additional-options to be used to add new options. We therefore don't need aarch64-with-arch-dg-options. gcc/testsuite/ * g++.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp: Add -mtune=generic to the SVE flags. * g++.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp: Likewise. * gcc.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp: Likewise. * gcc.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp: Likewise. --- gcc/testsuite/g++.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp | 2 +- gcc/testsuite/g++.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp | 4 ++++ gcc/testsuite/gcc.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp | 2 +- gcc/testsuite/gcc.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp | 4 ++++ 4 files changed, 10 insertions(+), 2 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp b/gcc/testsuite/g++.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp index 84ae95e..070a049 100644 --- a/gcc/testsuite/g++.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp +++ b/gcc/testsuite/g++.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp @@ -39,7 +39,7 @@ if { [check_effective_target_aarch64_sve] } { # Turn off any codegen tweaks by default that may affect expected assembly. # Tests relying on those should turn them on explicitly. -set sve_flags "$sve_flags -moverride=tune=none" +set sve_flags "$sve_flags -mtune=generic -moverride=tune=none" global gcc_runtest_parallelize_limit_minor if { [info exists gcc_runtest_parallelize_limit_minor] } { diff --git a/gcc/testsuite/g++.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp b/gcc/testsuite/g++.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp index c3a3a01..4989818 100644 --- a/gcc/testsuite/g++.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp +++ b/gcc/testsuite/g++.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp @@ -37,6 +37,10 @@ if { [check_effective_target_aarch64_sve2] } { set sve2_flags "-march=armv8.5-a+sve2" } +# Turn off any codegen tweaks by default that may affect expected assembly. +# Tests relying on those should turn them on explicitly. +set sve2_flags "$sve2_flags -mtune=generic -moverride=tune=none" + set gcc_subdir [string replace $subdir 0 2 gcc] lappend extra_flags "-fno-ipa-icf" "-I$srcdir/$gcc_subdir/../../sve/acle/asm" diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp b/gcc/testsuite/gcc.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp index fcd07aa..3522991 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp @@ -39,7 +39,7 @@ if { [check_effective_target_aarch64_sve] } { # Turn off any codegen tweaks by default that may affect expected assembly. # Tests relying on those should turn them on explicitly. -set sve_flags "$sve_flags -moverride=tune=none" +set sve_flags "$sve_flags -mtune=generic -moverride=tune=none" global gcc_runtest_parallelize_limit_minor if { [info exists gcc_runtest_parallelize_limit_minor] } { diff --git a/gcc/testsuite/gcc.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp b/gcc/testsuite/gcc.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp index 632d350..67f817d 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp +++ b/gcc/testsuite/gcc.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp @@ -37,6 +37,10 @@ if { [check_effective_target_aarch64_sve2] } { set sve2_flags "-march=armv8.5-a+sve2" } +# Turn off any codegen tweaks by default that may affect expected assembly. +# Tests relying on those should turn them on explicitly. +set sve_flags "$sve_flags -mtune=generic -moverride=tune=none" + lappend extra_flags "-fno-ipa-icf" global gcc_runtest_parallelize_limit_minor -- cgit v1.1 From 432f60c90dfb27f77e6f437bf1148f37bf73d70e Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 15 Apr 2021 12:16:48 -0400 Subject: c++: lambda in default type template-argument [PR100091] My patch for 99478 relied on local_variables_forbidden_p for distinguishing between a template parameter and its default argument, but that flag wasn't set for a default type template-argument. gcc/cp/ChangeLog: PR c++/100091 PR c++/99478 * parser.c (cp_parser_default_type_template_argument): Set parser->local_variables_forbidden_p. gcc/testsuite/ChangeLog: PR c++/100091 * g++.dg/cpp2a/lambda-uneval15.C: New test. --- gcc/testsuite/g++.dg/cpp2a/lambda-uneval15.C | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp2a/lambda-uneval15.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp2a/lambda-uneval15.C b/gcc/testsuite/g++.dg/cpp2a/lambda-uneval15.C new file mode 100644 index 0000000..ae72ea3 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/lambda-uneval15.C @@ -0,0 +1,5 @@ +// PR c++/100091 +// { dg-do compile { target c++20 } } + +template +void f() {} -- cgit v1.1 From 2efbbba16a0630fac8cadcd6d9e0ffaabfadb79f Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 15 Apr 2021 13:38:54 -0400 Subject: c++: noexcept error recursion [PR100101] Here instantiating the noexcept-specifier for bar() means instantiating A::value, which complains about the conversion from 0 to int* in the default argument of foo. Since my patch for PR99583, printing the error context involves looking at C::type, which again wants to instantiate A::value, which breaks. For now at least, let's break this recursion by avoiding looking into the noexcept-specifier in find_typenames, and limit that to just the uses_parameter_packs case that PR99583 cares about. gcc/cp/ChangeLog: PR c++/100101 PR c++/99583 * pt.c (find_parameter_packs_r) [FUNCTION_TYPE]: Walk into TYPE_RAISES_EXCEPTIONS here. * tree.c (cp_walk_subtrees): Not here. gcc/testsuite/ChangeLog: PR c++/100101 * g++.dg/cpp0x/noexcept67.C: New test. --- gcc/testsuite/g++.dg/cpp0x/noexcept67.C | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/noexcept67.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept67.C b/gcc/testsuite/g++.dg/cpp0x/noexcept67.C new file mode 100644 index 0000000..7f06103 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/noexcept67.C @@ -0,0 +1,26 @@ +// PR c++/100101 +// { dg-do compile { target c++11 } } + +template struct A +{ + template static char foo(U*, int* = 0); + static const bool value = sizeof(foo(static_cast(nullptr))) > 0; +}; + +template struct B +{ + static const bool value = b; +}; + +template struct C +{ + typedef B::value> type; +}; + +template +void bar() noexcept(A::value && C::type::value) {} + +void baz() +{ + bar(); +} -- cgit v1.1 From 2dbbbe893f75f587c48111ab4c97cf5e74fb91bb Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Thu, 15 Apr 2021 14:09:56 -0600 Subject: PR middle-end/89230 - Bogus uninited usage warning with printf gcc/testsuite/ChangeLog: * gcc.dg/uninit-pr89230-1.c: New test. * gcc.dg/uninit-pr89230-2.c: Same. --- gcc/testsuite/gcc.dg/uninit-pr89230-1.c | 25 +++++++++++++++ gcc/testsuite/gcc.dg/uninit-pr89230-2.c | 54 +++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/uninit-pr89230-1.c create mode 100644 gcc/testsuite/gcc.dg/uninit-pr89230-2.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/uninit-pr89230-1.c b/gcc/testsuite/gcc.dg/uninit-pr89230-1.c new file mode 100644 index 0000000..1c07c4f --- /dev/null +++ b/gcc/testsuite/gcc.dg/uninit-pr89230-1.c @@ -0,0 +1,25 @@ +/* PR middle-end/89230 - Bogus uninited usage warning with printf + { dg-do compile } + { dg-options "-O2 -Wall" } */ + +struct S { int i, j; }; + +/* attribute__ ((malloc)) */ struct S* f (void); + +int g (void) +{ + struct S *p = f (), *q; + + if (p->i || !(q = f ()) || p->j != q->i) + { + __builtin_printf ("%i", p->i); + + if (p->i) + return 1; + + if (!q) // { dg-bogus "\\\[-Wmaybe-uninitialized" } + return 2; + } + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/uninit-pr89230-2.c b/gcc/testsuite/gcc.dg/uninit-pr89230-2.c new file mode 100644 index 0000000..473d2da --- /dev/null +++ b/gcc/testsuite/gcc.dg/uninit-pr89230-2.c @@ -0,0 +1,54 @@ +/* PR middle-end/89230 - Bogus uninited usage warning with printf + { dg-do compile } + { dg-options "-O2 -Wall" } */ + +typedef __SIZE_TYPE__ size_t; + +extern void* memset (void*, int, size_t); +extern int printf (const char*, ...); +extern int rand (void); + +struct S +{ + int a; + int b; +}; + +struct H +{ + int c; + int d; +}; + +void getblk (void* blk) +{ + struct S* s = (struct S*) blk; + memset (blk, 0, 512); + s->a = rand () & 1; +} + +struct H* gethdr (void* blk) +{ + memset (blk, 0, 512); + return rand () & 1 ? (struct H*) blk : 0; +} + +int main (void) +{ + char blk[512], tmp[512]; + struct S *s = (struct S*) blk; + struct H *h; + + getblk (blk); + + if (s->a || !(h = gethdr (tmp)) || s->a != h->d) { + + printf ("%d\n", s->b); + if (s->a) + printf ("s->a = %d\n", s->a); + else if (!h) + printf ("!h\n"); + else + printf ("h->d = %d\n", h->d); + } +} -- cgit v1.1 From 3682052e4ccf0a29d1f61df1c8e31f8190eafafe Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 15 Apr 2021 15:13:18 -0400 Subject: c++: constexpr and volatile member function [PR80456] When calling a static member function we still need to evaluate an explicit object argument. But we don't want to force a load of the entire object if the argument is volatile, so we take its address. If as a result it no longer has any side-effects, we don't need to evaluate it after all. gcc/cp/ChangeLog: PR c++/80456 * call.c (build_new_method_call_1): Check again for side-effects with a volatile object. gcc/testsuite/ChangeLog: PR c++/80456 * g++.dg/cpp0x/constexpr-volatile3.C: New test. --- gcc/testsuite/g++.dg/cpp0x/constexpr-volatile3.C | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-volatile3.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-volatile3.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-volatile3.C new file mode 100644 index 0000000..5c1e865 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-volatile3.C @@ -0,0 +1,15 @@ +// PR c++/80456 +// { dg-do compile { target c++11 } } + +struct A { + static constexpr bool test() noexcept { return true; } + + void f() volatile { + constexpr bool b = test(); + } +}; + +void g() { + A a; + a.f(); +} -- cgit v1.1 From 58fe131b91007793c0f12f5fe6cab3f1a017d0fa Mon Sep 17 00:00:00 2001 From: Hans-Peter Nilsson Date: Thu, 15 Apr 2021 21:51:08 +0200 Subject: gcc.dg/pr84877.c: Xfail for cris-*-* Unfortunately it appears that this PR is on nobody's radar. Xfailing it to get an arguably artificial zero regression state (since T0=2007-01-05) helps my autotester. Caveat: the pass/fail state of this test, as long as stack alignment isn't adjusted, is dependent on the alignment of the stack at the entry of main, so depending on the target, e.g. the size and number of environment variables at invocation time can affect the result (including simulator runs where environment variables are propagated to the target). gcc/testsuite: PR middle-end/84877 * gcc.dg/pr84877.c: Xfail for cris-*-*. --- gcc/testsuite/gcc.dg/pr84877.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/pr84877.c b/gcc/testsuite/gcc.dg/pr84877.c index 8a34dd4..8551d27 100644 --- a/gcc/testsuite/gcc.dg/pr84877.c +++ b/gcc/testsuite/gcc.dg/pr84877.c @@ -1,4 +1,4 @@ -/* { dg-do run } */ +/* { dg-do run { xfail { cris-*-* } } } */ /* { dg-options "-O2" } */ #include -- cgit v1.1 From da879e01ecd35737c18be1da3324f4560aba1961 Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Thu, 15 Apr 2021 15:49:30 -0600 Subject: Propagate type attribute when merging extern declarations at local scope. Resolves: PR c/99420 - bogus -Warray-parameter on a function redeclaration in function scope PR c/99972 - missing -Wunused-result on a call to a locally redeclared warn_unused_result function gcc/c/ChangeLog: PR c/99420 PR c/99972 * c-decl.c (pushdecl): Always propagate type attribute. gcc/testsuite/ChangeLog: PR c/99420 PR c/99972 * gcc.dg/Warray-parameter-9.c: New test. * gcc.dg/Wnonnull-6.c: New test. * gcc.dg/Wreturn-type3.c: New test. * gcc.dg/Wunused-result.c: New test. * gcc.dg/attr-noreturn.c: New test. * gcc.dg/attr-returns-nonnull.c: New test. --- gcc/testsuite/gcc.dg/Warray-parameter-9.c | 54 +++++++++++++++++ gcc/testsuite/gcc.dg/Wnonnull-6.c | 93 +++++++++++++++++++++++++++++ gcc/testsuite/gcc.dg/Wreturn-type3.c | 54 +++++++++++++++++ gcc/testsuite/gcc.dg/Wunused-result.c | 50 ++++++++++++++++ gcc/testsuite/gcc.dg/attr-noreturn.c | 64 ++++++++++++++++++++ gcc/testsuite/gcc.dg/attr-returns-nonnull.c | 58 ++++++++++++++++++ 6 files changed, 373 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/Warray-parameter-9.c create mode 100644 gcc/testsuite/gcc.dg/Wnonnull-6.c create mode 100644 gcc/testsuite/gcc.dg/Wreturn-type3.c create mode 100644 gcc/testsuite/gcc.dg/Wunused-result.c create mode 100644 gcc/testsuite/gcc.dg/attr-noreturn.c create mode 100644 gcc/testsuite/gcc.dg/attr-returns-nonnull.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/Warray-parameter-9.c b/gcc/testsuite/gcc.dg/Warray-parameter-9.c new file mode 100644 index 0000000..b5d3d96 --- /dev/null +++ b/gcc/testsuite/gcc.dg/Warray-parameter-9.c @@ -0,0 +1,54 @@ +/* PR c/99420 - bogus -Warray-parameter on a function redeclaration + in function scope + { dg-do compile } + { dg-options "-Wall" } */ + +extern int a1[1], a2[2], a3[3], a4[4]; + +void fa1 (int [1]); // { dg-message "previously declared as 'int\\\[1]'" } +void fa1 (int [1]); + + +void nested_decl (void) +{ + void fa2 (int [2]); + + fa2 (a1); // { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" } + fa2 (a2); + fa2 (a3); + + void fa3 (int [3]); + + fa3 (a2); // { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" } + fa3 (a3); +} + + +void nested_redecl (void) +{ + void fa1 (int [2]); // { dg-warning "argument 1 of type 'int\\\[2]' with mismatched bound" } + + fa1 (a1 + 1); // { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" } + fa1 (a1); + + void fa2 (int [2]); // { dg-bogus "\\\[-Warray-parameter" } + + fa2 (a1); // { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" } + fa2 (a2); + fa2 (a3); + + void fa3 (int [3]); // { dg-bogus "\\\[-Warray-parameter" } + + fa3 (a2); // { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" } + fa3 (a3); + + void fa4 (int [4]); +} + +void fa4 (int [5]); // { dg-warning "\\\[-Warray-parameter" } + +void call_fa4 (void) +{ + fa4 (a4); + fa4 (a3); // { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" } +} diff --git a/gcc/testsuite/gcc.dg/Wnonnull-6.c b/gcc/testsuite/gcc.dg/Wnonnull-6.c new file mode 100644 index 0000000..48f09da --- /dev/null +++ b/gcc/testsuite/gcc.dg/Wnonnull-6.c @@ -0,0 +1,93 @@ +/* Verify that attribute nonnull on global and local function declarations + or those to pointers to functions is merged. + { dg-do compile } + { dg-options "-Wall" } */ + +void fnonnull_local_local (void) +{ + extern __attribute__ ((nonnull)) void fnonnull1 (void*); + + fnonnull1 (0); // { dg-warning "\\\[-Wnonnull" } +} + +void gnonnull_local_local (void) +{ + extern void fnonnull1 (void*); + + fnonnull1 (0); // { dg-warning "\\\[-Wnonnull" } +} + + +void fnonnull_local_global (void) +{ + extern __attribute__ ((nonnull)) void fnonnull2 (void*); + + fnonnull2 (0); // { dg-warning "\\\[-Wnonnull" } +} + +extern void fnonnull2 (void*); + +void gnonnull_local_global (void) +{ + fnonnull2 (0); // { dg-warning "\\\[-Wnonnull" } +} + + +extern __attribute__ ((nonnull)) void fnonnull3 (void*); + +void fnonnull_global_local (void) +{ + fnonnull3 (0); // { dg-warning "\\\[-Wnonnull" } +} + +void gnonnull_global_local (void) +{ + extern void fnonnull3 (void*); + + fnonnull3 (0); // { dg-warning "\\\[-Wnonnull" } +} + + +void pfnonnull_local_local (void) +{ + extern __attribute__ ((nonnull)) void (*pfnonnull1) (void*); + + pfnonnull1 (0); // { dg-warning "\\\[-Wnonnull" } +} + +void gpnonnull_local_local (void) +{ + extern void (*pfnonnull1) (void*); + + pfnonnull1 (0); // { dg-warning "\\\[-Wnonnull" "pr?????" { xfail *-*-* } } +} + + +void pfnonnull_local_global (void) +{ + extern __attribute__ ((nonnull)) void (*pfnonnull2) (void*); + + pfnonnull2 (0); // { dg-warning "\\\[-Wnonnull" } +} + +extern void (*pfnonnull2) (void*); + +void gpnonnull_local_global (void) +{ + pfnonnull2 (0); // { dg-warning "\\\[-Wnonnull" "pr?????" { xfail *-*-* } } +} + + +extern __attribute__ ((nonnull)) void (*pfnonnull3) (void*); + +void pfnonnull_global_local (void) +{ + pfnonnull3 (0); // { dg-warning "\\\[-Wnonnull" } +} + +void gpnonnull_global_local (void) +{ + extern void (*pfnonnull3) (void*); + + pfnonnull3 (0); // { dg-warning "\\\[-Wnonnull" } +} diff --git a/gcc/testsuite/gcc.dg/Wreturn-type3.c b/gcc/testsuite/gcc.dg/Wreturn-type3.c new file mode 100644 index 0000000..93596b3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/Wreturn-type3.c @@ -0,0 +1,54 @@ +/* Verify that attribute noreturn on global and local function declarations + is merged. + { dg-do compile } + { dg-options "-Wall" } */ + +int fnr_local_local (void) +{ + __attribute__ ((noreturn)) void fnr1 (void); + + fnr1 (); + // no return, no warning (good) +} + +int gnr_local_local (void) +{ + void fnr1 (void); + + fnr1 (); + // no return, no warning (good) +} + + +int fnr_local_global (void) +{ + __attribute__ ((noreturn)) void fnr2 (void); + + fnr2 (); + // no return, no warning (good) +} + +void fnr2 (void); + +int gnr_local_global (void) +{ + fnr2 (); + // no return, no warning (good) +} + + +__attribute__ ((noreturn)) void fnr3 (void); + +int fnr_global_local (void) +{ + fnr3 (); + // no return, no warning (good) +} + +int gnr_global_local (void) +{ + void fnr3 (void); + + fnr3 (); + // no return, no warning (good) +} diff --git a/gcc/testsuite/gcc.dg/Wunused-result.c b/gcc/testsuite/gcc.dg/Wunused-result.c new file mode 100644 index 0000000..c0bb9ae --- /dev/null +++ b/gcc/testsuite/gcc.dg/Wunused-result.c @@ -0,0 +1,50 @@ +/* PR c/99972 - missing -Wunused-result on a call to a locally redeclared + warn_unused_result function + { dg-do compile } + { dg-options "-Wall" } */ + +void gwur_local_local (void) +{ + __attribute__ ((warn_unused_result)) int fwur1 (void); + + fwur1 (); // { dg-warning "\\\[-Wunused-result" } +} + +void hwur_local_local (void) +{ + /* Verify the attribute from the declaration above is copied/merged + into the declaration below. */ + int fwur1 (void); + + fwur1 (); // { dg-warning "\\\[-Wunused-result" } +} + + +void gwur_local_global (void) +{ + __attribute__ ((warn_unused_result)) int fwur2 (void); + + fwur2 (); // { dg-warning "\\\[-Wunused-result" } +} + +int fwur2 (void); + +void hwur_local_global (void) +{ + fwur2 (); // { dg-warning "\\\[-Wunused-result" } +} + + +__attribute__ ((warn_unused_result)) int fwur3 (void); + +void gwur_global_local (void) +{ + fwur3 (); // { dg-warning "\\\[-Wunused-result" } +} + +void hwur_global_local (void) +{ + int fwur3 (void); + + fwur3 (); // { dg-warning "\\\[-Wunused-result" } +} diff --git a/gcc/testsuite/gcc.dg/attr-noreturn.c b/gcc/testsuite/gcc.dg/attr-noreturn.c new file mode 100644 index 0000000..8d58f6e --- /dev/null +++ b/gcc/testsuite/gcc.dg/attr-noreturn.c @@ -0,0 +1,64 @@ +/* Verify that attribute noreturn on global and local function declarations + is merged. + { dg-do compile } + { dg-options "-Wall -fdump-tree-optimized" } */ + +void foo (void); + +int fnr_local_local (void) +{ + __attribute__ ((noreturn)) void fnr1 (void); + + fnr1 (); + + foo (); +} + +int gnr_local_local (void) +{ + void fnr1 (void); + + fnr1 (); + + foo (); +} + + +int fnr_local_global (void) +{ + __attribute__ ((noreturn)) void fnr2 (void); + + fnr2 (); + + foo (); +} + +void fnr2 (void); + +int gnr_local_global (void) +{ + fnr2 (); + + foo (); +} + + +__attribute__ ((noreturn)) void fnr3 (void); + +int fnr_global_local (void) +{ + fnr3 (); + + foo (); +} + +int gnr_global_local (void) +{ + void fnr3 (void); + + fnr3 (); + + foo (); +} + +/* { dg-final { scan-tree-dump-not "foo" "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/attr-returns-nonnull.c b/gcc/testsuite/gcc.dg/attr-returns-nonnull.c new file mode 100644 index 0000000..22ee30a --- /dev/null +++ b/gcc/testsuite/gcc.dg/attr-returns-nonnull.c @@ -0,0 +1,58 @@ +/* Verify that attribute returns_nonnull on global and local function + declarations is merged. + { dg-do compile } + { dg-options "-Wall -fdump-tree-optimized" } */ + +void foo (void); + + +void frnn_local_local (void) +{ + __attribute__ ((returns_nonnull)) void* frnn1 (void); + + if (!frnn1 ()) + foo (); +} + +void gnr_local_local (void) +{ + void* frnn1 (void); + + if (!frnn1 ()) + foo (); +} + +void frnn_local_global (void) +{ + __attribute__ ((returns_nonnull)) void* frnn2 (void); + + if (!frnn2 ()) + foo (); +} + +void* frnn2 (void); + +void gnr_local_global (void) +{ + if (!frnn2 ()) + foo (); +} + +__attribute__ ((returns_nonnull)) void* frnn3 (void); + +void frnn_global_local (void) +{ + if (!frnn3 ()) + foo (); +} + +void gnr_global_local (void) +{ + void* frnn3 (void); + + if (!frnn3 ()) + foo (); +} + + +/* { dg-final { scan-tree-dump-not "foo" "optimized" } } */ -- cgit v1.1 From ee351f7fdbd82f8947fe9a0e74cea65d216a8549 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 16 Apr 2021 00:16:23 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 81 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d9e9168..f0e8b21 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,84 @@ +2021-04-15 Martin Sebor + + PR c/99420 + PR c/99972 + * gcc.dg/Warray-parameter-9.c: New test. + * gcc.dg/Wnonnull-6.c: New test. + * gcc.dg/Wreturn-type3.c: New test. + * gcc.dg/Wunused-result.c: New test. + * gcc.dg/attr-noreturn.c: New test. + * gcc.dg/attr-returns-nonnull.c: New test. + +2021-04-15 Hans-Peter Nilsson + + PR middle-end/84877 + * gcc.dg/pr84877.c: Xfail for cris-*-*. + +2021-04-15 Jason Merrill + + PR c++/80456 + * g++.dg/cpp0x/constexpr-volatile3.C: New test. + +2021-04-15 Martin Sebor + + * gcc.dg/uninit-pr89230-1.c: New test. + * gcc.dg/uninit-pr89230-2.c: Same. + +2021-04-15 Jason Merrill + + PR c++/100101 + * g++.dg/cpp0x/noexcept67.C: New test. + +2021-04-15 Jason Merrill + + PR c++/100091 + * g++.dg/cpp2a/lambda-uneval15.C: New test. + +2021-04-15 Richard Sandiford + + * g++.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp: Add + -mtune=generic to the SVE flags. + * g++.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp: Likewise. + * gcc.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp: Likewise. + * gcc.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp: Likewise. + +2021-04-15 Richard Sandiford + + * lib/gcc-defs.exp (aarch64-arch-dg-options): New procedure. + (aarch64-with-arch-dg-options): Likewise. + * g++.target/aarch64/sve/aarch64-sve.exp: Run the tests inside + aarch64-with-arch-dg-options. Move the default architecture + flags to the final dg-runtest argument. + * gcc.target/aarch64/sve/aarch64-sve.exp: Likewise. Dispense with + DEFAULT_CFLAGS. + * gcc.target/aarch64/sve2/aarch64-sve2.exp: Likewise. + +2021-04-15 Jakub Jelinek + + PR testsuite/100073 + * gcc.dg/pr86058.c: Enable also on i?86-*-*. + +2021-04-15 Richard Sandiford + + PR c++/98852 + * g++.target/aarch64/advsimd-intrinsics/advsimd-intrinsics.exp: New file. + * g++.target/aarch64/advsimd-intrinsics/pr98852.C: New file. + +2021-04-15 Richard Sandiford + + PR c/98852 + * gcc.target/aarch64/advsimd-intrinsics/pr98852.c: New test. + +2021-04-15 Jakub Jelinek + + PR target/100056 + * gcc.target/aarch64/pr100056.c: New test. + +2021-04-15 Stefan Schulze Frielinghaus + + * gcc.dg/pr93210.c: Adapt regex in order to also support a + RESULT_DECL as an operand for a RETURN_EXPR. + 2021-04-14 Richard Sandiford * gcc.target/aarch64/sve/pr99929_1.c: New file. -- cgit v1.1 From 89c863488bc8c7315596bcb753173aa2fd8be727 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 14 Apr 2021 17:27:19 -0400 Subject: c++: C++20 class NTTP trailing zero-init [PR100079] The new testcase was breaking because constexpr evaluation was simplifying Bar{Baz<42>{}} to Bar{empty}, but then we weren't treating them as equivalent. Poking at this revealed that the code for eliding trailing zero-initialization in class non-type template argument mangling was pretty broken, including the test, mangle71. I dealt with the FIXME to support RANGE_EXPR, and fixed the confusion between a list-initialized temporary mangled as written (i.e. in the signature of a function template) and a template parameter object mangled as the value representation of the object. I'm distinguishing between these using COMPOUND_LITERAL_P. A later patch will adjust the use of COMPOUND_LITERAL_P to be more useful for this distinction, but it works now for distinguishing these cases in mangling. gcc/cp/ChangeLog: PR c++/100079 * cp-tree.h (first_field): Declare. * mangle.c (range_expr_nelts): New. (write_expression): Improve class NTTP mangling. * pt.c (get_template_parm_object): Clear TREE_HAS_CONSTRUCTOR. * tree.c (zero_init_expr_p): Improve class NTTP handling. * decl.c: Adjust comment. gcc/testsuite/ChangeLog: PR c++/100079 * g++.dg/abi/mangle71.C: Fix expected mangling. * g++.dg/abi/mangle77.C: New test. * g++.dg/cpp2a/nontype-class-union1.C: Likewise. * g++.dg/cpp2a/nontype-class-equiv1.C: Removed. * g++.dg/cpp2a/nontype-class44.C: New test. --- gcc/testsuite/g++.dg/abi/mangle71.C | 12 ++++----- gcc/testsuite/g++.dg/abi/mangle77.C | 31 +++++++++++++++++++++++ gcc/testsuite/g++.dg/cpp2a/nontype-class-equiv1.C | 25 ------------------ gcc/testsuite/g++.dg/cpp2a/nontype-class-union1.C | 2 +- gcc/testsuite/g++.dg/cpp2a/nontype-class44.C | 25 ++++++++++++++++++ 5 files changed, 63 insertions(+), 32 deletions(-) create mode 100644 gcc/testsuite/g++.dg/abi/mangle77.C delete mode 100644 gcc/testsuite/g++.dg/cpp2a/nontype-class-equiv1.C create mode 100644 gcc/testsuite/g++.dg/cpp2a/nontype-class44.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/abi/mangle71.C b/gcc/testsuite/g++.dg/abi/mangle71.C index cb9d7d3..038befa 100644 --- a/gcc/testsuite/g++.dg/abi/mangle71.C +++ b/gcc/testsuite/g++.dg/abi/mangle71.C @@ -1,4 +1,4 @@ -// Verify manglinng of class literals of types with ctors. +// Verify mangling of class literals of types with ctors. // { dg-do compile { target c++2a } } struct A @@ -13,16 +13,16 @@ struct B { A a[3]; }; template struct X { }; void f___ (X) { } -// { dg-final { scan-assembler "_Z4f___1XIXtl1BtlA3_1AtlS1_Lc1EEEEEE" } } +// { dg-final { scan-assembler "_Z4f0001XIXtl1BEEE" } } void f0__ (X) { } -// { dg-final { scan-assembler "_Z4f0__1XIXtl1BtlA3_1AtlS1_Lc0EEtlS1_Lc1EEEEEE" } } +// { dg-final { scan-assembler "_Z4f0__1XIXtl1BtlA3_1AtlS1_EtlS1_Lc1EEtlS1_Lc1EEEEEE" } } void f00_ (X) { } -// { dg-final { scan-assembler "_Z4f00_1XIXtl1BtlA3_1AtlS1_Lc0EEtlS1_Lc0EEtlS1_Lc1EEEEEE" } } +// { dg-final { scan-assembler "_Z4f00_1XIXtl1BtlA3_1AtlS1_EtlS1_EtlS1_Lc1EEEEEE" } } void f000 (X) { } -// { dg-final { scan-assembler "_Z4f0001XIXtl1BtlA3_1AtlS1_Lc0EEtlS1_Lc0EEtlS1_Lc0EEEEEE" } } +// { dg-final { scan-assembler "_Z4f0001XIXtl1BEEE" } } void f1__ (X) { } -// { dg-final { scan-assembler "_Z4f1__1XIXtl1BtlA3_1AtlS1_Lc1EEtlS1_Lc1EEEEEE" } } +// { dg-final { scan-assembler "_Z4f1__1XIXtl1BtlA3_1AtlS1_Lc1EEtlS1_Lc1EEtlS1_Lc1EEEEEE" } } diff --git a/gcc/testsuite/g++.dg/abi/mangle77.C b/gcc/testsuite/g++.dg/abi/mangle77.C new file mode 100644 index 0000000..1181dc8 --- /dev/null +++ b/gcc/testsuite/g++.dg/abi/mangle77.C @@ -0,0 +1,31 @@ +// Test that we handle T{} differently between class non-type template +// arguments and other expressions in the signature. + +// { dg-do compile { target c++20 } } + +struct B +{ + int i; + constexpr B(int i): i(i+1) {} +}; + +struct A +{ + B b; +}; + +template T sink(T&&, Ts&&...); + +// Here A{1} is mangled as A{1}, the source representation, because expressions +// involving template parameters are compared by ODR (token-based) equivalence +// [temp.over.link]. +// { dg-final { scan-assembler "_Z1fIiEDTcl4sinktl1ALi1EEcvT__EEES1_" } } +template +decltype(sink(A{1},T())) f(T) { return A{1}; } +int main() { f(42); } + +template struct C { }; +// Here A{1} is mangled as A{B{2}}, the value representation, because template +// arguments are compared by value. +// { dg-final { scan-assembler "_Z1g1CIXtl1Atl1BLi2EEEEE" } } +void g(C) { } diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-class-equiv1.C b/gcc/testsuite/g++.dg/cpp2a/nontype-class-equiv1.C deleted file mode 100644 index 038d46f..0000000 --- a/gcc/testsuite/g++.dg/cpp2a/nontype-class-equiv1.C +++ /dev/null @@ -1,25 +0,0 @@ -// { dg-do compile { target c++20 } } - -template struct A {}; -template struct assert_same; -template struct assert_same {}; - -#define TEQ(X,Y) static_assert(__is_same(A<(X)>,A<(Y)>)) -#define TNEQ(X,Y) static_assert(!__is_same(A<(X)>,A<(Y)>)) - -union U { - int i; int j; - constexpr U(int i): i(i) {} - constexpr U(unsigned u): j(u) {} -}; - -TEQ(U(0),U(0)); - -// Calling the other constructor initializes a different member with the same -// value. We need to distinguish these. -TNEQ(U(0),U(0u)); - -// { dg-final { scan-assembler "_Z1f1AIXtl1Udi1iLi0EEEE" } } -void f(A) { } -// { dg-final { scan-assembler "_Z1g1AIXtl1Udi1jLi0EEEE" } } -void g(A) { } diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-class-union1.C b/gcc/testsuite/g++.dg/cpp2a/nontype-class-union1.C index 038d46f..df91325 100644 --- a/gcc/testsuite/g++.dg/cpp2a/nontype-class-union1.C +++ b/gcc/testsuite/g++.dg/cpp2a/nontype-class-union1.C @@ -19,7 +19,7 @@ TEQ(U(0),U(0)); // value. We need to distinguish these. TNEQ(U(0),U(0u)); -// { dg-final { scan-assembler "_Z1f1AIXtl1Udi1iLi0EEEE" } } +// { dg-final { scan-assembler "_Z1f1AIXtl1UEEE" } } void f(A) { } // { dg-final { scan-assembler "_Z1g1AIXtl1Udi1jLi0EEEE" } } void g(A) { } diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-class44.C b/gcc/testsuite/g++.dg/cpp2a/nontype-class44.C new file mode 100644 index 0000000..0316f79 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/nontype-class44.C @@ -0,0 +1,25 @@ +// PR c++/100079 +// { dg-do compile { target c++20 } } + +template +struct Foo { + using SomeTypeAlias = int; + + Foo() {} +}; + +template +struct Bar { + T value; + + constexpr Bar(const T& value) + : value{value} + {} +}; + +template +struct Baz {}; + +constexpr auto baz = Baz<42>{}; + +const Foo>{baz}> test{}; -- cgit v1.1 From 76c7e7d6b003a17d183d0571bf9b34c691819d25 Mon Sep 17 00:00:00 2001 From: Stefan Schulze Frielinghaus Date: Fri, 16 Apr 2021 07:48:34 +0200 Subject: testsuite: Fix unroll-and-jam.c on IBM Z For z10 and newer inner loops are completely unrolled which leaves no inner loops to jam which renders this testcase to fail. Reverting max-completely-peel-times to the default value fixes this testcase. gcc/testsuite/ChangeLog: * gcc.dg/unroll-and-jam.c: Revert max-completely-peel-times to the default value on IBM Z. --- gcc/testsuite/gcc.dg/unroll-and-jam.c | 1 + 1 file changed, 1 insertion(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/unroll-and-jam.c b/gcc/testsuite/gcc.dg/unroll-and-jam.c index 7eb6421..b8f4f16 100644 --- a/gcc/testsuite/gcc.dg/unroll-and-jam.c +++ b/gcc/testsuite/gcc.dg/unroll-and-jam.c @@ -1,5 +1,6 @@ /* { dg-do run } */ /* { dg-options "-O3 -floop-unroll-and-jam -fno-tree-loop-im --param unroll-jam-min-percent=0 -fdump-tree-unrolljam-details" } */ +/* { dg-additional-options "--param max-completely-peel-times=16" { target { s390*-*-* } } } */ /* { dg-require-effective-target int32plus } */ #include -- cgit v1.1 From 20eb7a1891cfd7fa85295a236cebe0322d041edd Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 16 Apr 2021 09:32:44 +0200 Subject: c++: Fix up handling of structured bindings in extract_locals_r [PR99833] The following testcase ICEs in tsubst_decomp_names because the assumptions that the structured binding artificial var is followed in DECL_CHAIN by the corresponding structured binding vars is violated. I've tracked it to extract_locals* which is done for the constexpr IF_STMT. extract_locals_r when it sees a DECL_EXPR adds that decl into a hash set so that such decls aren't returned from extract_locals*, but in the case of a structured binding that just means the artificial var and not the vars corresponding to structured binding identifiers. The following patch fixes it by pushing not just the artificial var for structured bindings but also the other vars. 2021-04-16 Jakub Jelinek PR c++/99833 * pt.c (extract_locals_r): When handling DECL_EXPR of a structured binding, add to data.internal also all corresponding structured binding decls. * g++.dg/cpp1z/pr99833.C: New test. * g++.dg/cpp2a/pr99833.C: New test. --- gcc/testsuite/g++.dg/cpp1z/pr99833.C | 11 +++++++++++ gcc/testsuite/g++.dg/cpp2a/pr99833.C | 18 ++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1z/pr99833.C create mode 100644 gcc/testsuite/g++.dg/cpp2a/pr99833.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp1z/pr99833.C b/gcc/testsuite/g++.dg/cpp1z/pr99833.C new file mode 100644 index 0000000..f7c9958 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/pr99833.C @@ -0,0 +1,11 @@ +// PR c++/99833 +// { dg-do compile { target c++17 } } + +struct S { int a, b; }; +template +void +foo () +{ + [](auto d) { if constexpr (auto [a, b]{d}; sizeof (a) > 0) a++; } (S{}); +} +template void foo (); diff --git a/gcc/testsuite/g++.dg/cpp2a/pr99833.C b/gcc/testsuite/g++.dg/cpp2a/pr99833.C new file mode 100644 index 0000000..3323053 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/pr99833.C @@ -0,0 +1,18 @@ +// PR c++/99833 +// { dg-do compile { target c++20 } } + +#include + +auto f(auto&& x) +{ + [&](auto...) { + auto y = std::tuple{ "what's happening here?", x }; + if constexpr (auto [_, z] = y; requires { z; }) + return; + }(); +} + +int main() +{ + f(42); +} -- cgit v1.1 From 784de5292c34e287c848b382b431599b818ea76e Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 16 Apr 2021 09:34:26 +0200 Subject: c++: Fix up C++23 [] <...> requires primary -> type {} parsing [PR99850] The requires clause parsing has code to suggest users wrapping non-primary expressions in (), so if it e.g. parses a primary expression and sees it is followed by ++, --, ., ( or -> among other things it will try to reparse it as assignment expression or what and if that works suggests wrapping it inside of parens. When it is requires-clause that is after etc. it already has an exception from that as ( can occur in valid C++20 expression there - starting the parameters of the lambda. In C++23 another case can occur, as the parameters with the ()s can be omitted, requires C can be followed immediately by -> which starts a trailing return type. Even in that case, we don't want to parse that as C->... 2021-04-16 Jakub Jelinek PR c++/99850 * parser.c (cp_parser_constraint_requires_parens) : If lambda_p, return pce_ok instead of pce_maybe_postfix. * g++.dg/cpp23/lambda-specifiers2.C: New test. --- gcc/testsuite/g++.dg/cpp23/lambda-specifiers2.C | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp23/lambda-specifiers2.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp23/lambda-specifiers2.C b/gcc/testsuite/g++.dg/cpp23/lambda-specifiers2.C new file mode 100644 index 0000000..0cc69be --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp23/lambda-specifiers2.C @@ -0,0 +1,7 @@ +// PR c++/99850 +// P1102R2 - Down with ()! +// { dg-do compile { target c++23 } } + +auto l = [] requires true -> void {}; +template concept C = true; +auto m = [] requires (C && ...) -> void {}; -- cgit v1.1 From b44ab138b7d4aaa5a9ee7956121ffc94777f6a42 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 16 Apr 2021 11:44:04 +0200 Subject: vectorizer: Remove dead scalar .COND_* calls from vectorized loops [PR99767] The following testcase ICEs because disabling of DCE means there are dead stmts in the loop (though, in theory they could become dead only shortly before if-conv through some optimization), ifcvt which goes through all stmts in the loop if-converts them into .COND_DIV etc. internal fn calls in the copy of the loop meant for vectorization only, the loop is successfully vectorized but the particular .COND_* call is not because it isn't a live statement and the scalar .COND_* remains in the IL until expansion where it ICEs because these ifns only support vectors and not scalars. These ifns are similar to .MASK_{LOAD,STORE} in this behavior. One possible fix could be to expand scalar versions of them during expansion, basically undoing what if-conv did to create them, i.e. expand them as the lhs = else; if (mask) { lhs = statement; } or so. For .MASK_LOAD we have code to replace them in vect_transform_loop already though (not needed for .MASK_STORE, as stores should be always live and thus always vectorized), so this patch instead replaces .COND_* similarly to .MASK_LOAD in that loop, with the small difference that lhs = .MASK_LOAD (...); is replaced by lhs = 0; while lhs = .COND_* (..., else_arg); is replaced by lhs = else_arg. The statement must be dead, otherwise it would be vectorized, so I think it is not a big deal we don't turn it back into multiple basic blocks etc. (and it might be not possible to do that at that point). 2021-04-16 Jakub Jelinek PR target/99767 * tree-vect-loop.c (vect_transform_loop): Don't remove just dead scalar .MASK_LOAD calls, but also dead .COND_* calls - replace them by their last argument. * gcc.target/aarch64/pr99767.c: New test. --- gcc/testsuite/gcc.target/aarch64/pr99767.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 gcc/testsuite/gcc.target/aarch64/pr99767.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/aarch64/pr99767.c b/gcc/testsuite/gcc.target/aarch64/pr99767.c new file mode 100644 index 0000000..5bbfcbd --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr99767.c @@ -0,0 +1,16 @@ +/* PR target/99767 */ +/* { dg-do compile } */ +/* { dg-options " -O1 -fopenmp-simd -fno-tree-dce -march=armv8-a+sve" } */ + +int a[1024], b[1024]; + +void +foo (void) +{ + #pragma omp simd + for (int i = 0; i < 1024; i++) + if (b[i] > 23) { + a[i] = b[i] + 1; + int v = 1 / 0; /* { dg-warning "division by zero" } */ + } +} -- cgit v1.1 From 69e7f04ff677d5e402f937b23422567c10243ee9 Mon Sep 17 00:00:00 2001 From: Richard Earnshaw Date: Fri, 16 Apr 2021 11:58:17 +0100 Subject: arm: Fix some testsuite fallout from r11-8168 [PR100067] Commit r11-8168 changed the word ordering of a warning in order to make the text more consistent. Unfortunately, it neglected to update some filters in the testsuite that are intended to strip such warnings when we try to partially override the user-supplied command-line options. This patch rectifies this and also fixes some patterns that were incorrectly specified in the first place. gcc/testsuite: PR target/100067 * g++.target/arm/arm.exp (dg_runtest_extra_prunes): Update prune template. * gcc.target/arm/arm.exp (dg_runtest_extra_prunes): Likewise. * g++.target/arm/mve.exp (dg_runtest_extra_prunes): Likewise. Fix missing quotes around switch names. * gcc.target/arm/mve/mve.exp: (dg_runtest_extra_prunes): Likewise. --- gcc/testsuite/g++.target/arm/arm.exp | 2 +- gcc/testsuite/g++.target/arm/mve.exp | 2 +- gcc/testsuite/gcc.target/arm/arm.exp | 2 +- gcc/testsuite/gcc.target/arm/mve/mve.exp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.target/arm/arm.exp b/gcc/testsuite/g++.target/arm/arm.exp index 182c1e9..7d873a4 100644 --- a/gcc/testsuite/g++.target/arm/arm.exp +++ b/gcc/testsuite/g++.target/arm/arm.exp @@ -35,7 +35,7 @@ if ![info exists DEFAULT_CXXFLAGS] then { global dg_runtest_extra_prunes set dg_runtest_extra_prunes "" -lappend dg_runtest_extra_prunes "warning: switch '-m(cpu|arch)=.*' conflicts with '-m(cpu|arch)=.*' switch" +lappend dg_runtest_extra_prunes "warning: switch '-m(cpu|arch)=.*' conflicts with switch '-m(cpu|arch)=.*'" # Initialize `dg'. dg-init diff --git a/gcc/testsuite/g++.target/arm/mve.exp b/gcc/testsuite/g++.target/arm/mve.exp index 82cf928..ed62561 100644 --- a/gcc/testsuite/g++.target/arm/mve.exp +++ b/gcc/testsuite/g++.target/arm/mve.exp @@ -33,7 +33,7 @@ if ![info exists DEFAULT_CXXFLAGS] then { # This variable should only apply to tests called in this exp file. global dg_runtest_extra_prunes set dg_runtest_extra_prunes "" -lappend dg_runtest_extra_prunes "warning: switch -m(cpu|arch)=.* conflicts with -m(cpu|arch)=.* switch" +lappend dg_runtest_extra_prunes "warning: switch '-m(cpu|arch)=.*' conflicts with switch '-m(cpu|arch)=.*'" set save-dg-do-what-default ${dg-do-what-default} set dg-do-what-default "assemble" diff --git a/gcc/testsuite/gcc.target/arm/arm.exp b/gcc/testsuite/gcc.target/arm/arm.exp index d306573..4d7c2ad 100644 --- a/gcc/testsuite/gcc.target/arm/arm.exp +++ b/gcc/testsuite/gcc.target/arm/arm.exp @@ -33,7 +33,7 @@ if ![info exists DEFAULT_CFLAGS] then { # This variable should only apply to tests called in this exp file. global dg_runtest_extra_prunes set dg_runtest_extra_prunes "" -lappend dg_runtest_extra_prunes "warning: switch '-m(cpu|arch)=.*' conflicts with '-m(cpu|arch)=.*' switch" +lappend dg_runtest_extra_prunes "warning: switch '-m(cpu|arch)=.*' conflicts with switch '-m(cpu|arch)=.*'" # Initialize `dg'. dg-init diff --git a/gcc/testsuite/gcc.target/arm/mve/mve.exp b/gcc/testsuite/gcc.target/arm/mve/mve.exp index f8590bf..d09fc27 100644 --- a/gcc/testsuite/gcc.target/arm/mve/mve.exp +++ b/gcc/testsuite/gcc.target/arm/mve/mve.exp @@ -33,7 +33,7 @@ if ![info exists DEFAULT_CFLAGS] then { # This variable should only apply to tests called in this exp file. global dg_runtest_extra_prunes set dg_runtest_extra_prunes "" -lappend dg_runtest_extra_prunes "warning: switch -m(cpu|arch)=.* conflicts with -m(cpu|arch)=.* switch" +lappend dg_runtest_extra_prunes "warning: switch '-m(cpu|arch)=.*' conflicts with switch '-m(cpu|arch)=.*'" set dg-do-what-default "assemble" -- cgit v1.1 From b4d6af55fe55c0eab87ab875bfd0346677e12236 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Fri, 16 Apr 2021 12:38:01 +0100 Subject: rtlanal: Don't assume that calls write to a global SP [PR99596] This patch is a GCC 11 regression caused by the rtl-ssa code. Normally we treat calls as containing a potential set of a global register, but DF makes a sensible exception for the stack pointer: if (i == STACK_POINTER_REGNUM) /* The stack ptr is used (honorarily) by a CALL insn. */ df_ref_record (DF_REF_BASE, collection_rec, regno_reg_rtx[i], NULL, bb, insn_info, DF_REF_REG_USE, DF_REF_CALL_STACK_USAGE | flags); else if (global_regs[i]) { /* Calls to const functions cannot access any global registers and calls to pure functions cannot set them. All other calls may reference any of the global registers, so they are recorded as used. */ The only DF definition of SP was therefore the one in the entry block. However, the rtlanal.c rtx_properties code (wrongly) assumed that calls also clobbered the global SP. This led to multiple definitions of SP when we only expected one. This patch tightens the rtlanal.c handling of global registers to match the DF approach. gcc/ PR rtl-optimization/99596 * rtlanal.c (rtx_properties::try_to_add_insn): Don't add global register accesses for const calls. Assume that pure functions can only read from global registers. Ignore cases in which the stack pointer has been marked global. gcc/testsuite/ PR rtl-optimization/99596 * gcc.target/arm/pr99596.c: New test. --- gcc/testsuite/gcc.target/arm/pr99596.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 gcc/testsuite/gcc.target/arm/pr99596.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/arm/pr99596.c b/gcc/testsuite/gcc.target/arm/pr99596.c new file mode 100644 index 0000000..2b8b4c8 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pr99596.c @@ -0,0 +1,18 @@ +/* { dg-options "-Os -mtune=xscale" } */ + +register int a asm("sp"); +extern int b; +typedef struct { + long c[16 * 8 / 32]; +} d; +int e; +int f; +int g; +d h; +int j(int, int, int, d); +int i(void) { + for (;;) { + b &&j(e, f, g, h); + j(e, f, g, h); + } +} -- cgit v1.1 From 47f42744f6e10ad41db926d739306e6f237fd3ac Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 16 Apr 2021 13:44:23 +0200 Subject: aarch64: Fix up 2 other combine opt regressions vs. GCC8 [PR100075] The testcase used to be compiled at -O2 by GCC8 and earlier to: f1: neg w1, w0, asr 16 and w1, w1, 65535 orr w0, w1, w0, lsl 16 ret f2: neg w1, w0 extr w0, w1, w0, 16 ret but since GCC9 (r9-3594 for f1 and r9-6926 for f2) we compile it into: f1: mov w1, w0 sbfx x0, x1, 16, 16 neg w0, w0 bfi w0, w1, 16, 16 ret f2: neg w1, w0 sbfx x0, x0, 16, 16 bfi w0, w1, 16, 16 ret instead, i.e. one insn longer each. With this patch we get: f1: mov w1, w0 neg w0, w1, asr 16 bfi w0, w1, 16, 16 ret f2: neg w1, w0 extr w0, w1, w0, 16 ret i.e. identical f2 and same number of insns as in GCC8 in f1. The combiner unfortunately doesn't try splitters when doing 2 -> 1 combination, so it can't be implemented as combine splitters, but it could be implemented as define_insn_and_split if desirable. 2021-04-16 Jakub Jelinek PR target/100075 * config/aarch64/aarch64.md (*neg_asr_si2_extr, *extrsi5_insn_di): New define_insn patterns. * gcc.target/aarch64/pr100075.c: New test. --- gcc/testsuite/gcc.target/aarch64/pr100075.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 gcc/testsuite/gcc.target/aarch64/pr100075.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/aarch64/pr100075.c b/gcc/testsuite/gcc.target/aarch64/pr100075.c new file mode 100644 index 0000000..6bdaa2f --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr100075.c @@ -0,0 +1,20 @@ +/* PR target/100075 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +/* { dg-final { scan-assembler-not {\tsbfx\tx[0-9]+, x[0-9]+, 16, 16} } } */ +/* { dg-final { scan-assembler {\tneg\tw[0-9]+, w[0-9]+, asr 16} } } */ +/* { dg-final { scan-assembler {\textr\tw[0-9]+, w[0-9]+, w[0-9]+, 16} } } */ + +struct S { short x, y; }; + +struct S +f1 (struct S p) +{ + return (struct S) { -p.y, p.x }; +} + +struct S +f2 (struct S p) +{ + return (struct S) { p.y, -p.x }; +} -- cgit v1.1 From baf05d54dc919c968d12de9d049e36e5bac10dec Mon Sep 17 00:00:00 2001 From: Patrick Palka Date: Fri, 16 Apr 2021 09:24:46 -0400 Subject: c++: partially initialized constexpr array [PR99700] Here, reduced_constant_expression_p is incorrectly returning true for a partially initialized array CONSTRUCTOR (in C++20 mode) because when the CONSTRUCTOR_NO_CLEARING flag is set, the predicate doesn't check that the CONSTRUCTOR spans the entire array like it does for class CONSTRUCTORS. This patch adds a dedicated loop for the array case that simultaneously verifies the CONSTRUCTOR spans the entire array and is made up of valid constant expressions. gcc/cp/ChangeLog: PR c++/99700 * constexpr.c (reduced_constant_expression_p): For array CONSTRUCTORs, use a dedicated loop that additionally verifies the CONSTRUCTOR spans the entire array. gcc/testsuite/ChangeLog: PR c++/99700 * g++.dg/cpp2a/constexpr-init21.C: New test. --- gcc/testsuite/g++.dg/cpp2a/constexpr-init21.C | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp2a/constexpr-init21.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-init21.C b/gcc/testsuite/g++.dg/cpp2a/constexpr-init21.C new file mode 100644 index 0000000..f5e1b3e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-init21.C @@ -0,0 +1,27 @@ +// PR c++/99700 +// { dg-do compile { target c++20 } } + +template +struct A { + T c[5]; + constexpr A(int skip = -1) { + for (int i = 0; i < 5; i++) + if (i != skip) + c[i] = {}; + } +}; + +constexpr A a; +constexpr A a0(0); // { dg-error "not a constant expression|incompletely initialized" } +constexpr A a1(1); // { dg-error "not a constant expression|incompletely initialized" } +constexpr A a2(2); // { dg-error "not a constant expression|incompletely initialized" } +constexpr A a3(3); // { dg-error "not a constant expression|incompletely initialized" } +constexpr A a4(4); // { dg-error "not a constant expression|incompletely initialized" } + +struct s { int n; }; +constexpr A b; +constexpr A b0(0); // { dg-error "not a constant expression|incompletely initialized" } + +struct empty {}; +constexpr A c; +constexpr A c0(0); -- cgit v1.1 From 330ae1e54305f4755258d89469c1ad0d8479ef4c Mon Sep 17 00:00:00 2001 From: Stefan Schulze Frielinghaus Date: Fri, 16 Apr 2021 16:03:07 +0200 Subject: testsuite: Fix pr83403-{1,2}.c on IBM Z For z10 and newer inner loops are completely unrolled which means store motion is not applied. Reverting max-completely-peeled-insns to the default value fixes these testcases. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/pr83403-1.c: Revert max-completely-peeled-insns to the default value on IBM Z. * gcc.dg/tree-ssa/pr83403-2.c: Likewise. --- gcc/testsuite/gcc.dg/tree-ssa/pr83403-1.c | 1 + gcc/testsuite/gcc.dg/tree-ssa/pr83403-2.c | 1 + 2 files changed, 2 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr83403-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr83403-1.c index 748375b..bfc703d 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr83403-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr83403-1.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O3 -funroll-loops -fdump-tree-lim2-details" } */ +/* { dg-additional-options "--param max-completely-peeled-insns=200" { target { s390*-*-* } } } */ #define TYPE unsigned int diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr83403-2.c b/gcc/testsuite/gcc.dg/tree-ssa/pr83403-2.c index ca2e6bb..9130d9b 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr83403-2.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr83403-2.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O3 -funroll-loops -fdump-tree-lim2-details" } */ +/* { dg-additional-options "--param max-completely-peeled-insns=200" { target { s390*-*-* } } } */ #define TYPE int -- cgit v1.1 From d264194c1069fbcd129222f86455137f29a5c6fd Mon Sep 17 00:00:00 2001 From: Harald Anlauf Date: Fri, 16 Apr 2021 16:24:31 +0200 Subject: PR fortran/63797 - Bogus ambiguous reference to 'sqrt' The interface of an intrinsic procedure is automatically explicit. Do not write it to the module file to prevent wrong ambiguities on USE. gcc/fortran/ChangeLog: PR fortran/63797 * module.c (write_symtree): Do not write interface of intrinsic procedure to module file for F2003 and newer. gcc/testsuite/ChangeLog: PR fortran/63797 * gfortran.dg/pr63797.f90: New test. Co-authored-by: Paul Thomas --- gcc/testsuite/gfortran.dg/pr63797.f90 | 60 +++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/pr63797.f90 (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gfortran.dg/pr63797.f90 b/gcc/testsuite/gfortran.dg/pr63797.f90 new file mode 100644 index 0000000..1131e81 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr63797.f90 @@ -0,0 +1,60 @@ +! { dg-do compile } +! PR63797 - Bogus ambiguous reference to 'sqrt' + +module mod1 + implicit none + real, parameter :: z = sqrt (0.0) + real :: w = sqrt (1.0) + interface + pure real function sqrt_ifc (x) + real, intent(in) :: x + end function sqrt_ifc + end interface +contains + pure function myroot () result (f) + procedure(sqrt_ifc), pointer :: f + intrinsic :: sqrt + f => sqrt + end function myroot +end module mod1 + +module mod2 + implicit none + type t + real :: a = 0. + end type + interface sqrt + module procedure sqrt + end interface +contains + elemental function sqrt (a) + type(t), intent(in) :: a + type(t) :: sqrt + sqrt% a = a% a + end function sqrt +end module mod2 + +module mod3 + implicit none + abstract interface + function real_func (x) + real :: real_func + real, intent (in) :: x + end function real_func + end interface + intrinsic :: sqrt + procedure(real_func), pointer :: real_root => sqrt +end module mod3 + +program test + use mod1 + use mod2 + use mod3 + implicit none + type(t) :: x, y + procedure(sqrt_ifc), pointer :: root + root => myroot () + y = sqrt (x) + y% a = sqrt (x% a) + z - w + root (x% a) + y% a = real_root (x% a) +end program test -- cgit v1.1 From eb8c931e0dbf1d7d9bc1279cab68a963e8f3c299 Mon Sep 17 00:00:00 2001 From: Robin Dapp Date: Wed, 17 Mar 2021 09:08:42 +0100 Subject: testsuite: Move gimplefe-4[0|1] tests. The gimplefe-40.c and gimplefe-41.c test cases require vect_* effective targets even though they reside in gcc.dg. By default e.g. DEFAULT_VECTCFLAGS which is used to add target-specific machine or build flags is only applied in the ./vect subdirectory. Move these tests there. gcc/testsuite/ChangeLog: * gcc.dg/gimplefe-40.c: Moved to... * gcc.dg/vect/gimplefe-40.c: ...here. * gcc.dg/gimplefe-41.c: Moved to... * gcc.dg/vect/gimplefe-41.c: ...here. --- gcc/testsuite/gcc.dg/gimplefe-40.c | 24 -------------------- gcc/testsuite/gcc.dg/gimplefe-41.c | 40 --------------------------------- gcc/testsuite/gcc.dg/vect/gimplefe-40.c | 24 ++++++++++++++++++++ gcc/testsuite/gcc.dg/vect/gimplefe-41.c | 40 +++++++++++++++++++++++++++++++++ 4 files changed, 64 insertions(+), 64 deletions(-) delete mode 100644 gcc/testsuite/gcc.dg/gimplefe-40.c delete mode 100644 gcc/testsuite/gcc.dg/gimplefe-41.c create mode 100644 gcc/testsuite/gcc.dg/vect/gimplefe-40.c create mode 100644 gcc/testsuite/gcc.dg/vect/gimplefe-41.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/gimplefe-40.c b/gcc/testsuite/gcc.dg/gimplefe-40.c deleted file mode 100644 index 3c5bb4c..0000000 --- a/gcc/testsuite/gcc.dg/gimplefe-40.c +++ /dev/null @@ -1,24 +0,0 @@ -/* { dg-do compile { target { int128 && vect_float } } } */ -/* { dg-options "-fgimple -Wno-psabi -w" } */ -/* { dg-additional-options "-maltivec" { target { powerpc*-*-* && powerpc_altivec_ok } } } */ - -typedef float v4sf __attribute__((vector_size(16))); -v4sf __GIMPLE (ssa) -load (const void * p) -{ - __int128 unsigned _3; - v4sf _4; - v4sf _6; - float _5; - - __BB(2): - _3 = __MEM <__int128 unsigned, 8> ((char *)p_2(D)); - _4 = __VIEW_CONVERT (_3); -#if __SIZEOF_FLOAT__ == 4 - _5 = __BIT_FIELD_REF (_4, 32, 64); -#else - _5 = 1.0f; -#endif - _6 = __BIT_INSERT (_4, _5, 0); - return _6; -} diff --git a/gcc/testsuite/gcc.dg/gimplefe-41.c b/gcc/testsuite/gcc.dg/gimplefe-41.c deleted file mode 100644 index e52a3a5..0000000 --- a/gcc/testsuite/gcc.dg/gimplefe-41.c +++ /dev/null @@ -1,40 +0,0 @@ -/* { dg-do compile { target { vect_double && vect_long_long } } } */ -/* { dg-options "-fgimple -Wno-psabi -w" } */ -/* { dg-additional-options "-msse2" { target x86_64-*-* i?86-*-* } } */ - -typedef double __v2df __attribute__ ((__vector_size__ (16))); -typedef unsigned long long __v2di __attribute__ ((__vector_size__ (16))); - -__v2df __GIMPLE (ssa) -_mm_add_sd (__v2df x, __v2df y) -{ - __v2df z; - double _1; - double _2; - double _3; - __v2df _7; - - __BB(2): - _1 = __BIT_FIELD_REF (x_4(D), 64u, 0u); - _2 = __BIT_FIELD_REF (y_5(D), 64u, 0u); - _3 = _1 + _2; - _7 = _Literal (__v2df) {_3, _3}; - z_6 = __VEC_PERM (x_4(D), _7, _Literal (__v2di) { 2ul, 1ul }); - return z_6; -} - -__v2df __GIMPLE (ssa) -_mm_add_sd2 (__v2df x, __v2df y) -{ - __v2df z; - double _1; - double _2; - double _3; - - __BB(2): - _1 = __BIT_FIELD_REF (x_4(D), 64u, 0u); - _2 = __BIT_FIELD_REF (y_5(D), 64u, 0u); - _3 = _1 + _2; - z_6 = __BIT_INSERT (x_4(D), _3, 0); - return z_6; -} diff --git a/gcc/testsuite/gcc.dg/vect/gimplefe-40.c b/gcc/testsuite/gcc.dg/vect/gimplefe-40.c new file mode 100644 index 0000000..3c5bb4c --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/gimplefe-40.c @@ -0,0 +1,24 @@ +/* { dg-do compile { target { int128 && vect_float } } } */ +/* { dg-options "-fgimple -Wno-psabi -w" } */ +/* { dg-additional-options "-maltivec" { target { powerpc*-*-* && powerpc_altivec_ok } } } */ + +typedef float v4sf __attribute__((vector_size(16))); +v4sf __GIMPLE (ssa) +load (const void * p) +{ + __int128 unsigned _3; + v4sf _4; + v4sf _6; + float _5; + + __BB(2): + _3 = __MEM <__int128 unsigned, 8> ((char *)p_2(D)); + _4 = __VIEW_CONVERT (_3); +#if __SIZEOF_FLOAT__ == 4 + _5 = __BIT_FIELD_REF (_4, 32, 64); +#else + _5 = 1.0f; +#endif + _6 = __BIT_INSERT (_4, _5, 0); + return _6; +} diff --git a/gcc/testsuite/gcc.dg/vect/gimplefe-41.c b/gcc/testsuite/gcc.dg/vect/gimplefe-41.c new file mode 100644 index 0000000..e52a3a5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/gimplefe-41.c @@ -0,0 +1,40 @@ +/* { dg-do compile { target { vect_double && vect_long_long } } } */ +/* { dg-options "-fgimple -Wno-psabi -w" } */ +/* { dg-additional-options "-msse2" { target x86_64-*-* i?86-*-* } } */ + +typedef double __v2df __attribute__ ((__vector_size__ (16))); +typedef unsigned long long __v2di __attribute__ ((__vector_size__ (16))); + +__v2df __GIMPLE (ssa) +_mm_add_sd (__v2df x, __v2df y) +{ + __v2df z; + double _1; + double _2; + double _3; + __v2df _7; + + __BB(2): + _1 = __BIT_FIELD_REF (x_4(D), 64u, 0u); + _2 = __BIT_FIELD_REF (y_5(D), 64u, 0u); + _3 = _1 + _2; + _7 = _Literal (__v2df) {_3, _3}; + z_6 = __VEC_PERM (x_4(D), _7, _Literal (__v2di) { 2ul, 1ul }); + return z_6; +} + +__v2df __GIMPLE (ssa) +_mm_add_sd2 (__v2df x, __v2df y) +{ + __v2df z; + double _1; + double _2; + double _3; + + __BB(2): + _1 = __BIT_FIELD_REF (x_4(D), 64u, 0u); + _2 = __BIT_FIELD_REF (y_5(D), 64u, 0u); + _3 = _1 + _2; + z_6 = __BIT_INSERT (x_4(D), _3, 0); + return z_6; +} -- cgit v1.1 From 70f2bff43aadd2fcc0595bf9f4bab72647529655 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Wed, 14 Apr 2021 17:57:15 -0400 Subject: c++: ICE with bogus late return type [PR99803] Here we ICE when compiling this code in C++20, because we're trying to slam a 'typename' after the ->. The cp_parser_template_id call just before the spot I'm changing parsed A::template A as a BASELINK that contains a constructor, but make_typename_type crashes on that. This patch makes make_typename_type more robust instead of checking for is_overloaded_fn prior calling it. gcc/cp/ChangeLog: PR c++/99803 * decl.c (make_typename_type): Give an error and return when name is is_overloaded_fn. * parser.c (cp_parser_class_name): Don't check is_overloaded_fn before calling make_typename_type. gcc/testsuite/ChangeLog: PR c++/99803 * g++.dg/cpp2a/typename14.C: Don't expect particular error messages. * g++.dg/cpp2a/typename19.C: New test. --- gcc/testsuite/g++.dg/cpp2a/typename14.C | 4 ++-- gcc/testsuite/g++.dg/cpp2a/typename19.C | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp2a/typename19.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp2a/typename14.C b/gcc/testsuite/g++.dg/cpp2a/typename14.C index 8d82b6b..ba7dad8 100644 --- a/gcc/testsuite/g++.dg/cpp2a/typename14.C +++ b/gcc/testsuite/g++.dg/cpp2a/typename14.C @@ -8,7 +8,7 @@ template struct A template template -A::A () // { dg-error "partial specialization" } +A::A () // { dg-error "" } { } @@ -19,7 +19,7 @@ template struct B template template -B::foo(int) // { dg-error "partial specialization|declaration" } +B::foo(int) // { dg-error "" } { return 1; } diff --git a/gcc/testsuite/g++.dg/cpp2a/typename19.C b/gcc/testsuite/g++.dg/cpp2a/typename19.C new file mode 100644 index 0000000..320a14d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/typename19.C @@ -0,0 +1,5 @@ +// PR c++/99803 +// { dg-do compile { target c++20 } } + +struct A { template A(T); }; +auto A(unsigned) -> A::template A; // { dg-error "not a type" } -- cgit v1.1 From 35e8b38a91d9fb49a4759649576f15e76c129d99 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 16 Apr 2021 17:37:07 +0200 Subject: c++: Fix empty base stores in cxx_eval_store_expression [PR100111] In r11-6895 handling of empty bases has been fixed such that non-lval stores of empty classes are not added when the type of *valp doesn't match the type of the initializer, but as this testcase shows it is done only when *valp is non-NULL. If it is NULL, we still shouldn't add empty class constructors if the type of the constructor elt *valp points to doesn't match. 2021-04-16 Jakub Jelinek PR c++/100111 * constexpr.c (cxx_eval_store_expression): Don't add CONSTRUCTORs for empty classes into *valp when types don't match even when *valp is NULL. * g++.dg/cpp0x/constexpr-100111.C: New test. --- gcc/testsuite/g++.dg/cpp0x/constexpr-100111.C | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-100111.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-100111.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-100111.C new file mode 100644 index 0000000..446d21d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-100111.C @@ -0,0 +1,7 @@ +// PR c++/100111 +// { dg-do compile { target c++11 } } +// { dg-options "-fno-elide-constructors" } + +struct A {}; +struct B : A { int b; constexpr B (A x) : A(x), b() {} }; +struct C { B c; constexpr C () : c({}) {} } d; -- cgit v1.1 From 8535755af70f819d820553b2e73e72a16a984599 Mon Sep 17 00:00:00 2001 From: Tamar Christina Date: Fri, 16 Apr 2021 16:58:50 +0100 Subject: SVE: Fix wrong sve predicate split (PR100048) The attached testcase generates the following paradoxical subregs when creating the predicates. (insn 22 21 23 2 (set (reg:VNx8BI 100) (subreg:VNx8BI (reg:VNx2BI 103) 0)) (expr_list:REG_EQUAL (const_vector:VNx8BI [ (const_int 1 [0x1]) (const_int 0 [0]) (const_int 1 [0x1]) (const_int 0 [0]) repeated x5 ]) (nil))) and (insn 15 14 16 2 (set (reg:VNx8BI 96) (subreg:VNx8BI (reg:VNx2BI 99) 0)) (expr_list:REG_EQUAL (const_vector:VNx8BI [ (const_int 1 [0x1]) (const_int 0 [0]) repeated x7 ]) (nil))) This causes CSE to incorrectly think that the two predicates are equal because some of the significant bits get ignored due to the subreg. The attached patch instead makes it so it always looks at all 16-bits of the predicate, but in turn means we need to generate a TRN that matches the expected result mode. In effect in RTL we keep the mode as VNx16BI but during codegen re-interpret them as the mode the predicate instruction wanted: (insn 10 9 11 2 (set (reg:VNx8BI 96) (subreg:VNx8BI (reg:VNx16BI 99) 0)) (expr_list:REG_EQUAL (const_vector:VNx8BI [ (const_int 1 [0x1]) (const_int 0 [0]) repeated x7 ]) (nil))) Which needed correction to the TRN pattern. A new TRN1_CONV unspec is introduced which allows one to keep the arguments as VNx16BI but encode the instruction as a type of the last operand. (insn 9 8 10 2 (set (reg:VNx16BI 99) (unspec:VNx16BI [ (reg:VNx16BI 97) (reg:VNx16BI 98) (reg:VNx2BI 100) ] UNSPEC_TRN1_CONV)) (nil)) This allows us remove all the paradoxical subregs and end up with (insn 16 15 17 2 (set (reg:VNx8BI 101) (subreg:VNx8BI (reg:VNx16BI 104) 0)) (expr_list:REG_EQUAL (const_vector:VNx8BI [ (const_int 1 [0x1]) (const_int 0 [0]) (const_int 1 [0x1]) (const_int 0 [0]) repeated x5 ]) (nil))) gcc/ChangeLog: PR target/100048 * config/aarch64/aarch64-sve.md (@aarch64_sve_trn1_conv): New. * config/aarch64/aarch64.c (aarch64_expand_sve_const_pred_trn): Use new TRN optab. * config/aarch64/iterators.md (UNSPEC_TRN1_CONV): New. gcc/testsuite/ChangeLog: PR target/100048 * gcc.target/aarch64/sve/pr100048.c: New test. --- gcc/testsuite/gcc.target/aarch64/sve/pr100048.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/pr100048.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr100048.c b/gcc/testsuite/gcc.target/aarch64/sve/pr100048.c new file mode 100644 index 0000000..5259338 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/pr100048.c @@ -0,0 +1,25 @@ +/* { dg-additional-options "-O2 -fno-schedule-insns" } */ +/* { dg-final { check-function-bodies "**" "" "-DCHECK_ASM" } } */ + +#include "arm_sve.h" + +/* +** foo: +** ptrue (p[0-7])\.d, all +** pfalse (p[0-7])\.b +** ptrue (p[0-7])\.s, all +** trn1 (p[0-7])\.d, \2\.d, \3\.d +** trn1 \2\.d, \1\.d, \3\.d +** faddv (h[0-31]), \4\, (z[0-31]).h +** faddv (h[0-31]), \2\, \6\.h +** str \5, [x0] +** str \7, [x0, 2] +** ret +*/ +void foo(svfloat16_t in, float16_t *dst) { + const svbool_t pg_q0 = svdupq_n_b16(1, 0, 1, 0, 0, 0, 0, 0); + const svbool_t pg_f0 = svdupq_n_b16(1, 0, 0, 0, 0, 0, 0, 0); + dst[0] = svaddv_f16(pg_f0, in); + dst[1] = svaddv_f16(pg_q0, in); +} + -- cgit v1.1 From 98c5b5924de969ae8ab37d140aa85bcca3f3c76c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Rui=20Faustino=20de=20Sousa?= Date: Fri, 16 Apr 2021 16:17:21 +0000 Subject: Fortran: Fix ICE due to referencing a NULL pointer [PR100018] gcc/fortran/ChangeLog: PR fortran/100018 * resolve.c: Add association check before de-referencing pointer. gcc/testsuite/ChangeLog: PR fortran/100018 * gfortran.dg/PR10018.f90: New test. --- gcc/testsuite/gfortran.dg/PR10018.f90 | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/PR10018.f90 (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gfortran.dg/PR10018.f90 b/gcc/testsuite/gfortran.dg/PR10018.f90 new file mode 100644 index 0000000..f1cf267 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/PR10018.f90 @@ -0,0 +1,11 @@ +! { dg-do compile } +! +subroutine foo(that) + implicit none + class(*), target, intent(in) :: this + class(*), pointer, intent(out) :: that + + that => this + return +end subroutine foo +! { dg-error "Symbol at \\\(1\\\) is not a DUMMY variable" "" { target "*-*-*" } 5 } -- cgit v1.1 From 49813aad3292f7f2bef69206274da78a9a7116ed Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 16 Apr 2021 20:49:33 +0200 Subject: aarch64: Don't emit -Wpsabi note when ABI was never affected [PR91710] As the following testcase shows, we emit a -Wpsabi note about argument passing change since GCC 9, but in reality the ABI didn't change. The alignment is 8 bits in GCC < 9 and 32 bits in GCC >= 9 and the aarch64_function_arg_alignment returns in that case: return MIN (MAX (alignment, PARM_BOUNDARY), STACK_BOUNDARY); so when both the old and new alignment are smaller or equal to PARM_BOUNDARY (or both are larger than STACK_BOUNDARY, just in theory), even when the new one is bigger, it doesn't change the argument passing. So, the following patch changes aarch64_function_arg_alignment to tell the callers the exact old alignmentm so that they can test it if needed. The other aarch64_function_arg_alignment callers either check the alignment for equality against 16-byte alignment (when old alignment was smaller than that and the new one is 16-byte, we want to emit -Wpsabi in all the cases) or the va_arg case which I think is ok now too. 2021-04-16 Jakub Jelinek PR target/91710 * config/aarch64/aarch64.c (aarch64_function_arg_alignment): Change abi_break argument from bool * to unsigned *, store there the pre-GCC 9 alignment. (aarch64_layout_arg, aarch64_gimplify_va_arg_expr): Adjust callers. (aarch64_function_arg_regno_p): Likewise. Only emit -Wpsabi note if the old and new alignment after applying MIN/MAX to it is different. * gcc.target/aarch64/pr91710.c: New test. --- gcc/testsuite/gcc.target/aarch64/pr91710.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 gcc/testsuite/gcc.target/aarch64/pr91710.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/aarch64/pr91710.c b/gcc/testsuite/gcc.target/aarch64/pr91710.c new file mode 100644 index 0000000..496eb50 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr91710.c @@ -0,0 +1,16 @@ +/* PR target/91710 */ +/* { dg-do compile } */ + +struct S { unsigned int i:4; }; + +unsigned int test1(struct S s) { /* { dg-bogus "parameter passing for argument of type" } */ + return s.i; +} + +unsigned int test2(unsigned x, struct S s) { /* { dg-bogus "parameter passing for argument of type" } */ + return x - s.i; +} + +unsigned int test3(unsigned x, unsigned y, struct S s) { /* { dg-bogus "parameter passing for argument of type" } */ + return x - y - s.i; +} -- cgit v1.1 From 0754a104bed7c8a937f0623ad15ca03387131210 Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Fri, 16 Apr 2021 19:58:25 +0000 Subject: testsuite/arm: Fix scan-assembler-times in pr96770.c with movt/movw The previous change to this testcase missed the fact that the data may be accessed via an anchor, depending on the optimization level, leading to false failures. This patch restricts matching to upper16:lower16 followed by non-spaces, followed by +4 (in f4) or +320 (in f5). Using '.*' instead of '[^ \]' would match accross the whole assembly file, which is not what we want, hence the limitation with spaces. 2021-04-16 Christophe Lyon gcc/testsuite/ PR target/96770 * gcc.target/arm/pure-code/pr96770.c: Fix scan-assembler-times with movt/movw. --- gcc/testsuite/gcc.target/arm/pure-code/pr96770.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/arm/pure-code/pr96770.c b/gcc/testsuite/gcc.target/arm/pure-code/pr96770.c index ae1bd10..3c69614 100644 --- a/gcc/testsuite/gcc.target/arm/pure-code/pr96770.c +++ b/gcc/testsuite/gcc.target/arm/pure-code/pr96770.c @@ -4,12 +4,13 @@ int arr[1000]; int *f4 (void) { return &arr[1]; } -/* For cortex-m0 (thumb-1/v6m), we generate 4 movs with upper/lower:#arr+4. */ +/* For cortex-m0 (thumb-1/v6m), we generate 2 pairs of movs/adds with upper/lower:#arr+4. */ /* { dg-final { scan-assembler-times "arr\\+4" 4 { target { { ! arm_thumb1_movt_ok } && { ! arm_thumb2_ok } } } } } */ /* For cortex-m with movt/movw (thumb-1/v8m.base or thumb-2), we - generate a movt/movw pair with upper/lower:#arr+4. */ -/* { dg-final { scan-assembler-times "arr\\+4" 2 { target { arm_thumb1_movt_ok || arm_thumb2_ok } } } } */ + generate a movt/movw pair with upper/lower:#arr+4 possibly via an anchor. */ +/* { dg-final { scan-assembler-times "upper16:\[^ \]+.\\+4" 1 { target { arm_thumb1_movt_ok || arm_thumb2_ok } } } } */ +/* { dg-final { scan-assembler-times "lower16:\[^ \]+\\+4" 1 { target { arm_thumb1_movt_ok || arm_thumb2_ok } } } } */ int *f5 (void) { return &arr[80]; } @@ -17,5 +18,6 @@ int *f5 (void) { return &arr[80]; } /* { dg-final { scan-assembler-times "arr\\+320" 1 { target { { ! arm_thumb1_movt_ok } && { ! arm_thumb2_ok } } } } } */ /* For cortex-m with movt/movw (thumb-1/v8m.base or thumb-2), we - generate a movt/movw pair with upper/lower:arr+320. */ -/* { dg-final { scan-assembler-times "arr\\+320" 2 { target { arm_thumb1_movt_ok || arm_thumb2_ok } } } } */ + generate a movt/movw pair with upper/lower:arr+320 possibly via an anchor. */ +/* { dg-final { scan-assembler-times "upper16:\[^ \]+\\+320" 1 { target { arm_thumb1_movt_ok || arm_thumb2_ok } } } } */ +/* { dg-final { scan-assembler-times "lower16:\[^ \]+\\+320" 1 { target { arm_thumb1_movt_ok || arm_thumb2_ok } } } } */ -- cgit v1.1 From c1c86ab96c20a3f52fb59e0532ae9c93665deb44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Rui=20Faustino=20de=20Sousa?= Date: Fri, 16 Apr 2021 23:33:04 +0000 Subject: Fortran: Add missing TKR initialization [PR100094] gcc/fortran/ChangeLog: PR fortran/100094 * trans-array.c (gfc_trans_deferred_array): Add code to initialize pointers and allocatables with correct TKR parameters. gcc/testsuite/ChangeLog: PR fortran/100094 * gfortran.dg/PR100094.f90: New test. --- gcc/testsuite/gfortran.dg/PR100094.f90 | 37 ++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/PR100094.f90 (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gfortran.dg/PR100094.f90 b/gcc/testsuite/gfortran.dg/PR100094.f90 new file mode 100644 index 0000000..f2f7f16 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/PR100094.f90 @@ -0,0 +1,37 @@ +! { dg-do run } +! +! Test the fix for PR100094 +! + +program foo_p + + implicit none + + integer, parameter :: n = 11 + + integer, pointer :: pout(:) + integer, target :: a(n) + integer :: i + + a = [(i, i=1,n)] + call foo(pout) + if(.not.associated(pout)) stop 1 + if(.not.associated(pout, a)) stop 2 + if(any(pout/=a)) stop 3 + stop + +contains + + subroutine foo(that) + integer, pointer, intent(out) :: that(..) + + select rank(that) + rank(1) + that => a + rank default + stop 4 + end select + return + end subroutine foo + +end program foo_p -- cgit v1.1 From 8ae884c09fbba91e9cec391290ee4a2859e7ff41 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 17 Apr 2021 00:16:25 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 112 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f0e8b21..b1d79043 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,115 @@ +2021-04-16 José Rui Faustino de Sousa + + PR fortran/100094 + * gfortran.dg/PR100094.f90: New test. + +2021-04-16 Christophe Lyon + + PR target/96770 + * gcc.target/arm/pure-code/pr96770.c: Fix scan-assembler-times + with movt/movw. + +2021-04-16 Jakub Jelinek + + PR target/91710 + * gcc.target/aarch64/pr91710.c: New test. + +2021-04-16 José Rui Faustino de Sousa + + PR fortran/100018 + * gfortran.dg/PR10018.f90: New test. + +2021-04-16 Tamar Christina + + PR target/100048 + * gcc.target/aarch64/sve/pr100048.c: New test. + +2021-04-16 Jakub Jelinek + + PR c++/100111 + * g++.dg/cpp0x/constexpr-100111.C: New test. + +2021-04-16 Marek Polacek + + PR c++/99803 + * g++.dg/cpp2a/typename14.C: Don't expect particular error + messages. + * g++.dg/cpp2a/typename19.C: New test. + +2021-04-16 Robin Dapp + + * gcc.dg/gimplefe-40.c: Moved to... + * gcc.dg/vect/gimplefe-40.c: ...here. + * gcc.dg/gimplefe-41.c: Moved to... + * gcc.dg/vect/gimplefe-41.c: ...here. + +2021-04-16 Harald Anlauf + Paul Thomas + + PR fortran/63797 + * gfortran.dg/pr63797.f90: New test. + +2021-04-16 Stefan Schulze Frielinghaus + + * gcc.dg/tree-ssa/pr83403-1.c: Revert + max-completely-peeled-insns to the default value on IBM Z. + * gcc.dg/tree-ssa/pr83403-2.c: Likewise. + +2021-04-16 Patrick Palka + + PR c++/99700 + * g++.dg/cpp2a/constexpr-init21.C: New test. + +2021-04-16 Jakub Jelinek + + PR target/100075 + * gcc.target/aarch64/pr100075.c: New test. + +2021-04-16 Richard Sandiford + + PR rtl-optimization/99596 + * gcc.target/arm/pr99596.c: New test. + +2021-04-16 Richard Earnshaw + + PR target/100067 + * g++.target/arm/arm.exp (dg_runtest_extra_prunes): Update prune + template. + * gcc.target/arm/arm.exp (dg_runtest_extra_prunes): Likewise. + * g++.target/arm/mve.exp (dg_runtest_extra_prunes): Likewise. Fix + missing quotes around switch names. + * gcc.target/arm/mve/mve.exp: (dg_runtest_extra_prunes): Likewise. + +2021-04-16 Jakub Jelinek + + PR target/99767 + * gcc.target/aarch64/pr99767.c: New test. + +2021-04-16 Jakub Jelinek + + PR c++/99850 + * g++.dg/cpp23/lambda-specifiers2.C: New test. + +2021-04-16 Jakub Jelinek + + PR c++/99833 + * g++.dg/cpp1z/pr99833.C: New test. + * g++.dg/cpp2a/pr99833.C: New test. + +2021-04-16 Stefan Schulze Frielinghaus + + * gcc.dg/unroll-and-jam.c: Revert max-completely-peel-times to + the default value on IBM Z. + +2021-04-16 Jason Merrill + + PR c++/100079 + * g++.dg/abi/mangle71.C: Fix expected mangling. + * g++.dg/abi/mangle77.C: New test. + * g++.dg/cpp2a/nontype-class-union1.C: Likewise. + * g++.dg/cpp2a/nontype-class-equiv1.C: Removed. + * g++.dg/cpp2a/nontype-class44.C: New test. + 2021-04-15 Martin Sebor PR c/99420 -- cgit v1.1 From ed16241c6db23013d70b792a64f29080ad48a414 Mon Sep 17 00:00:00 2001 From: Stefan Schulze Frielinghaus Date: Sat, 17 Apr 2021 17:53:33 +0200 Subject: testsuite: Enable zero-scratch-regs-{8,9,10,11}.c on s390* On s390* the only missing part for the mentioned testcases was a load of a double floating-point zero via a move (in particular for quite old machines) which was added in commit 46c47420a5fefd4d9d02b0db347235dd74e20fb2. Common code implementation is sufficient in order to clear volatile GPRs, FPRs, and VRs. Access registers a0 and a1 are nonvolatile and not cleared. Therefore, target hook TARGET_ZERO_CALL_USED_REGS is not implemented for s390*. Added a target specific test in order to ensure that all call clobbered GPRs, FPRs, and VRs are zeroed and all call saved registers are kept. gcc/testsuite/ChangeLog: * c-c++-common/zero-scratch-regs-8.c: Enable on s390*. * c-c++-common/zero-scratch-regs-9.c: Likewise. * c-c++-common/zero-scratch-regs-10.c: Likewise. * c-c++-common/zero-scratch-regs-11.c: Likewise. * gcc.target/s390/zero-scratch-regs-1.c: New test. --- gcc/testsuite/c-c++-common/zero-scratch-regs-10.c | 2 +- gcc/testsuite/c-c++-common/zero-scratch-regs-11.c | 2 +- gcc/testsuite/c-c++-common/zero-scratch-regs-8.c | 2 +- gcc/testsuite/c-c++-common/zero-scratch-regs-9.c | 2 +- .../gcc.target/s390/zero-scratch-regs-1.c | 65 ++++++++++++++++++++++ 5 files changed, 69 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.target/s390/zero-scratch-regs-1.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/c-c++-common/zero-scratch-regs-10.c b/gcc/testsuite/c-c++-common/zero-scratch-regs-10.c index ab17143..96e0b79 100644 --- a/gcc/testsuite/c-c++-common/zero-scratch-regs-10.c +++ b/gcc/testsuite/c-c++-common/zero-scratch-regs-10.c @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-skip-if "not implemented" { ! { i?86*-*-* x86_64*-*-* sparc*-*-* aarch64*-*-* nvptx*-*-* } } } */ +/* { dg-skip-if "not implemented" { ! { i?86*-*-* x86_64*-*-* sparc*-*-* aarch64*-*-* nvptx*-*-* s390*-*-* } } } */ /* { dg-options "-O2" } */ #include diff --git a/gcc/testsuite/c-c++-common/zero-scratch-regs-11.c b/gcc/testsuite/c-c++-common/zero-scratch-regs-11.c index 6642a37..0714f95 100644 --- a/gcc/testsuite/c-c++-common/zero-scratch-regs-11.c +++ b/gcc/testsuite/c-c++-common/zero-scratch-regs-11.c @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-skip-if "not implemented" { ! { i?86*-*-* x86_64*-*-* sparc*-*-* aarch64*-*-* arm*-*-* nvptx*-*-* } } } */ +/* { dg-skip-if "not implemented" { ! { i?86*-*-* x86_64*-*-* sparc*-*-* aarch64*-*-* arm*-*-* nvptx*-*-* s390*-*-* } } } */ /* { dg-options "-O2 -fzero-call-used-regs=all" } */ #include "zero-scratch-regs-10.c" diff --git a/gcc/testsuite/c-c++-common/zero-scratch-regs-8.c b/gcc/testsuite/c-c++-common/zero-scratch-regs-8.c index 867c6bd..aceda7e 100644 --- a/gcc/testsuite/c-c++-common/zero-scratch-regs-8.c +++ b/gcc/testsuite/c-c++-common/zero-scratch-regs-8.c @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-skip-if "not implemented" { ! { i?86*-*-* x86_64*-*-* sparc*-*-* aarch64*-*-* arm*-*-* nvptx*-*-* } } } */ +/* { dg-skip-if "not implemented" { ! { i?86*-*-* x86_64*-*-* sparc*-*-* aarch64*-*-* arm*-*-* nvptx*-*-* s390*-*-* } } } */ /* { dg-options "-O2 -fzero-call-used-regs=all-arg" } */ #include "zero-scratch-regs-1.c" diff --git a/gcc/testsuite/c-c++-common/zero-scratch-regs-9.c b/gcc/testsuite/c-c++-common/zero-scratch-regs-9.c index 4b45d70..f3152a7 100644 --- a/gcc/testsuite/c-c++-common/zero-scratch-regs-9.c +++ b/gcc/testsuite/c-c++-common/zero-scratch-regs-9.c @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-skip-if "not implemented" { ! { i?86*-*-* x86_64*-*-* sparc*-*-* aarch64*-*-* arm*-*-* nvptx*-*-* } } } */ +/* { dg-skip-if "not implemented" { ! { i?86*-*-* x86_64*-*-* sparc*-*-* aarch64*-*-* arm*-*-* nvptx*-*-* s390*-*-* } } } */ /* { dg-options "-O2 -fzero-call-used-regs=all" } */ #include "zero-scratch-regs-1.c" diff --git a/gcc/testsuite/gcc.target/s390/zero-scratch-regs-1.c b/gcc/testsuite/gcc.target/s390/zero-scratch-regs-1.c new file mode 100644 index 0000000..c394c4b --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/zero-scratch-regs-1.c @@ -0,0 +1,65 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fzero-call-used-regs=all -march=z13" } */ + +/* Ensure that all call clobbered GPRs, FPRs, and VRs are zeroed and all call + saved registers are kept. */ + +void foo (void) { } + +/* { dg-final { scan-assembler-times "lhi\t" 6 { target { ! lp64 } } } } */ +/* { dg-final { scan-assembler "lhi\t%r0,0" { target { ! lp64 } } } } */ +/* { dg-final { scan-assembler "lhi\t%r1,0" { target { ! lp64 } } } } */ +/* { dg-final { scan-assembler "lhi\t%r2,0" { target { ! lp64 } } } } */ +/* { dg-final { scan-assembler "lhi\t%r3,0" { target { ! lp64 } } } } */ +/* { dg-final { scan-assembler "lhi\t%r4,0" { target { ! lp64 } } } } */ +/* { dg-final { scan-assembler "lhi\t%r5,0" { target { ! lp64 } } } } */ + +/* { dg-final { scan-assembler-times "lzdr\t" 14 { target { ! lp64 } } } } */ +/* { dg-final { scan-assembler "lzdr\t%f0" { target { ! lp64 } } } } */ +/* { dg-final { scan-assembler "lzdr\t%f1" { target { ! lp64 } } } } */ +/* { dg-final { scan-assembler "lzdr\t%f2" { target { ! lp64 } } } } */ +/* { dg-final { scan-assembler "lzdr\t%f3" { target { ! lp64 } } } } */ +/* { dg-final { scan-assembler "lzdr\t%f5" { target { ! lp64 } } } } */ +/* { dg-final { scan-assembler "lzdr\t%f7" { target { ! lp64 } } } } */ +/* { dg-final { scan-assembler "lzdr\t%f8" { target { ! lp64 } } } } */ +/* { dg-final { scan-assembler "lzdr\t%f9" { target { ! lp64 } } } } */ +/* { dg-final { scan-assembler "lzdr\t%f10" { target { ! lp64 } } } } */ +/* { dg-final { scan-assembler "lzdr\t%f11" { target { ! lp64 } } } } */ +/* { dg-final { scan-assembler "lzdr\t%f12" { target { ! lp64 } } } } */ +/* { dg-final { scan-assembler "lzdr\t%f13" { target { ! lp64 } } } } */ +/* { dg-final { scan-assembler "lzdr\t%f14" { target { ! lp64 } } } } */ +/* { dg-final { scan-assembler "lzdr\t%f15" { target { ! lp64 } } } } */ + +/* { dg-final { scan-assembler-times "lghi\t" 6 { target { lp64 } } } } */ +/* { dg-final { scan-assembler "lghi\t%r0,0" { target { lp64 } } } } */ +/* { dg-final { scan-assembler "lghi\t%r1,0" { target { lp64 } } } } */ +/* { dg-final { scan-assembler "lghi\t%r2,0" { target { lp64 } } } } */ +/* { dg-final { scan-assembler "lghi\t%r3,0" { target { lp64 } } } } */ +/* { dg-final { scan-assembler "lghi\t%r4,0" { target { lp64 } } } } */ +/* { dg-final { scan-assembler "lghi\t%r5,0" { target { lp64 } } } } */ + +/* { dg-final { scan-assembler-times "vzero\t" 24 { target { lp64 } } } } */ +/* { dg-final { scan-assembler "vzero\t%v0" { target { lp64 } } } } */ +/* { dg-final { scan-assembler "vzero\t%v1" { target { lp64 } } } } */ +/* { dg-final { scan-assembler "vzero\t%v2" { target { lp64 } } } } */ +/* { dg-final { scan-assembler "vzero\t%v3" { target { lp64 } } } } */ +/* { dg-final { scan-assembler "vzero\t%v4" { target { lp64 } } } } */ +/* { dg-final { scan-assembler "vzero\t%v5" { target { lp64 } } } } */ +/* { dg-final { scan-assembler "vzero\t%v6" { target { lp64 } } } } */ +/* { dg-final { scan-assembler "vzero\t%v7" { target { lp64 } } } } */ +/* { dg-final { scan-assembler "vzero\t%v16" { target { lp64 } } } } */ +/* { dg-final { scan-assembler "vzero\t%v17" { target { lp64 } } } } */ +/* { dg-final { scan-assembler "vzero\t%v18" { target { lp64 } } } } */ +/* { dg-final { scan-assembler "vzero\t%v19" { target { lp64 } } } } */ +/* { dg-final { scan-assembler "vzero\t%v20" { target { lp64 } } } } */ +/* { dg-final { scan-assembler "vzero\t%v21" { target { lp64 } } } } */ +/* { dg-final { scan-assembler "vzero\t%v22" { target { lp64 } } } } */ +/* { dg-final { scan-assembler "vzero\t%v23" { target { lp64 } } } } */ +/* { dg-final { scan-assembler "vzero\t%v24" { target { lp64 } } } } */ +/* { dg-final { scan-assembler "vzero\t%v25" { target { lp64 } } } } */ +/* { dg-final { scan-assembler "vzero\t%v26" { target { lp64 } } } } */ +/* { dg-final { scan-assembler "vzero\t%v27" { target { lp64 } } } } */ +/* { dg-final { scan-assembler "vzero\t%v28" { target { lp64 } } } } */ +/* { dg-final { scan-assembler "vzero\t%v29" { target { lp64 } } } } */ +/* { dg-final { scan-assembler "vzero\t%v30" { target { lp64 } } } } */ +/* { dg-final { scan-assembler "vzero\t%v31" { target { lp64 } } } } */ -- cgit v1.1 From da946b41be521adb68bbe8695563b380cd8b3243 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sun, 18 Apr 2021 00:16:21 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b1d79043..e71d5b7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2021-04-17 Stefan Schulze Frielinghaus + + * c-c++-common/zero-scratch-regs-8.c: Enable on s390*. + * c-c++-common/zero-scratch-regs-9.c: Likewise. + * c-c++-common/zero-scratch-regs-10.c: Likewise. + * c-c++-common/zero-scratch-regs-11.c: Likewise. + * gcc.target/s390/zero-scratch-regs-1.c: New test. + 2021-04-16 José Rui Faustino de Sousa PR fortran/100094 -- cgit v1.1 From 0bb37e80bb786e11cb7aa2d23b7d68bb0357fc15 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Mon, 19 Apr 2021 10:13:36 +0200 Subject: Fix another -freorder-blocks-and-partition glitch with Windows SEH Since GCC 8, the -freorder-blocks-and-partition pass can split a function into hot and cold parts, thus generating 2 FDEs for a single function in DWARF for exception purposes and doing an equivalent trick for Windows SEH. Now the Windows system unwinder does not support arbitrarily large frames and there is even a hard limit on the encoding of the CFI, which changes the stack allocation strategy when it is topped and which must be reflected everywhere. gcc/ * config/i386/winnt.c (i386_pe_seh_cold_init): Properly deal with frames larger than the SEH maximum frame size. gcc/testsuite/ * gnat.dg/opt92.adb: New test. --- gcc/testsuite/gnat.dg/opt92.adb | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 gcc/testsuite/gnat.dg/opt92.adb (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gnat.dg/opt92.adb b/gcc/testsuite/gnat.dg/opt92.adb new file mode 100644 index 0000000..f6eb6a0 --- /dev/null +++ b/gcc/testsuite/gnat.dg/opt92.adb @@ -0,0 +1,38 @@ +-- { dg-do compile { target { lp64 || llp64 } } } +-- { dg-options "-O2 -gnatws" } + +procedure Main is + + subtype Int64 is Long_Long_Integer; + + type Arr is array (Int64 range <>) of Boolean; + + Pow : constant := 10; + + procedure Compute (B : in out Arr) is + Factor : Int64 := 3; + Num : Int64; + begin + while Factor <= 10 ** (Pow / 2) loop + Num := Factor; + while Num < 10 ** Pow loop + if B (Num) then + Factor := Num; + exit; + end if; + Num := Num + 2; + end loop; + Num := Factor * Factor; + while Num < 10 ** Pow loop + B (Num) := False; + Num := Num + Factor * 2; + end loop; + Factor := Factor + 2; + end loop; + end; + + B : Arr (1 .. 10 ** Pow) := (others => True); + +begin + Compute (B); +end; -- cgit v1.1 From 3395dfc4da8ad1fccd346c62dfc9bd44b2b48c62 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Mon, 19 Apr 2021 10:24:49 +0200 Subject: [OpenACC 'kernels'] '-fopenacc-kernels=[...]' -> '--param=openacc-kernels=[...]' This configuration knob is temporary, and isn't really meant to be exposed to users. gcc/ * params.opt (-param=openacc-kernels=): Add. * omp-oacc-kernels-decompose.cc (pass_omp_oacc_kernels_decompose::gate): Use it. * doc/invoke.texi (-fopenacc-kernels=@var{mode}): Move... (--param): ... here, 'openacc-kernels'. gcc/c-family/ * c.opt (fopenacc-kernels=): Remove. gcc/fortran/ * lang.opt (fopenacc-kernels=): Remove. gcc/testsuite/ * c-c++-common/goacc/if-clause-2.c: '-fopenacc-kernels=[...]' -> '--param=openacc-kernels=[...]'. * c-c++-common/goacc/kernels-decompose-1.c: Likewise. * c-c++-common/goacc/kernels-decompose-2.c: Likewise. * c-c++-common/goacc/kernels-decompose-ice-1.c: Likewise. * c-c++-common/goacc/kernels-decompose-ice-2.c: Likewise. * gfortran.dg/goacc/kernels-decompose-1.f95: Likewise. * gfortran.dg/goacc/kernels-decompose-2.f95: Likewise. * gfortran.dg/goacc/kernels-tree.f95: Likewise. libgomp/ * testsuite/libgomp.oacc-c-c++-common/declare-vla-kernels-decompose-ice-1.c: '-fopenacc-kernels=[...]' -> '--param=openacc-kernels=[...]'. * testsuite/libgomp.oacc-c-c++-common/declare-vla-kernels-decompose.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/kernels-decompose-1.c: Likewise. * testsuite/libgomp.oacc-fortran/pr94358-1.f90: Likewise. --- gcc/testsuite/c-c++-common/goacc/if-clause-2.c | 2 +- gcc/testsuite/c-c++-common/goacc/kernels-decompose-1.c | 2 +- gcc/testsuite/c-c++-common/goacc/kernels-decompose-2.c | 2 +- gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-1.c | 2 +- gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-2.c | 2 +- gcc/testsuite/gfortran.dg/goacc/kernels-decompose-1.f95 | 2 +- gcc/testsuite/gfortran.dg/goacc/kernels-decompose-2.f95 | 2 +- gcc/testsuite/gfortran.dg/goacc/kernels-tree.f95 | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/c-c++-common/goacc/if-clause-2.c b/gcc/testsuite/c-c++-common/goacc/if-clause-2.c index 7bb1153..a480725 100644 --- a/gcc/testsuite/c-c++-common/goacc/if-clause-2.c +++ b/gcc/testsuite/c-c++-common/goacc/if-clause-2.c @@ -1,5 +1,5 @@ /* { dg-additional-options "-fdump-tree-gimple" } */ -/* { dg-additional-options "-fopenacc-kernels=decompose" } +/* { dg-additional-options "--param=openacc-kernels=decompose" } { dg-additional-options "-fdump-tree-omp_oacc_kernels_decompose" } */ void diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-1.c b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-1.c index e906443..87219c8 100644 --- a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-1.c +++ b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-1.c @@ -2,7 +2,7 @@ /* { dg-additional-options "-fopt-info-omp-all" } */ /* { dg-additional-options "-fdump-tree-gimple" } */ -/* { dg-additional-options "-fopenacc-kernels=decompose" } +/* { dg-additional-options "--param=openacc-kernels=decompose" } { dg-additional-options "-fdump-tree-omp_oacc_kernels_decompose" } */ /* See also '../../gfortran.dg/goacc/kernels-decompose-1.f95'. */ diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-2.c b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-2.c index ec0f75c..3781e75 100644 --- a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-2.c +++ b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-2.c @@ -1,7 +1,7 @@ /* Test OpenACC 'kernels' construct decomposition. */ /* { dg-additional-options "-fopt-info-omp-all" } */ -/* { dg-additional-options "-fopenacc-kernels=decompose" } +/* { dg-additional-options "--param=openacc-kernels=decompose" } /* { dg-additional-options "-O2" } for 'parloops'. */ /* See also '../../gfortran.dg/goacc/kernels-decompose-2.f95'. */ diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-1.c b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-1.c index 82e7bd1..d770b91d 100644 --- a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-1.c +++ b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-1.c @@ -1,7 +1,7 @@ /* Test OpenACC 'kernels' construct decomposition. */ /* { dg-additional-options "-fopt-info-omp-all" } */ -/* { dg-additional-options "-fopenacc-kernels=decompose" } */ +/* { dg-additional-options "--param=openacc-kernels=decompose" } */ /* { dg-ice "TODO" } { dg-prune-output "during GIMPLE pass: omplower" } */ diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-2.c b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-2.c index 569f87a..ae059eb 100644 --- a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-2.c +++ b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-2.c @@ -1,6 +1,6 @@ /* Test OpenACC 'kernels' construct decomposition. */ -/* { dg-additional-options "-fopenacc-kernels=decompose" } */ +/* { dg-additional-options "--param=openacc-kernels=decompose" } */ /* { dg-ice "TODO" } { dg-prune-output "during GIMPLE pass: omplower" } */ diff --git a/gcc/testsuite/gfortran.dg/goacc/kernels-decompose-1.f95 b/gcc/testsuite/gfortran.dg/goacc/kernels-decompose-1.f95 index 7e513f8..e252350 100644 --- a/gcc/testsuite/gfortran.dg/goacc/kernels-decompose-1.f95 +++ b/gcc/testsuite/gfortran.dg/goacc/kernels-decompose-1.f95 @@ -2,7 +2,7 @@ ! { dg-additional-options "-fopt-info-omp-all" } ! { dg-additional-options "-fdump-tree-gimple" } -! { dg-additional-options "-fopenacc-kernels=decompose" } +! { dg-additional-options "--param=openacc-kernels=decompose" } ! { dg-additional-options "-fdump-tree-omp_oacc_kernels_decompose" } ! See also '../../c-c++-common/goacc/kernels-decompose-1.c'. diff --git a/gcc/testsuite/gfortran.dg/goacc/kernels-decompose-2.f95 b/gcc/testsuite/gfortran.dg/goacc/kernels-decompose-2.f95 index 22f65e5..cc12b77 100644 --- a/gcc/testsuite/gfortran.dg/goacc/kernels-decompose-2.f95 +++ b/gcc/testsuite/gfortran.dg/goacc/kernels-decompose-2.f95 @@ -1,7 +1,7 @@ ! Test OpenACC 'kernels' construct decomposition. ! { dg-additional-options "-fopt-info-omp-all" } -! { dg-additional-options "-fopenacc-kernels=decompose" } +! { dg-additional-options "--param=openacc-kernels=decompose" } ! { dg-additional-options "-O2" } for 'parloops'. ! See also '../../c-c++-common/goacc/kernels-decompose-2.c'. diff --git a/gcc/testsuite/gfortran.dg/goacc/kernels-tree.f95 b/gcc/testsuite/gfortran.dg/goacc/kernels-tree.f95 index d01eee2..63ef7e1 100644 --- a/gcc/testsuite/gfortran.dg/goacc/kernels-tree.f95 +++ b/gcc/testsuite/gfortran.dg/goacc/kernels-tree.f95 @@ -1,6 +1,6 @@ ! { dg-do compile } ! { dg-additional-options "-fdump-tree-original" } -! { dg-additional-options "-fopenacc-kernels=decompose" } +! { dg-additional-options "--param=openacc-kernels=decompose" } ! { dg-additional-options "-fdump-tree-omp_oacc_kernels_decompose" } program test -- cgit v1.1 From 2f422b550ff6351d312e6c81a00b488d9280bfff Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 19 Apr 2021 10:07:35 +0200 Subject: preprocessor/100142 - revert unwanted change in last commit This reverts a s/column_offset/column/ change in the fix for PR99446. 2021-04-19 Richard Biener PR preprocessor/100142 libcpp/ * line-map.c (linemap_position_for_loc_and_offset): Revert unintended s/column_offset/column/ change. gcc/testsuite/ * gcc.dg/pr100142.c: New testcase. * g++.dg/diagnostic/pr72803.C: Revert last change. --- gcc/testsuite/g++.dg/diagnostic/pr72803.C | 5 ++--- gcc/testsuite/gcc.dg/pr100142.c | 8 ++++++++ 2 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pr100142.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/diagnostic/pr72803.C b/gcc/testsuite/g++.dg/diagnostic/pr72803.C index ca522b7..0a9a390 100644 --- a/gcc/testsuite/g++.dg/diagnostic/pr72803.C +++ b/gcc/testsuite/g++.dg/diagnostic/pr72803.C @@ -5,6 +5,5 @@ class test { // The line directive appears to be necessary to trigger the ICE // { dg-error "style of line directive is a GCC extension" "" { target *-*-* } .-2 } -/* Verify that we get the best line and column for the diagnostic. - 512 is not representable in the line-maps created for this test. */ -// { dg-error "511: expected .;. after class definition" "" { target *-*-* } 3 } +/* Verify that we get the correct line and column for the diagnostic. */ +// { dg-error "512: expected .;. after class definition" "" { target *-*-* } 3 } diff --git a/gcc/testsuite/gcc.dg/pr100142.c b/gcc/testsuite/gcc.dg/pr100142.c new file mode 100644 index 0000000..aec146c --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr100142.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-fpreprocessed" } */ + +void +foo (void) +{ + assert (1); /* { dg-warning "implicit" } */ +} -- cgit v1.1 From 714bdc31b69688ae2eaeb9807a48e0f101fecf4e Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Mon, 19 Apr 2021 13:24:31 +0000 Subject: aarch64: Fix up 2 other combine opt regressions vs. GCC8 [PR100075] The testcase is endianness dependent and works only on little-endian. 2021-04-19 Christophe Lyon PR target/100075 gcc/testsuite/ * gcc.target/aarch64/pr100075.c: Add aarch64_little_endian effective target. --- gcc/testsuite/gcc.target/aarch64/pr100075.c | 1 + 1 file changed, 1 insertion(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/aarch64/pr100075.c b/gcc/testsuite/gcc.target/aarch64/pr100075.c index 6bdaa2f..1ece5fd 100644 --- a/gcc/testsuite/gcc.target/aarch64/pr100075.c +++ b/gcc/testsuite/gcc.target/aarch64/pr100075.c @@ -1,5 +1,6 @@ /* PR target/100075 */ /* { dg-do compile } */ +/* { dg-require-effective-target aarch64_little_endian } */ /* { dg-options "-O2" } */ /* { dg-final { scan-assembler-not {\tsbfx\tx[0-9]+, x[0-9]+, 16, 16} } } */ /* { dg-final { scan-assembler {\tneg\tw[0-9]+, w[0-9]+, asr 16} } } */ -- cgit v1.1 From dc7d1c74ffb1cc85e67984632f581d526c783770 Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Mon, 19 Apr 2021 18:45:32 +0200 Subject: d: Fix ICE in when formating a string with '%' or '`' characters (PR98457) The percentage character was being confused for a format specifier in pp_format(), whilst the backtick character was confused for the beginning of a quoted string in expand_d_format(). Both are now properly escaped to avoid the ICE. gcc/d/ChangeLog: PR d/98457 * d-diagnostic.cc (expand_d_format): Handle escaped backticks. (escape_d_format): New funtion. (verror): Call escape_d_format on prefixing strings. (vdeprecation): Likewise. gcc/testsuite/ChangeLog: PR d/98457 * gdc.dg/pr98457.d: New test. --- gcc/testsuite/gdc.dg/pr98457.d | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 gcc/testsuite/gdc.dg/pr98457.d (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gdc.dg/pr98457.d b/gcc/testsuite/gdc.dg/pr98457.d new file mode 100644 index 0000000..bc0d8af --- /dev/null +++ b/gcc/testsuite/gdc.dg/pr98457.d @@ -0,0 +1,9 @@ +// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98457 +// { dg-do compile } + +void main() +{ + writef!"%s"; // { dg-error "template instance writef!\"%s\" template .writef. is not defined" } + writef!"`%s"; // { dg-error "template instance writef!\"`%s\" template .writef. is not defined" } + writef!"%%s`"; // { dg-error "template instance writef!\"%%s`\" template .writef. is not defined" } +} -- cgit v1.1 From 29d8838c5ecaf70ce552fea7639ec1f34adb2e04 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Mon, 19 Apr 2021 16:21:46 -0400 Subject: c++: ICE with concept defined in function [PR97536] This is an ICE-on-invalid, but I keep seeing it when reducing code so I'd like to fix it. We crash on template void forward() { concept C = true; } which breaks two requirements: [temp.concept]/1: A concept is a template ... [temp.concept]/3: A concept-definition shall inhabit a namespace scope. This patch adds a test that exercises broken code and fixes the ICE by checking that a concept-definition is defined at namespace scope. gcc/cp/ChangeLog: PR c++/97536 * decl.c (grokvardecl): Given an error when a concept is not defined at namespace scope. gcc/testsuite/ChangeLog: PR c++/97536 * g++.dg/concepts/diagnostic16.C: New test. --- gcc/testsuite/g++.dg/concepts/diagnostic16.C | 45 ++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 gcc/testsuite/g++.dg/concepts/diagnostic16.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/concepts/diagnostic16.C b/gcc/testsuite/g++.dg/concepts/diagnostic16.C new file mode 100644 index 0000000..fcba535 --- /dev/null +++ b/gcc/testsuite/g++.dg/concepts/diagnostic16.C @@ -0,0 +1,45 @@ +// PR c++/97536 +// { dg-do compile { target concepts } } + +template +concept C1 = true; + +concept C2 = true; // { dg-error "non-template variable cannot be .concept." } +// { dg-error "concept definition syntax is" "" { target *-*-* } .-1 } + +template +void fn1 () +{ + concept bar = true; // { dg-error "concept must be defined at namespace scope" } +// { dg-error "concept definition syntax is" "" { target *-*-* } .-1 } +} + +void fn2 () +{ + concept bar = true; // { dg-error "non-template variable cannot be .concept." } +// { dg-error "concept definition syntax is" "" { target *-*-* } .-1 } +} + +template +void fn3 () +{ + template // { dg-error "template declaration cannot appear at block scope" } + concept bar = true; +} + +void fn4 () +{ + template // { dg-error "template declaration cannot appear at block scope" } + concept bar = true; +} + +void fn5 () +{ + C1 auto x = 42; +} + +template +void fn6 () +{ + C1 auto x = 42; +} -- cgit v1.1 From 6e81e015d91568fc3df3939623ae999e0681a0fc Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 20 Apr 2021 00:16:27 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e71d5b7..29c90df 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,41 @@ +2021-04-19 Marek Polacek + + PR c++/97536 + * g++.dg/concepts/diagnostic16.C: New test. + +2021-04-19 Iain Buclaw + + PR d/98457 + * gdc.dg/pr98457.d: New test. + +2021-04-19 Christophe Lyon + + PR target/100075 + * gcc.target/aarch64/pr100075.c: Add aarch64_little_endian + effective target. + +2021-04-19 Richard Biener + + PR preprocessor/100142 + * gcc.dg/pr100142.c: New testcase. + * g++.dg/diagnostic/pr72803.C: Revert last change. + +2021-04-19 Thomas Schwinge + + * c-c++-common/goacc/if-clause-2.c: '-fopenacc-kernels=[...]' -> + '--param=openacc-kernels=[...]'. + * c-c++-common/goacc/kernels-decompose-1.c: Likewise. + * c-c++-common/goacc/kernels-decompose-2.c: Likewise. + * c-c++-common/goacc/kernels-decompose-ice-1.c: Likewise. + * c-c++-common/goacc/kernels-decompose-ice-2.c: Likewise. + * gfortran.dg/goacc/kernels-decompose-1.f95: Likewise. + * gfortran.dg/goacc/kernels-decompose-2.f95: Likewise. + * gfortran.dg/goacc/kernels-tree.f95: Likewise. + +2021-04-19 Eric Botcazou + + * gnat.dg/opt92.adb: New test. + 2021-04-17 Stefan Schulze Frielinghaus * c-c++-common/zero-scratch-regs-8.c: Enable on s390*. -- cgit v1.1 From 67378cd63d62bf0c69e966d1d202a1e586550a68 Mon Sep 17 00:00:00 2001 From: Paul Thomas Date: Tue, 20 Apr 2021 07:30:07 +0100 Subject: Fortran: Fix host associated PDT entity initialization [PR99307]. 2021-04-20 Paul Thomas gcc/fortran PR fortran/100110 * trans-decl.c (gfc_get_symbol_decl): Replace test for host association with a check that the current and symbol namespaces are the same. gcc/testsuite/ PR fortran/100110 * gfortran.dg/pdt_31.f03: New test. * gfortran.dg/pdt_26.f03: Reduce 'builtin_malloc' count from 9 to 8. --- gcc/testsuite/gfortran.dg/pdt_26.f03 | 4 ++-- gcc/testsuite/gfortran.dg/pdt_31.f03 | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/pdt_31.f03 (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gfortran.dg/pdt_26.f03 b/gcc/testsuite/gfortran.dg/pdt_26.f03 index bf12737..59ddcfb 100644 --- a/gcc/testsuite/gfortran.dg/pdt_26.f03 +++ b/gcc/testsuite/gfortran.dg/pdt_26.f03 @@ -2,7 +2,7 @@ ! { dg-options "-fdump-tree-original" } ! ! Test the fix for PR83567 in which the parameterized component 'foo' was -! being deallocated before return from 'addw', with consequent segfault in +! being deallocated before return from 'addw', with consequent segfault in ! the main program. ! ! Contributed by Berke Durak @@ -43,4 +43,4 @@ program test_pdt if (any (c(1)%foo .ne. [13,15,17])) STOP 2 end program test_pdt ! { dg-final { scan-tree-dump-times "__builtin_free" 8 "original" } } -! { dg-final { scan-tree-dump-times "__builtin_malloc" 9 "original" } } +! { dg-final { scan-tree-dump-times "__builtin_malloc" 8 "original" } } diff --git a/gcc/testsuite/gfortran.dg/pdt_31.f03 b/gcc/testsuite/gfortran.dg/pdt_31.f03 new file mode 100644 index 0000000..708c945 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pdt_31.f03 @@ -0,0 +1,26 @@ +! { dg-do run } +! +! Test the fix for PR100110, in which 'obj' was not being initialized. +! +! Contributed by Xiao Liu +! +program p + implicit none + type t(n) + integer, len :: n + integer :: arr(n, n) + end type + + type(t(2)) :: obj + + obj%arr = reshape ([1,2,3,4],[2,2]) + if (obj%n .ne. 2) stop 1 + if (any (shape(obj%arr) .ne. [2,2])) stop 2 + call test() +contains + subroutine test() + if (obj%n .ne. 2) stop 3 + if (any (shape(obj%arr) .ne. [2,2])) stop 4 + if (any (reshape (obj%arr, [4]) .ne. [1,2,3,4])) stop 5 + end subroutine +end program -- cgit v1.1 From 250f234988b6231669a720c52101d3686d645072 Mon Sep 17 00:00:00 2001 From: Stefan Schulze Frielinghaus Date: Tue, 20 Apr 2021 09:51:16 +0200 Subject: testsuite: Fix up gcc.target/s390/zero-scratch-regs-1.c Depending on whether GCC is configured using --with-mode=zarch or not, for the 31bit target instructions are generated either for ESA or z/Architecture. For the sake of simplicity and robustness test only for the latter by adding manually option -mzarch. gcc/testsuite/ChangeLog: * gcc.target/s390/zero-scratch-regs-1.c: Force test to run for z/Architecture only. --- .../gcc.target/s390/zero-scratch-regs-1.c | 95 +++++++++------------- 1 file changed, 40 insertions(+), 55 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/s390/zero-scratch-regs-1.c b/gcc/testsuite/gcc.target/s390/zero-scratch-regs-1.c index c394c4b..1c02c0c 100644 --- a/gcc/testsuite/gcc.target/s390/zero-scratch-regs-1.c +++ b/gcc/testsuite/gcc.target/s390/zero-scratch-regs-1.c @@ -1,65 +1,50 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fzero-call-used-regs=all -march=z13" } */ +/* { dg-options "-O2 -fzero-call-used-regs=all -march=z13 -mzarch" } */ /* Ensure that all call clobbered GPRs, FPRs, and VRs are zeroed and all call saved registers are kept. */ void foo (void) { } -/* { dg-final { scan-assembler-times "lhi\t" 6 { target { ! lp64 } } } } */ -/* { dg-final { scan-assembler "lhi\t%r0,0" { target { ! lp64 } } } } */ -/* { dg-final { scan-assembler "lhi\t%r1,0" { target { ! lp64 } } } } */ -/* { dg-final { scan-assembler "lhi\t%r2,0" { target { ! lp64 } } } } */ -/* { dg-final { scan-assembler "lhi\t%r3,0" { target { ! lp64 } } } } */ -/* { dg-final { scan-assembler "lhi\t%r4,0" { target { ! lp64 } } } } */ -/* { dg-final { scan-assembler "lhi\t%r5,0" { target { ! lp64 } } } } */ +/* { dg-final { scan-assembler-times "lghi\t" 6 } } */ +/* { dg-final { scan-assembler "lghi\t%r0,0" } } */ +/* { dg-final { scan-assembler "lghi\t%r1,0" } } */ +/* { dg-final { scan-assembler "lghi\t%r2,0" } } */ +/* { dg-final { scan-assembler "lghi\t%r3,0" } } */ +/* { dg-final { scan-assembler "lghi\t%r4,0" } } */ +/* { dg-final { scan-assembler "lghi\t%r5,0" } } */ -/* { dg-final { scan-assembler-times "lzdr\t" 14 { target { ! lp64 } } } } */ -/* { dg-final { scan-assembler "lzdr\t%f0" { target { ! lp64 } } } } */ -/* { dg-final { scan-assembler "lzdr\t%f1" { target { ! lp64 } } } } */ -/* { dg-final { scan-assembler "lzdr\t%f2" { target { ! lp64 } } } } */ -/* { dg-final { scan-assembler "lzdr\t%f3" { target { ! lp64 } } } } */ -/* { dg-final { scan-assembler "lzdr\t%f5" { target { ! lp64 } } } } */ -/* { dg-final { scan-assembler "lzdr\t%f7" { target { ! lp64 } } } } */ -/* { dg-final { scan-assembler "lzdr\t%f8" { target { ! lp64 } } } } */ -/* { dg-final { scan-assembler "lzdr\t%f9" { target { ! lp64 } } } } */ -/* { dg-final { scan-assembler "lzdr\t%f10" { target { ! lp64 } } } } */ -/* { dg-final { scan-assembler "lzdr\t%f11" { target { ! lp64 } } } } */ -/* { dg-final { scan-assembler "lzdr\t%f12" { target { ! lp64 } } } } */ -/* { dg-final { scan-assembler "lzdr\t%f13" { target { ! lp64 } } } } */ -/* { dg-final { scan-assembler "lzdr\t%f14" { target { ! lp64 } } } } */ -/* { dg-final { scan-assembler "lzdr\t%f15" { target { ! lp64 } } } } */ - -/* { dg-final { scan-assembler-times "lghi\t" 6 { target { lp64 } } } } */ -/* { dg-final { scan-assembler "lghi\t%r0,0" { target { lp64 } } } } */ -/* { dg-final { scan-assembler "lghi\t%r1,0" { target { lp64 } } } } */ -/* { dg-final { scan-assembler "lghi\t%r2,0" { target { lp64 } } } } */ -/* { dg-final { scan-assembler "lghi\t%r3,0" { target { lp64 } } } } */ -/* { dg-final { scan-assembler "lghi\t%r4,0" { target { lp64 } } } } */ -/* { dg-final { scan-assembler "lghi\t%r5,0" { target { lp64 } } } } */ - -/* { dg-final { scan-assembler-times "vzero\t" 24 { target { lp64 } } } } */ -/* { dg-final { scan-assembler "vzero\t%v0" { target { lp64 } } } } */ -/* { dg-final { scan-assembler "vzero\t%v1" { target { lp64 } } } } */ -/* { dg-final { scan-assembler "vzero\t%v2" { target { lp64 } } } } */ -/* { dg-final { scan-assembler "vzero\t%v3" { target { lp64 } } } } */ +/* { dg-final { scan-assembler-times "vzero\t" 30 { target { ! lp64 } } } } */ +/* { dg-final { scan-assembler-times "vzero\t" 24 { target { lp64 } } } } */ +/* { dg-final { scan-assembler "vzero\t%v0" } } */ +/* { dg-final { scan-assembler "vzero\t%v1" } } */ +/* { dg-final { scan-assembler "vzero\t%v2" } } */ +/* { dg-final { scan-assembler "vzero\t%v3" } } */ /* { dg-final { scan-assembler "vzero\t%v4" { target { lp64 } } } } */ -/* { dg-final { scan-assembler "vzero\t%v5" { target { lp64 } } } } */ +/* { dg-final { scan-assembler "vzero\t%v5" } } */ /* { dg-final { scan-assembler "vzero\t%v6" { target { lp64 } } } } */ -/* { dg-final { scan-assembler "vzero\t%v7" { target { lp64 } } } } */ -/* { dg-final { scan-assembler "vzero\t%v16" { target { lp64 } } } } */ -/* { dg-final { scan-assembler "vzero\t%v17" { target { lp64 } } } } */ -/* { dg-final { scan-assembler "vzero\t%v18" { target { lp64 } } } } */ -/* { dg-final { scan-assembler "vzero\t%v19" { target { lp64 } } } } */ -/* { dg-final { scan-assembler "vzero\t%v20" { target { lp64 } } } } */ -/* { dg-final { scan-assembler "vzero\t%v21" { target { lp64 } } } } */ -/* { dg-final { scan-assembler "vzero\t%v22" { target { lp64 } } } } */ -/* { dg-final { scan-assembler "vzero\t%v23" { target { lp64 } } } } */ -/* { dg-final { scan-assembler "vzero\t%v24" { target { lp64 } } } } */ -/* { dg-final { scan-assembler "vzero\t%v25" { target { lp64 } } } } */ -/* { dg-final { scan-assembler "vzero\t%v26" { target { lp64 } } } } */ -/* { dg-final { scan-assembler "vzero\t%v27" { target { lp64 } } } } */ -/* { dg-final { scan-assembler "vzero\t%v28" { target { lp64 } } } } */ -/* { dg-final { scan-assembler "vzero\t%v29" { target { lp64 } } } } */ -/* { dg-final { scan-assembler "vzero\t%v30" { target { lp64 } } } } */ -/* { dg-final { scan-assembler "vzero\t%v31" { target { lp64 } } } } */ +/* { dg-final { scan-assembler "vzero\t%v7" } } */ +/* { dg-final { scan-assembler "vzero\t%v8" { target { ! lp64 } } } } */ +/* { dg-final { scan-assembler "vzero\t%v9" { target { ! lp64 } } } } */ +/* { dg-final { scan-assembler "vzero\t%v10" { target { ! lp64 } } } } */ +/* { dg-final { scan-assembler "vzero\t%v11" { target { ! lp64 } } } } */ +/* { dg-final { scan-assembler "vzero\t%v12" { target { ! lp64 } } } } */ +/* { dg-final { scan-assembler "vzero\t%v13" { target { ! lp64 } } } } */ +/* { dg-final { scan-assembler "vzero\t%v14" { target { ! lp64 } } } } */ +/* { dg-final { scan-assembler "vzero\t%v15" { target { ! lp64 } } } } */ +/* { dg-final { scan-assembler "vzero\t%v16" } } */ +/* { dg-final { scan-assembler "vzero\t%v17" } } */ +/* { dg-final { scan-assembler "vzero\t%v18" } } */ +/* { dg-final { scan-assembler "vzero\t%v19" } } */ +/* { dg-final { scan-assembler "vzero\t%v20" } } */ +/* { dg-final { scan-assembler "vzero\t%v21" } } */ +/* { dg-final { scan-assembler "vzero\t%v22" } } */ +/* { dg-final { scan-assembler "vzero\t%v23" } } */ +/* { dg-final { scan-assembler "vzero\t%v24" } } */ +/* { dg-final { scan-assembler "vzero\t%v25" } } */ +/* { dg-final { scan-assembler "vzero\t%v26" } } */ +/* { dg-final { scan-assembler "vzero\t%v27" } } */ +/* { dg-final { scan-assembler "vzero\t%v28" } } */ +/* { dg-final { scan-assembler "vzero\t%v29" } } */ +/* { dg-final { scan-assembler "vzero\t%v30" } } */ +/* { dg-final { scan-assembler "vzero\t%v31" } } */ -- cgit v1.1 From 7f5deba1c21888aacedae93e9f324827073a1d1e Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 20 Apr 2021 00:50:49 -0400 Subject: c++: unexpanded pack in enum in lambda [PR100109] Another construct we need to look inside. gcc/cp/ChangeLog: PR c++/100109 * pt.c (find_parameter_packs_r): Look into enum initializers. gcc/testsuite/ChangeLog: PR c++/100109 * g++.dg/cpp0x/lambda/lambda-variadic14.C: New test. --- gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic14.C | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic14.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic14.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic14.C new file mode 100644 index 0000000..185aa03 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic14.C @@ -0,0 +1,8 @@ +// PR c++/100109 +// { dg-do compile { target c++11 } } + +template +void f() { + [] { enum e { e = E }; }; // { dg-error "not expanded" } +} +template void f<>(); -- cgit v1.1 From be8aad8d73f47e2581c873ba1069489e071c2a86 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 21 Apr 2021 00:16:23 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 29c90df..caa346a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,20 @@ +2021-04-20 Jason Merrill + + PR c++/100109 + * g++.dg/cpp0x/lambda/lambda-variadic14.C: New test. + +2021-04-20 Stefan Schulze Frielinghaus + + * gcc.target/s390/zero-scratch-regs-1.c: Force test to run for + z/Architecture only. + +2021-04-20 Paul Thomas + + PR fortran/100110 + * gfortran.dg/pdt_31.f03: New test. + * gfortran.dg/pdt_26.f03: Reduce 'builtin_malloc' count from 9 + to 8. + 2021-04-19 Marek Polacek PR c++/97536 -- cgit v1.1 From cb60e56d4ac2958c422c003221ca0cff6a537e0b Mon Sep 17 00:00:00 2001 From: Stefan Schulze Frielinghaus Date: Wed, 21 Apr 2021 08:27:29 +0200 Subject: testsuite: Fix gcc.dg/vect/bb-slp-39.c on IBM Z On IBM Z the aliasing stores are realized through one element vector instructions, if no cost model for vectorization is used which is the default according to vect.exp. Fixed by changing the number of times the pattern must be found in the dump. gcc/testsuite/ChangeLog: * gcc.dg/vect/bb-slp-39.c: Change number of times the pattern must match for target IBM Z only. --- gcc/testsuite/gcc.dg/vect/bb-slp-39.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-39.c b/gcc/testsuite/gcc.dg/vect/bb-slp-39.c index 255bb10..ee596cf 100644 --- a/gcc/testsuite/gcc.dg/vect/bb-slp-39.c +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-39.c @@ -16,4 +16,5 @@ void foo (double *p) } /* See that we vectorize three SLP instances. */ -/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 3 "slp2" } } */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 3 "slp2" { target { ! s390*-*-* } } } } */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 5 "slp2" { target { s390*-*-* } } } } */ -- cgit v1.1 From b67778b59932fdc64dc89a97550349e973ca0352 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Wed, 21 Apr 2021 09:08:44 +0100 Subject: varasm: Two SECTION_RETAIN fixes [PR100130] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit switch_to_section warns if we try to output a retain decl in a section without a retain flag, or if we try to output a non-retain decl in a section with a retain flag. However, the warning only applied if we were trying to “switch†to the current section. This works if all decls that use a section are generated consecutively, but not if there is an unrelated decl in between. This patch makes the check unconditional, but suppresses the warning if we're writing the section's named.decl (i.e. the decl from which the section name and original flags were derived). Also, the warning didn't fire for -fsection-anchors, for two reasons: we allowed retain and non-retain decls to be put into the same block, and we didn't pass a decl to switch_to_section. Although these are arguably separate bugs, it isn't easy to fix them independently without temporarily regressing -fsection-anchor targets. gcc/ PR middle-end/100130 * varasm.c (get_block_for_decl): Make sure that any use of the retain attribute matches the section's retain flag. (switch_to_section): Check for retain mismatches even when changing sections, but do not warn if the given decl is the section's named.decl. (output_object_block): Pass the first decl in the block (if any) to switch_to_section. gcc/testsuite/ PR middle-end/100130 * c-c++-common/attr-retain-10.c: New test. * c-c++-common/attr-retain-11.c: Likewise. --- gcc/testsuite/c-c++-common/attr-retain-10.c | 11 +++++++++++ gcc/testsuite/c-c++-common/attr-retain-11.c | 11 +++++++++++ 2 files changed, 22 insertions(+) create mode 100644 gcc/testsuite/c-c++-common/attr-retain-10.c create mode 100644 gcc/testsuite/c-c++-common/attr-retain-11.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/c-c++-common/attr-retain-10.c b/gcc/testsuite/c-c++-common/attr-retain-10.c new file mode 100644 index 0000000..0bac947 --- /dev/null +++ b/gcc/testsuite/c-c++-common/attr-retain-10.c @@ -0,0 +1,11 @@ +/* { dg-do compile { target R_flag_in_section } } */ +/* { dg-skip-if "non-ELF target" { *-*-darwin* powerpc*-*-aix* } } */ +/* { dg-options "-Wall -O2 -fno-toplevel-reorder" } */ + +int __attribute__((used,retain,section(".data.foo"))) foo2 = 2; +int between = 1; +int __attribute__((section(".data.foo"))) foo1 = 1; +/* { dg-warning "'.*' without 'retain' attribute and '.*' with 'retain' attribute are placed in a section with the same name" "" { target R_flag_in_section } .-1 } */ + +/* { dg-final { scan-assembler ".data.foo,\"aw\"" { target R_flag_in_section } } } */ +/* { dg-final { scan-assembler ".data.foo,\"awR\"" { target R_flag_in_section } } } */ diff --git a/gcc/testsuite/c-c++-common/attr-retain-11.c b/gcc/testsuite/c-c++-common/attr-retain-11.c new file mode 100644 index 0000000..d1d3d9e --- /dev/null +++ b/gcc/testsuite/c-c++-common/attr-retain-11.c @@ -0,0 +1,11 @@ +/* { dg-do compile { target R_flag_in_section } } */ +/* { dg-skip-if "non-ELF target" { *-*-darwin* powerpc*-*-aix* } } */ +/* { dg-options "-Wall -O2 -fno-toplevel-reorder" } */ + +int __attribute__((section(".data.foo"))) foo1 = 1; +/* { dg-warning "'.*' without 'retain' attribute and '.*' with 'retain' attribute are placed in a section with the same name" "" { target R_flag_in_section } .-1 } */ +int between = 1; +int __attribute__((used,retain,section(".data.foo"))) foo2 = 2; + +/* { dg-final { scan-assembler ".data.foo,\"aw\"" { target R_flag_in_section } } } */ +/* { dg-final { scan-assembler ".data.foo,\"awR\"" { target R_flag_in_section } } } */ -- cgit v1.1 From b4e17490c917746dc523cd1b4441000b66530695 Mon Sep 17 00:00:00 2001 From: Stefan Schulze Frielinghaus Date: Wed, 21 Apr 2021 10:44:54 +0200 Subject: testsuite: Xfail gcc.dg/vect/pr71264.c on IBM Z The test fails for targets with V4QImode support which is the case for IBM Z. gcc/testsuite/ChangeLog: * gcc.dg/vect/pr71264.c: Xfail on IBM Z due to V4QImode support. --- gcc/testsuite/gcc.dg/vect/pr71264.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/vect/pr71264.c b/gcc/testsuite/gcc.dg/vect/pr71264.c index 5f6407a..dc849bf 100644 --- a/gcc/testsuite/gcc.dg/vect/pr71264.c +++ b/gcc/testsuite/gcc.dg/vect/pr71264.c @@ -19,5 +19,5 @@ void test(uint8_t *ptr, uint8_t *mask) } } -/* { dg-final { scan-tree-dump "vectorized 1 loops in function" "vect" { xfail sparc*-*-* } } } */ +/* { dg-final { scan-tree-dump "vectorized 1 loops in function" "vect" { xfail s390*-*-* sparc*-*-* } } } */ -- cgit v1.1 From a61c4964cd71446232d62ec9b10a7d45b440dd9f Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Wed, 21 Apr 2021 10:58:29 +0200 Subject: Fortran/OpenMP: Add 'omp depobj' and 'depend(mutexinoutset:' gcc/fortran/ChangeLog: * dump-parse-tree.c (show_omp_namelist): Handle depobj + mutexinoutset in the depend clause. (show_omp_clauses, show_omp_node, show_code_node): Handle depobj. * gfortran.h (enum gfc_statement): Add ST_OMP_DEPOBJ. (enum gfc_omp_depend_op): Add OMP_DEPEND_UNSET, OMP_DEPEND_MUTEXINOUTSET and OMP_DEPEND_DEPOBJ. (gfc_omp_clauses): Add destroy, depobj_update and depobj. (enum gfc_exec_op): Add EXEC_OMP_DEPOBJ * match.h (gfc_match_omp_depobj): Match 'omp depobj'. * openmp.c (gfc_match_omp_clauses): Add depobj + mutexinoutset to depend clause. (gfc_match_omp_depobj, resolve_omp_clauses, gfc_resolve_omp_directive): Handle 'omp depobj'. * parse.c (decode_omp_directive, next_statement, gfc_ascii_statement): Likewise. * resolve.c (gfc_resolve_code): Likewise. * st.c (gfc_free_statement): Likewise. * trans-openmp.c (gfc_trans_omp_clauses): Handle depobj + mutexinoutset in the depend clause. (gfc_trans_omp_depobj, gfc_trans_omp_directive): Handle EXEC_OMP_DEPOBJ. * trans.c (trans_code): Likewise. libgomp/ChangeLog: * testsuite/libgomp.fortran/depobj-1.f90: New test. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/depobj-1.f90: New test. * gfortran.dg/gomp/depobj-2.f90: New test. --- gcc/testsuite/gfortran.dg/gomp/depobj-1.f90 | 25 ++++++++++++++++++++++ gcc/testsuite/gfortran.dg/gomp/depobj-2.f90 | 33 +++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/gomp/depobj-1.f90 create mode 100644 gcc/testsuite/gfortran.dg/gomp/depobj-2.f90 (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gfortran.dg/gomp/depobj-1.f90 b/gcc/testsuite/gfortran.dg/gomp/depobj-1.f90 new file mode 100644 index 0000000..66cfb61 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/depobj-1.f90 @@ -0,0 +1,25 @@ +! { dg-do compile { target { fortran_integer_16 || ilp32 } } } +! omp_depend_kind = 2*intptr_t --> 16 (128 bit) on 64bit-pointer systems +! --> 8 (128 bit) on 32bit-pointer systems +subroutine f1 + !use omp_lib ! N/A in gcc/testsuite + use iso_c_binding, only: c_intptr_t + implicit none + integer, parameter :: omp_depend_kind = 2*c_intptr_t + integer :: a + integer(kind=omp_depend_kind) :: depobj1, depobj2, depobj3, depobj4, depobj5 + !$omp depobj(depobj1) depend (in : a) + !$omp depobj(depobj2) depend (out : a) + !$omp depobj(depobj3) depend( inout : a) + !$omp depobj(depobj4) depend(mutexinoutset: a) + !$omp depobj(depobj1) update(out) + !$omp depobj(depobj2) update(mutexinoutset) + !$omp depobj(depobj3) update(in) + !$omp depobj(depobj4) update(inout) + !$omp task depend (depobj: depobj1, depobj2, depobj3) + !$omp end task + + !$omp task depend(mutexinoutset: a) + !$omp end task + !$omp depobj(depobj2) destroy +end subroutine f1 diff --git a/gcc/testsuite/gfortran.dg/gomp/depobj-2.f90 b/gcc/testsuite/gfortran.dg/gomp/depobj-2.f90 new file mode 100644 index 0000000..3ffd3d5 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/depobj-2.f90 @@ -0,0 +1,33 @@ +! { dg-do compile { target { fortran_integer_16 || ilp32 } } } +! omp_depend_kind = 2*intptr_t --> 16 (128 bit) on 64bit-pointer systems +! --> 8 (128 bit) on 32bit-pointer systems +subroutine f1 + !use omp_lib ! N/A in gcc/testsuite + use iso_c_binding, only: c_intptr_t + implicit none + integer, parameter :: omp_depend_kind = 2*c_intptr_t + integer :: a, b + integer(kind=omp_depend_kind) :: depobj, depobj1(5) + real :: r + integer(1) :: d + + !$omp depobj ! { dg-error "Expected '\\( depobj \\)\'" } + !$omp depobj(depobj) ! { dg-error "Expected DEPEND, UPDATE, or DESTROY clause" } + !$omp depobj destroy ! { dg-error "Expected '\\( depobj \\)\'" } + !$omp depobj ( depobj1 ( 1 ) ) depend( inout : a) ! OK + !$omp depobj(depobj1) depend( inout : a) ! { dg-error "DEPOBJ in DEPOBJ construct at .1. shall be a scalar integer of OMP_DEPEND_KIND kind" } + !$omp depobj(depobj1(:)) depend( inout : a) ! { dg-error "DEPOBJ in DEPOBJ construct at .1. shall be a scalar integer of OMP_DEPEND_KIND kind" } + !$omp depobj(r) depend( inout : a) ! { dg-error "DEPOBJ in DEPOBJ construct at .1. shall be a scalar integer of OMP_DEPEND_KIND kind" } + !$omp depobj(d) depend( inout : a) ! { dg-error "DEPOBJ in DEPOBJ construct at .1. shall be a scalar integer of OMP_DEPEND_KIND kind" } + !$omp depobj(depobj) depend( inout : a, b) ! { dg-error "DEPEND clause at .1. of OMP DEPOBJ construct shall have only a single locator" } + !$omp depobj(depobj) depend(mutexinoutset : a) ! OK + !$omp depobj(depobj) depend(source) ! { dg-error "DEPEND clause at .1. of OMP DEPOBJ construct shall not have dependence-type SOURCE, SINK or DEPOBJ" } + !$omp depobj(depobj) depend(sink : i + 1) ! { dg-error "DEPEND clause at .1. of OMP DEPOBJ construct shall not have dependence-type SOURCE, SINK or DEPOBJ" } + !$omp depobj(depobj) update(source) ! { dg-error "Expected IN, OUT, INOUT, MUTEXINOUTSET followed by '\\)'" } + !$omp depobj(depobj) update(sink) ! { dg-error "Expected IN, OUT, INOUT, MUTEXINOUTSET followed by '\\)'" } + !$omp depobj(depobj) update(depobj) ! { dg-error "Expected IN, OUT, INOUT, MUTEXINOUTSET followed by '\\)'" } + + ! Valid in OpenMP 5.1: + !$omp depobj(depobj5) depend(depobj: depobj3) ! { dg-error "DEPEND clause at .1. of OMP DEPOBJ construct shall not have dependence-type SOURCE, SINK or DEPOBJ" } +end subroutine f1 + -- cgit v1.1 From 022f6ee3ad67ee30f62c8c2aeeb4156494f3284e Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 21 Apr 2021 12:31:45 +0200 Subject: cprop: Fix -fcompare-debug bug in constprop_register [PR100148] The following testcase shows different behavior between -g and -g0 in constprop_register, if a flags register setter is separated from a conditional jump using those flags with -g by a DEBUG_INSN. As it uses just NEXT_INSN, for -g it will look at the DEBUG_INSN which is not a conditional jump, while otherwise it would look at the conditional jump and call cprop_jump. 2021-04-21 Jakub Jelinek PR rtl-optimization/100148 * cprop.c (constprop_register): Use next_nondebug_insn instead of NEXT_INSN. * g++.dg/opt/pr100148.C: New test. --- gcc/testsuite/g++.dg/opt/pr100148.C | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 gcc/testsuite/g++.dg/opt/pr100148.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/opt/pr100148.C b/gcc/testsuite/g++.dg/opt/pr100148.C new file mode 100644 index 0000000..d038879 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr100148.C @@ -0,0 +1,27 @@ +// PR rtl-optimization/100148 +// { dg-do compile } +// { dg-options "-O2 -fno-dce -fno-tree-dce -fno-tree-dominator-opts -fno-tree-sink -fcompare-debug" } + +int i; +enum E { } e, ee; + +bool +baz (int) +{ + return ee; +} + +bool bar (); +bool a, b; + +void +foo () +{ + switch (ee) + { + case 0: + e = E (a ? : i); + case 1: + !(b || baz (0) && bar ()); + } +} -- cgit v1.1 From d8f953819e8f72e646f22c7803d79bd2b56d1e30 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 21 Apr 2021 12:46:51 +0200 Subject: testsuite/100176 - fix struct-layout-1_generate.c compile With -Werror=return-type we run into compile fails complaining about missing return stmts. 2021-04-21 Richard Biener PR testsuite/100176 * g++.dg/compat/struct-layout-1_generate.c: Add missing return. * gcc.dg/compat/struct-layout-1_generate.c: Likewise. --- gcc/testsuite/g++.dg/compat/struct-layout-1_generate.c | 2 ++ gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c | 2 ++ 2 files changed, 4 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/compat/struct-layout-1_generate.c b/gcc/testsuite/g++.dg/compat/struct-layout-1_generate.c index 990e6f4..e9ece64 100644 --- a/gcc/testsuite/g++.dg/compat/struct-layout-1_generate.c +++ b/gcc/testsuite/g++.dg/compat/struct-layout-1_generate.c @@ -983,6 +983,8 @@ subvalues (struct entry *e, char *p, char *letter) if (e[0].len != 0) output_FNB ('B', e); return 1; + default: + return 0; } } diff --git a/gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c b/gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c index 75e902c..35dff89 100644 --- a/gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c +++ b/gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c @@ -1280,6 +1280,8 @@ subvalues (struct entry *e, char *p, char *letter) if (e[0].len != 0) output_FNB ('B', e); return 1; + default: + return 0; } } -- cgit v1.1 From d8c6cc2ca35489bc41bb58ec96c1195928826922 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Thu, 15 Apr 2021 11:19:32 -0700 Subject: x86: Add -mmwait for -mgeneral-regs-only Add -mmwait so that the MWAIT and MONITOR intrinsics can be used with -mgeneral-regs-only and make -msse3 to imply -mmwait. gcc/ * config.gcc: Install mwaitintrin.h for i[34567]86-*-* and x86_64-*-* targets. * common/config/i386/i386-common.c (OPTION_MASK_ISA2_MWAIT_SET): New. (OPTION_MASK_ISA2_MWAIT_UNSET): Likewise. (ix86_handle_option): Handle -mmwait. * config/i386/i386-builtins.c (ix86_init_mmx_sse_builtins): Replace OPTION_MASK_ISA_SSE3 with OPTION_MASK_ISA2_MWAIT on __builtin_ia32_monitor and __builtin_ia32_mwait. * config/i386/i386-options.c (isa2_opts): Add -mmwait. (ix86_valid_target_attribute_inner_p): Likewise. (ix86_option_override_internal): Enable mwait/monitor instructions for -msse3. * config/i386/i386.h (TARGET_MWAIT): New. (TARGET_MWAIT_P): Likewise. * config/i386/i386.opt: Add -mmwait. * config/i386/mwaitintrin.h: New file. * config/i386/pmmintrin.h: Include . * config/i386/sse.md (sse3_mwait): Replace TARGET_SSE3 with TARGET_MWAIT. (@sse3_monitor_): Likewise. * config/i386/x86gprintrin.h: Include . * doc/extend.texi: Document mwait target attribute. * doc/invoke.texi: Document -mmwait. gcc/testsuite/ * gcc.target/i386/monitor-2.c: New test. --- gcc/testsuite/gcc.target/i386/monitor-2.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/monitor-2.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/i386/monitor-2.c b/gcc/testsuite/gcc.target/i386/monitor-2.c new file mode 100644 index 0000000..96eeec0 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/monitor-2.c @@ -0,0 +1,27 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mmwait -mgeneral-regs-only" } */ + +/* Verify that they work in both 32bit and 64bit. */ + +#include + +void +foo (char *p, int x, int y, int z) +{ + _mm_monitor (p, y, x); + _mm_mwait (z, y); +} + +void +bar (char *p, long x, long y, long z) +{ + _mm_monitor (p, y, x); + _mm_mwait (z, y); +} + +void +foo1 (char *p) +{ + _mm_monitor (p, 0, 0); + _mm_mwait (0, 0); +} -- cgit v1.1 From ca4bf1dd4398dc65d8fff8b9f5c67733729cee95 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 21 Apr 2021 15:17:10 +0200 Subject: testsuite: Add -fchecking to dg-ice tests In --enable-checking=release builds (which is the default on release branches), I'm getting various extra FAILs that don't appear in --enable-checking=yes builds. XPASS: g++.dg/cpp0x/constexpr-52830.C -std=c++14 (internal compiler error) FAIL: g++.dg/cpp0x/constexpr-52830.C -std=c++14 (test for excess errors) XPASS: g++.dg/cpp0x/constexpr-52830.C -std=c++17 (internal compiler error) FAIL: g++.dg/cpp0x/constexpr-52830.C -std=c++17 (test for excess errors) XPASS: g++.dg/cpp0x/constexpr-52830.C -std=c++2a (internal compiler error) FAIL: g++.dg/cpp0x/constexpr-52830.C -std=c++2a (test for excess errors) FAIL: g++.dg/cpp0x/vt-88982.C -std=c++14 (test for excess errors) FAIL: g++.dg/cpp0x/vt-88982.C -std=c++17 (test for excess errors) FAIL: g++.dg/cpp0x/vt-88982.C -std=c++2a (test for excess errors) FAIL: g++.dg/cpp1y/auto-fn61.C -std=c++14 (test for excess errors) FAIL: g++.dg/cpp1y/auto-fn61.C -std=c++17 (test for excess errors) FAIL: g++.dg/cpp1y/auto-fn61.C -std=c++2a (test for excess errors) FAIL: g++.dg/cpp1z/constexpr-lambda26.C -std=c++17 (test for excess errors) FAIL: g++.dg/cpp1z/constexpr-lambda26.C -std=c++2a (test for excess errors) FAIL: g++.dg/cpp2a/nontype-class39.C -std=c++2a (test for excess errors) FAIL: c-c++-common/goacc/kernels-decompose-ice-1.c -std=c++14 (test for excess errors) FAIL: c-c++-common/goacc/kernels-decompose-ice-1.c -std=c++17 (test for excess errors) FAIL: c-c++-common/goacc/kernels-decompose-ice-1.c -std=c++2a (test for excess errors) FAIL: c-c++-common/goacc/kernels-decompose-ice-1.c -std=c++98 (test for excess errors) FAIL: c-c++-common/goacc/kernels-decompose-ice-2.c -std=c++14 (test for excess errors) FAIL: c-c++-common/goacc/kernels-decompose-ice-2.c -std=c++17 (test for excess errors) FAIL: c-c++-common/goacc/kernels-decompose-ice-2.c -std=c++2a (test for excess errors) FAIL: c-c++-common/goacc/kernels-decompose-ice-2.c -std=c++98 (test for excess errors) These are tests that have dg-ice and most of those ICEs are checking ICEs which go away in release checking when -fno-checking is the default. The following patch adds -fchecking option to those. 2021-04-21 Jakub Jelinek * g++.dg/cpp1z/constexpr-lambda26.C: Add dg-additional-options -fchecking. * g++.dg/cpp1y/auto-fn61.C: Likewise. * g++.dg/cpp2a/nontype-class39.C: Likewise. * g++.dg/cpp0x/constexpr-52830.C: Likewise. * g++.dg/cpp0x/vt-88982.C: Likewise. * c-c++-common/goacc/kernels-decompose-ice-1.c: Add -fchecking to dg-additional-options. * c-c++-common/goacc/kernels-decompose-ice-2.c: Likewise. --- gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-1.c | 2 +- gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-2.c | 2 +- gcc/testsuite/g++.dg/cpp0x/constexpr-52830.C | 1 + gcc/testsuite/g++.dg/cpp0x/vt-88982.C | 1 + gcc/testsuite/g++.dg/cpp1y/auto-fn61.C | 1 + gcc/testsuite/g++.dg/cpp1z/constexpr-lambda26.C | 1 + gcc/testsuite/g++.dg/cpp2a/nontype-class39.C | 1 + 7 files changed, 7 insertions(+), 2 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-1.c b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-1.c index d770b91d..8c3884b 100644 --- a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-1.c +++ b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-1.c @@ -1,7 +1,7 @@ /* Test OpenACC 'kernels' construct decomposition. */ /* { dg-additional-options "-fopt-info-omp-all" } */ -/* { dg-additional-options "--param=openacc-kernels=decompose" } */ +/* { dg-additional-options "-fchecking --param=openacc-kernels=decompose" } */ /* { dg-ice "TODO" } { dg-prune-output "during GIMPLE pass: omplower" } */ diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-2.c b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-2.c index ae059eb..8bf60a9 100644 --- a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-2.c +++ b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-2.c @@ -1,6 +1,6 @@ /* Test OpenACC 'kernels' construct decomposition. */ -/* { dg-additional-options "--param=openacc-kernels=decompose" } */ +/* { dg-additional-options "-fchecking --param=openacc-kernels=decompose" } */ /* { dg-ice "TODO" } { dg-prune-output "during GIMPLE pass: omplower" } */ diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-52830.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-52830.C index 2c9d2f9..eae0d8c 100644 --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-52830.C +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-52830.C @@ -1,5 +1,6 @@ // PR c++/52830 // { dg-do compile { target c++11 } } +// { dg-additional-options "-fchecking" } // { dg-ice "comptypes" } template struct eif { typedef void type; }; diff --git a/gcc/testsuite/g++.dg/cpp0x/vt-88982.C b/gcc/testsuite/g++.dg/cpp0x/vt-88982.C index cb9530d..7a86823 100644 --- a/gcc/testsuite/g++.dg/cpp0x/vt-88982.C +++ b/gcc/testsuite/g++.dg/cpp0x/vt-88982.C @@ -1,5 +1,6 @@ // PR c++/88982 // { dg-do compile { target c++11 } } +// { dg-additional-options "-fchecking" } // { dg-ice "tsubst_pack_expansion" } template struct A { diff --git a/gcc/testsuite/g++.dg/cpp1y/auto-fn61.C b/gcc/testsuite/g++.dg/cpp1y/auto-fn61.C index c24c3b8..bed5ea0 100644 --- a/gcc/testsuite/g++.dg/cpp1y/auto-fn61.C +++ b/gcc/testsuite/g++.dg/cpp1y/auto-fn61.C @@ -1,5 +1,6 @@ // PR c++/88003 // { dg-do compile { target c++14 } } +// { dg-additional-options "-fchecking" } // { dg-ice "poplevel_class" } auto test() { diff --git a/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda26.C b/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda26.C index d6c8bae..0cdb400 100644 --- a/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda26.C +++ b/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda26.C @@ -1,5 +1,6 @@ // PR c++/87765 // { dg-do compile { target c++17 } } +// { dg-additional-options "-fchecking" } // { dg-ice "cxx_eval_constant_expression" } template diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-class39.C b/gcc/testsuite/g++.dg/cpp2a/nontype-class39.C index f5f79a7..512afad 100644 --- a/gcc/testsuite/g++.dg/cpp2a/nontype-class39.C +++ b/gcc/testsuite/g++.dg/cpp2a/nontype-class39.C @@ -1,5 +1,6 @@ // PR c++/89565 // { dg-do compile { target c++20 } } +// { dg-additional-options "-fchecking" } // { dg-ice "resolve_args" } template -- cgit v1.1 From fe11882ae34c49f6214f93867783ed1332f35f0f Mon Sep 17 00:00:00 2001 From: Alex Coplan Date: Wed, 21 Apr 2021 14:42:04 +0100 Subject: aarch64: Avoid duplicating bti j insns for jump tables [PR99988] This patch fixes PR99988 which shows us generating large (> 250) sequences of back-to-back bti j instructions. The fix is simply to avoid inserting bti j instructions at the target of a jump table if we've already inserted one for a given label. gcc/ChangeLog: PR target/99988 * config/aarch64/aarch64-bti-insert.c (aarch64_bti_j_insn_p): New. (rest_of_insert_bti): Avoid inserting duplicate bti j insns for jump table targets. gcc/testsuite/ChangeLog: PR target/99988 * gcc.target/aarch64/pr99988.c: New test. --- gcc/testsuite/gcc.target/aarch64/pr99988.c | 66 ++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 gcc/testsuite/gcc.target/aarch64/pr99988.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/aarch64/pr99988.c b/gcc/testsuite/gcc.target/aarch64/pr99988.c new file mode 100644 index 0000000..2d87f41 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr99988.c @@ -0,0 +1,66 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mbranch-protection=standard" } */ +/* { dg-final { scan-assembler-times {bti j} 13 } } */ +int a; +int c(); +int d(); +int e(); +int f(); +int g(); +void h() { + switch (a) { + case 0: + case 56: + case 57: + break; + case 58: + case 59: + case 61: + case 62: + c(); + case 64: + case 63: + d(); + case 66: + case 65: + d(); + case 68: + case 67: + d(); + case 69: + case 70: + d(); + case 71: + case 72: + case 88: + case 87: + d(); + case 90: + case 89: + d(); + case 92: + case 1: + d(); + case 93: + case 73: + case 4: + e(); + case 76: + case 5: + f(); + case 7: + case 8: + case 84: + case 85: + break; + case 6: + case 299: + case 9: + case 80: + case 2: + case 3: + e(); + default: + g(); + } +} -- cgit v1.1 From 001c63d15e31bc0a1545426d889a0b9f671b4961 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Tue, 20 Apr 2021 12:16:04 -0400 Subject: c++: Don't allow defining types in enum-base [PR96380] In r11-2064 I made cp_parser_enum_specifier commit to tentative parse when seeing a '{'. That still looks like the correct thing to do, but it caused an ICE-on-invalid as well as accepts-invalid. When we have something sneaky like this, which is broken in multiple ways: template enum struct c : union enum struct c { e = b, f = a }; we parse the "enum struct c" part (that's OK) and then we see that we have an enum-base, so we consume ':' and then parse the type-specifier that follows the :. "union enum" is clearly invalid, but we're still parsing tentatively and we parse everything up to the ;, and then throw away the underlying type. We parsed everything because we were tricked into parsing an enum-specifier in an enum-base of another enum-specifier! Not good. Since the grammar for enum-base doesn't allow a defining-type-specifier, only a type-specifier, we should set type_definition_forbidden_message which fixes all the problems in this PR. gcc/cp/ChangeLog: PR c++/96380 * parser.c (cp_parser_enum_specifier): Don't allow defining types in enum-base. gcc/testsuite/ChangeLog: PR c++/96380 * g++.dg/cpp0x/enum_base4.C: New test. * g++.dg/cpp0x/enum_base5.C: New test. --- gcc/testsuite/g++.dg/cpp0x/enum_base4.C | 8 ++++++++ gcc/testsuite/g++.dg/cpp0x/enum_base5.C | 7 +++++++ 2 files changed, 15 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/enum_base4.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/enum_base5.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp0x/enum_base4.C b/gcc/testsuite/g++.dg/cpp0x/enum_base4.C new file mode 100644 index 0000000..b301525 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/enum_base4.C @@ -0,0 +1,8 @@ +// PR c++/96380 +// { dg-do compile { target c++11 } } + +extern const int a, b; +enum struct c; +template +enum struct c : union enum struct c { e = b, f = a }; // { dg-error "types may not be defined|expected|elaborated-type-specifier" } +enum class c {}; diff --git a/gcc/testsuite/g++.dg/cpp0x/enum_base5.C b/gcc/testsuite/g++.dg/cpp0x/enum_base5.C new file mode 100644 index 0000000..c01e857 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/enum_base5.C @@ -0,0 +1,7 @@ +// PR c++/96380 +// { dg-do compile { target c++11 } } + +extern const int a, b; +enum struct c; +template +enum struct c : union enum struct c { e = b, f = a }; // { dg-error "types may not be defined|expected|elaborated-type-specifier" } -- cgit v1.1 From 2d468b13261aa2002e4e093bfc14dbad98cd2ad3 Mon Sep 17 00:00:00 2001 From: David Edelsohn Date: Wed, 21 Apr 2021 08:27:31 -0400 Subject: testsuite: Fix bind_c_array_params_2.f90 on AIX gcc/testsuite/ChangeLog: * gfortran.dg/bind_c_array_params_2.f90: Look for AIX-specific call pattern. --- gcc/testsuite/gfortran.dg/bind_c_array_params_2.f90 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gfortran.dg/bind_c_array_params_2.f90 b/gcc/testsuite/gfortran.dg/bind_c_array_params_2.f90 index 4528d13..00628c1 100644 --- a/gcc/testsuite/gfortran.dg/bind_c_array_params_2.f90 +++ b/gcc/testsuite/gfortran.dg/bind_c_array_params_2.f90 @@ -16,9 +16,10 @@ integer :: aa(4,4) call test(aa) end -! { dg-final { scan-assembler-times "\[ \t\]\[$,_0-9\]*myBindC" 1 { target { ! { hppa*-*-* s390*-*-* *-*-cygwin* amdgcn*-*-* } } } } } +! { dg-final { scan-assembler-times "\[ \t\]\[$,_0-9\]*myBindC" 1 { target { ! { hppa*-*-* s390*-*-* *-*-cygwin* amdgcn*-*-* powerpc-ibm-aix*} } } } } ! { dg-final { scan-assembler-times "myBindC,%r2" 1 { target { hppa*-*-* } } } } ! { dg-final { scan-assembler-times "call\tmyBindC" 1 { target { *-*-cygwin* } } } } ! { dg-final { scan-assembler-times "brasl\t%r\[0-9\]*,myBindC" 1 { target { s390*-*-* } } } } +! { dg-final { scan-assembler-times "bl \.myBindC" 1 { target { powerpc-ibm-aix* } } } } ! { dg-final { scan-assembler-times "add_u32\t\[sv\]\[0-9\]*, \[sv\]\[0-9\]*, myBindC@rel32@lo" 1 { target { amdgcn*-*-* } } } } ! { dg-final { scan-tree-dump-times "cfi_desc_to_gfc_desc \\\(&parm\\." 1 "original" } } -- cgit v1.1 From c1ef0c9234c29c33397b7687ba54c1221fcbcb6b Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 22 Apr 2021 00:16:32 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 63 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index caa346a..d7e47c1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,66 @@ +2021-04-21 David Edelsohn + + * gfortran.dg/bind_c_array_params_2.f90: Look for AIX-specific call + pattern. + +2021-04-21 Marek Polacek + + PR c++/96380 + * g++.dg/cpp0x/enum_base4.C: New test. + * g++.dg/cpp0x/enum_base5.C: New test. + +2021-04-21 Alex Coplan + + PR target/99988 + * gcc.target/aarch64/pr99988.c: New test. + +2021-04-21 Jakub Jelinek + + * g++.dg/cpp1z/constexpr-lambda26.C: Add dg-additional-options + -fchecking. + * g++.dg/cpp1y/auto-fn61.C: Likewise. + * g++.dg/cpp2a/nontype-class39.C: Likewise. + * g++.dg/cpp0x/constexpr-52830.C: Likewise. + * g++.dg/cpp0x/vt-88982.C: Likewise. + * c-c++-common/goacc/kernels-decompose-ice-1.c: Add -fchecking to + dg-additional-options. + * c-c++-common/goacc/kernels-decompose-ice-2.c: Likewise. + +2021-04-21 H.J. Lu + + * gcc.target/i386/monitor-2.c: New test. + +2021-04-21 Richard Biener + + PR testsuite/100176 + * g++.dg/compat/struct-layout-1_generate.c: Add missing return. + * gcc.dg/compat/struct-layout-1_generate.c: Likewise. + +2021-04-21 Jakub Jelinek + + PR rtl-optimization/100148 + * g++.dg/opt/pr100148.C: New test. + +2021-04-21 Tobias Burnus + + * gfortran.dg/gomp/depobj-1.f90: New test. + * gfortran.dg/gomp/depobj-2.f90: New test. + +2021-04-21 Stefan Schulze Frielinghaus + + * gcc.dg/vect/pr71264.c: Xfail on IBM Z due to V4QImode support. + +2021-04-21 Richard Sandiford + + PR middle-end/100130 + * c-c++-common/attr-retain-10.c: New test. + * c-c++-common/attr-retain-11.c: Likewise. + +2021-04-21 Stefan Schulze Frielinghaus + + * gcc.dg/vect/bb-slp-39.c: Change number of times the pattern + must match for target IBM Z only. + 2021-04-20 Jason Merrill PR c++/100109 -- cgit v1.1 From 5668843346c74cabf830e46b45fad24db4566fd6 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Thu, 22 Apr 2021 09:50:26 +0200 Subject: testsuite/100176 - fix struct-layout-1_generate.c compile With -Werror=return-type we run into compile fails complaining about missing return stmts. 2021-04-21 Richard Biener PR testsuite/100176 * objc.dg/gnu-encoding/struct-layout-encoding-1_generate.c: Add missing return. --- gcc/testsuite/objc.dg/gnu-encoding/struct-layout-encoding-1_generate.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/objc.dg/gnu-encoding/struct-layout-encoding-1_generate.c b/gcc/testsuite/objc.dg/gnu-encoding/struct-layout-encoding-1_generate.c index 824e4ba..ca24200 100644 --- a/gcc/testsuite/objc.dg/gnu-encoding/struct-layout-encoding-1_generate.c +++ b/gcc/testsuite/objc.dg/gnu-encoding/struct-layout-encoding-1_generate.c @@ -690,6 +690,8 @@ subvalues (struct entry *e, char *p, char *letter) if (e[0].len != 0) output_FNB ('B', e); return 1; + default: + return 0; } } -- cgit v1.1 From faf7d413a3f3337be1a3ac5cdf33e0e3b87b426e Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Thu, 22 Apr 2021 11:05:17 +0200 Subject: gfortran.dg/pr68078.f90: Avoid increasing RLIMIT_AS pr68078.f90 tests out-of-memory handling and calls set_vm_limit to set the soft limit. However, setrlimit was then called with hard limit RLIM_INFINITY, which failed when the current hard limit was lower. gcc/testsuite/ * gfortran.dg/set_vm_limit.c (set_vm_limit): Call getrlimit, use obtained hard limit, and only call setrlimit if new softlimit is lower. --- gcc/testsuite/gfortran.dg/set_vm_limit.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gfortran.dg/set_vm_limit.c b/gcc/testsuite/gfortran.dg/set_vm_limit.c index 30c4b43..8344f6f 100644 --- a/gcc/testsuite/gfortran.dg/set_vm_limit.c +++ b/gcc/testsuite/gfortran.dg/set_vm_limit.c @@ -8,9 +8,20 @@ void set_vm_limit (int vm_limit) { - struct rlimit rl = { vm_limit, RLIM_INFINITY }; + struct rlimit rl; int r; + r = getrlimit (RLIMIT_AS, &rl); + if (r) + { + perror ("get_vm_limit"); + exit (1); + } + + if (vm_limit >= rl.rlim_cur) + return; + + rl.rlim_cur = vm_limit; r = setrlimit (RLIMIT_AS, &rl); if (r) { -- cgit v1.1 From d44d8ed6b4e6fb2d0cf7566214e2e8281dd44cf0 Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Thu, 22 Apr 2021 12:43:25 +0000 Subject: testsuite/aarch64: Run pr99988.c test under lp64 only The new test fails with -mabi=ilp32: sorry, unimplemented: return address signing is only supported for '-mabi=lp64' 2021-04-22 Christophe Lyon gcc/testsuite/ PR target/99988 * gcc.target/aarch64/pr99988.c: Skip if not lp64 target. --- gcc/testsuite/gcc.target/aarch64/pr99988.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/aarch64/pr99988.c b/gcc/testsuite/gcc.target/aarch64/pr99988.c index 2d87f41..7cca496 100644 --- a/gcc/testsuite/gcc.target/aarch64/pr99988.c +++ b/gcc/testsuite/gcc.target/aarch64/pr99988.c @@ -1,4 +1,4 @@ -/* { dg-do compile } */ +/* { dg-do compile { target lp64 } } */ /* { dg-options "-O2 -mbranch-protection=standard" } */ /* { dg-final { scan-assembler-times {bti j} 13 } } */ int a; -- cgit v1.1 From 0cda606d08d6196b76524c7b6ad51d87fed0d54b Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Thu, 22 Apr 2021 16:30:38 +0200 Subject: i386: Fix unsigned int -> double conversion on i386 w/ -mfpmath=sse [PR100119] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2021-04-22 UroÅ¡ Bizjak gcc/ PR target/100119 * config/i386/i386-expand.c (ix86_expand_convert_uns_sidf_sse): Remove the sign with FE_DOWNWARD, where x - x = -0.0. gcc/testsuite/ PR target/100119 * gcc.target/i386/pr100119.c: New test. --- gcc/testsuite/gcc.target/i386/pr100119.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr100119.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/i386/pr100119.c b/gcc/testsuite/gcc.target/i386/pr100119.c new file mode 100644 index 0000000..be9472e --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr100119.c @@ -0,0 +1,28 @@ +/* PR target/100119 */ +/* { dg-do run { target sse2_runtime } } */ +/* { dg-require-effective-target fenv } */ +/* { dg-options "-O2 -frounding-math -msse2 -mno-avx512f -mfpmath=sse" } */ + +#include + +double +__attribute__((noinline)) +test (unsigned int x) +{ + return x; +} + +int +main () +{ + double result; + + fesetround (FE_DOWNWARD); + + result = test (0); + + if (__builtin_signbit (result) != 0) + __builtin_abort (); + + return 0; +} -- cgit v1.1 From 3bb6a9c01f1e9b5daf9b37fca57e90804ba90d66 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Thu, 22 Apr 2021 11:32:29 +0200 Subject: Fix various typos. PR testsuite/100159 PR testsuite/100192 gcc/ChangeLog: * builtins.c (expand_builtin): Fix typos and missing comments. * dwarf2out.c (gen_subprogram_die): Likewise. (gen_struct_or_union_type_die): Likewise. gcc/fortran/ChangeLog: * frontend-passes.c (optimize_expr): Fix typos and missing comments. gcc/testsuite/ChangeLog: * g++.dg/template/nontype29.C: Fix typos and missing comments. * gcc.dg/Warray-bounds-64.c: Likewise. * gcc.dg/Warray-parameter.c: Likewise. * gcc.dg/Wstring-compare.c: Likewise. * gcc.dg/format/gcc_diag-11.c: Likewise. * gfortran.dg/array_constructor_3.f90: Likewise. * gfortran.dg/matmul_bounds_9.f90: Likewise. * gfortran.dg/pr78033.f90: Likewise. * gfortran.dg/pr96325.f90: Likewise. --- gcc/testsuite/g++.dg/template/nontype29.C | 4 ++-- gcc/testsuite/gcc.dg/Warray-bounds-64.c | 2 +- gcc/testsuite/gcc.dg/Warray-parameter.c | 2 +- gcc/testsuite/gcc.dg/Wstring-compare.c | 10 +++++----- gcc/testsuite/gcc.dg/format/gcc_diag-11.c | 2 +- gcc/testsuite/gfortran.dg/array_constructor_3.f90 | 2 +- gcc/testsuite/gfortran.dg/matmul_bounds_9.f90 | 2 +- gcc/testsuite/gfortran.dg/pr78033.f90 | 2 +- gcc/testsuite/gfortran.dg/pr96325.f90 | 2 +- 9 files changed, 14 insertions(+), 14 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/template/nontype29.C b/gcc/testsuite/g++.dg/template/nontype29.C index 18a3058..dd4e20f 100644 --- a/gcc/testsuite/g++.dg/template/nontype29.C +++ b/gcc/testsuite/g++.dg/template/nontype29.C @@ -3,7 +3,7 @@ // { dg-do compile } // { dg-options "-Wall" } -#if __cpluspls >= 201103L +#if __cplusplus >= 201103L // C++ 11 test case from comment #0. namespace comment_0 { @@ -60,7 +60,7 @@ void h () } // comment_2 -#if __cpluspls >= 201103L +#if __cplusplus >= 201103L // C++ 11 test case from comment #5. namespace comment_5 { diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-64.c b/gcc/testsuite/gcc.dg/Warray-bounds-64.c index 88b88de..f5ebc3d 100644 --- a/gcc/testsuite/gcc.dg/Warray-bounds-64.c +++ b/gcc/testsuite/gcc.dg/Warray-bounds-64.c @@ -7,7 +7,7 @@ asks for. { dg-do compile } - { dg-options "-O2 -Wall -Warray-parameter -Wno-vla-paramater" } */ + { dg-options "-O2 -Wall -Warray-parameter -Wno-vla-parameter" } */ #define NOIPA __attribute__ ((noipa)) diff --git a/gcc/testsuite/gcc.dg/Warray-parameter.c b/gcc/testsuite/gcc.dg/Warray-parameter.c index 42be310..6c5195a 100644 --- a/gcc/testsuite/gcc.dg/Warray-parameter.c +++ b/gcc/testsuite/gcc.dg/Warray-parameter.c @@ -5,7 +5,7 @@ Also verify that the array/pointer argument form in a mismatched redeclaration doesn't override the form in the initial declaration. { dg-do compile } - { dg-options "-Wall -Warray-parameter -Wno-vla-paramater" } */ + { dg-options "-Wall -Warray-parameter -Wno-vla-parameter" } */ /* Redclarations with the same or equivalent array form should not be dianosed. T[0] is diagnosed by -Wpedantic for being invalid diff --git a/gcc/testsuite/gcc.dg/Wstring-compare.c b/gcc/testsuite/gcc.dg/Wstring-compare.c index d1534bf..239bbfe 100644 --- a/gcc/testsuite/gcc.dg/Wstring-compare.c +++ b/gcc/testsuite/gcc.dg/Wstring-compare.c @@ -21,7 +21,7 @@ extern char b4[4]; void strcmp_array_lit (void) { if (strcmp (a4, "1234")) // { dg-warning "'strcmp' of a string of length 4 and an array of size 4 evaluates to nonzero" } - // { dg-bogus "in this expreession" "unwanted note" { target *-*-* } .-1 } + // { dg-bogus "in this expression" "unwanted note" { target *-*-* } .-1 } sink (0, a4); int cmp; @@ -44,7 +44,7 @@ void strcmp_array_pstr (void) { if (strcmp (a4, s4)) // { dg-warning "'strcmp' of a string of length 4 and an array of size 4 evaluates to nonzero" } - // { dg-bogus "in this expreession" "unwanted note" { target *-*-* } .-1 } + // { dg-bogus "in this expression" "unwanted note" { target *-*-* } .-1 } sink (1, a4); else sink (0, a4); @@ -86,7 +86,7 @@ void strcmp_array_copy (void) { strcpy (s, "1234"); if (strcmp (a4, s)) // { dg-warning "'strcmp' of a string of length 4 and an array of size 4 evaluates to nonzero" } - // { dg-bogus "in this expreession" "unwanted note" { target *-*-* } .-1 } + // { dg-bogus "in this expression" "unwanted note" { target *-*-* } .-1 } sink (1, a4); else sink (0, a4); @@ -131,7 +131,7 @@ void strcmp_member_array_lit (const struct S *p) void strncmp_array_lit (void) { if (strncmp (a4, "12345", 5)) // { dg-warning "'strncmp' of a string of length 5, an array of size 4 and bound of 5 evaluates to nonzero" } - // { dg-bogus "in this expreession" "unwanted note" { target *-*-* } .-1 } + // { dg-bogus "in this expression" "unwanted note" { target *-*-* } .-1 } sink (0, a4); int cmp; @@ -161,7 +161,7 @@ void strncmp_strarray_copy (void) char b[6]; strcpy (b, "12345"); if (strncmp (a, b, 5)) // { dg-warning "'strncmp' of strings of length 4 and 5 and bound of 5 evaluates to nonzero" } - // { dg-bogus "in this expreession" "unwanted note" { target *-*-* } .-1 } + // { dg-bogus "in this expression" "unwanted note" { target *-*-* } .-1 } sink (0, a, b); } diff --git a/gcc/testsuite/gcc.dg/format/gcc_diag-11.c b/gcc/testsuite/gcc.dg/format/gcc_diag-11.c index 262e7e5..80d24b6 100644 --- a/gcc/testsuite/gcc.dg/format/gcc_diag-11.c +++ b/gcc/testsuite/gcc.dg/format/gcc_diag-11.c @@ -375,7 +375,7 @@ void test_cdiag_identifier (tree t, gimple *gc) cdiag ("ident z_ with trailing underscore"); /* { dg-warning "unquoted identifier or keyword 'z_'" } */ cdiag ("v_ variable"); /* { dg-warning "unquoted identifier or keyword 'v_'" } */ cdiag ("call foo_bar"); /* { dg-warning "unquoted identifier or keyword 'foo_bar'" } */ - cdiag ("unqoted x_y ident"); /* { dg-warning "unquoted identifier or keyword 'x_y'" } */ + cdiag ("unquoted x_y ident"); /* { dg-warning "unquoted identifier or keyword 'x_y'" } */ cdiag ("size_t type"); /* { dg-warning "unquoted identifier or keyword 'size_t'" } */ cdiag ("bigger than INT_MAX");/* { dg-warning "unquoted identifier or keyword 'INT_MAX'" } */ diff --git a/gcc/testsuite/gfortran.dg/array_constructor_3.f90 b/gcc/testsuite/gfortran.dg/array_constructor_3.f90 index 7ddd1f4..37d40a4 100644 --- a/gcc/testsuite/gfortran.dg/array_constructor_3.f90 +++ b/gcc/testsuite/gfortran.dg/array_constructor_3.f90 @@ -1,5 +1,5 @@ ! { dg-do compile } ! Check that empty array constructors are rejected program hum - print *, (//) { dg-error "Empty array constructor" } + print *, (//) ! { dg-error "Empty array constructor" } end program hum diff --git a/gcc/testsuite/gfortran.dg/matmul_bounds_9.f90 b/gcc/testsuite/gfortran.dg/matmul_bounds_9.f90 index 5552e40..786e3e7 100644 --- a/gcc/testsuite/gfortran.dg/matmul_bounds_9.f90 +++ b/gcc/testsuite/gfortran.dg/matmul_bounds_9.f90 @@ -1,6 +1,6 @@ ! { dg-do run } ! { dg-options "-fbounds-check -ffrontend-optimize" } -! { dg-shouldfail "Fortran runtime error: Incorrect extent in argument B in MATMUL intrnisic for dimension 2: is 1, should be 2" } +! { dg-shouldfail "Fortran runtime error: Incorrect extent in argument B in MATMUL intrinsic for dimension 2: is 1, should be 2" } module x implicit none contains diff --git a/gcc/testsuite/gfortran.dg/pr78033.f90 b/gcc/testsuite/gfortran.dg/pr78033.f90 index ce794b3..9593521 100644 --- a/gcc/testsuite/gfortran.dg/pr78033.f90 +++ b/gcc/testsuite/gfortran.dg/pr78033.f90 @@ -14,7 +14,7 @@ subroutine f(n, x, y) y = [real(x), aimag(x)] y = [real(x(1:n)), aimag(x(1:n))] y = [real(knd) :: 1] - y = [real(kind=42) :: 1] { dg-error "Invalid type-spec" } + y = [real(kind=42) :: 1] ! { dg-error "Invalid type-spec" } y = [real(kind=knd) :: 1] y = [real(kind=knd, a=1.)] y = [real(a=1.)] diff --git a/gcc/testsuite/gfortran.dg/pr96325.f90 b/gcc/testsuite/gfortran.dg/pr96325.f90 index 62f4cfb..b6a86e8 100644 --- a/gcc/testsuite/gfortran.dg/pr96325.f90 +++ b/gcc/testsuite/gfortran.dg/pr96325.f90 @@ -15,7 +15,7 @@ type(t2) :: t integer :: a - a = t%r1%foo(1) { dg-error "is not an inquiry reference" } + a = t%r1%foo(1) ! { dg-error "is not an inquiry reference" } if (a == 42) stop end -- cgit v1.1 From ac456fd981db6b0c2f7ee1ab0d17d36087a74dc2 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Thu, 22 Apr 2021 19:14:58 +0200 Subject: testsuite/substr_{9,10}.f90: Move to gfortran.dg/ gcc/testsuite/ * substr_9.f90: Move to ... * gfortran.dg/substr_9.f90: ... here. * substr_10.f90: Move to ... * gfortran.dg/substr_10.f90: ... here. --- gcc/testsuite/gfortran.dg/substr_10.f90 | 11 +++++++++++ gcc/testsuite/gfortran.dg/substr_9.f90 | 28 ++++++++++++++++++++++++++++ gcc/testsuite/substr_10.f90 | 11 ----------- gcc/testsuite/substr_9.f90 | 28 ---------------------------- 4 files changed, 39 insertions(+), 39 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/substr_10.f90 create mode 100644 gcc/testsuite/gfortran.dg/substr_9.f90 delete mode 100644 gcc/testsuite/substr_10.f90 delete mode 100644 gcc/testsuite/substr_9.f90 (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gfortran.dg/substr_10.f90 b/gcc/testsuite/gfortran.dg/substr_10.f90 new file mode 100644 index 0000000..918ca8a --- /dev/null +++ b/gcc/testsuite/gfortran.dg/substr_10.f90 @@ -0,0 +1,11 @@ +! { dg-do compile } +! PR93340 - test error handling of substring simplification + +subroutine p + integer,parameter :: k = len ('a'(:0)) + integer,parameter :: m = len ('a'(0:)) ! { dg-error "Substring start index" } + call foo ('bcd'(-8:-9)) + call foo ('bcd'(-9:-8)) ! { dg-error "Substring start index" } + call foo ('bcd'(:12)) ! { dg-error "Substring end index" } + call foo ('bcd'(-12:)) ! { dg-error "Substring start index" } +end diff --git a/gcc/testsuite/gfortran.dg/substr_9.f90 b/gcc/testsuite/gfortran.dg/substr_9.f90 new file mode 100644 index 0000000..73152d6 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/substr_9.f90 @@ -0,0 +1,28 @@ +! { dg-do run } +! { dg-options "-std=gnu -fdump-tree-original" } +! PR93340 - issues with substrings in initializers + +program p + implicit none + integer, parameter :: m = 1 + character b(2) /'a', 'b' (1:1)/ + character c(2) /'a', 'bc' (1:1)/ + character d(2) /'a', 'bxyz'(m:m)/ + character e(2) + character f(2) + data e /'a', 'bxyz'( :1)/ + data f /'a', 'xyzb'(4:4)/ + character :: g(2) = [ 'a', 'b' (1:1) ] + character :: h(2) = [ 'a', 'bc'(1:1) ] + character :: k(2) = [ 'a', 'bc'(m:1) ] + if (b(2) /= "b") stop 1 + if (c(2) /= "b") stop 2 + if (d(2) /= "b") stop 3 + if (e(2) /= "b") stop 4 + if (f(2) /= "b") stop 5 + if (g(2) /= "b") stop 6 + if (h(2) /= "b") stop 7 + if (k(2) /= "b") stop 8 +end + +! { dg-final { scan-tree-dump-times "xyz" 0 "original" } } diff --git a/gcc/testsuite/substr_10.f90 b/gcc/testsuite/substr_10.f90 deleted file mode 100644 index 918ca8a..0000000 --- a/gcc/testsuite/substr_10.f90 +++ /dev/null @@ -1,11 +0,0 @@ -! { dg-do compile } -! PR93340 - test error handling of substring simplification - -subroutine p - integer,parameter :: k = len ('a'(:0)) - integer,parameter :: m = len ('a'(0:)) ! { dg-error "Substring start index" } - call foo ('bcd'(-8:-9)) - call foo ('bcd'(-9:-8)) ! { dg-error "Substring start index" } - call foo ('bcd'(:12)) ! { dg-error "Substring end index" } - call foo ('bcd'(-12:)) ! { dg-error "Substring start index" } -end diff --git a/gcc/testsuite/substr_9.f90 b/gcc/testsuite/substr_9.f90 deleted file mode 100644 index 73152d6..0000000 --- a/gcc/testsuite/substr_9.f90 +++ /dev/null @@ -1,28 +0,0 @@ -! { dg-do run } -! { dg-options "-std=gnu -fdump-tree-original" } -! PR93340 - issues with substrings in initializers - -program p - implicit none - integer, parameter :: m = 1 - character b(2) /'a', 'b' (1:1)/ - character c(2) /'a', 'bc' (1:1)/ - character d(2) /'a', 'bxyz'(m:m)/ - character e(2) - character f(2) - data e /'a', 'bxyz'( :1)/ - data f /'a', 'xyzb'(4:4)/ - character :: g(2) = [ 'a', 'b' (1:1) ] - character :: h(2) = [ 'a', 'bc'(1:1) ] - character :: k(2) = [ 'a', 'bc'(m:1) ] - if (b(2) /= "b") stop 1 - if (c(2) /= "b") stop 2 - if (d(2) /= "b") stop 3 - if (e(2) /= "b") stop 4 - if (f(2) /= "b") stop 5 - if (g(2) /= "b") stop 6 - if (h(2) /= "b") stop 7 - if (k(2) /= "b") stop 8 -end - -! { dg-final { scan-tree-dump-times "xyz" 0 "original" } } -- cgit v1.1 From 330cc29c06306ebf7bd3b2d37704cc69944923ff Mon Sep 17 00:00:00 2001 From: Patrick Palka Date: Thu, 22 Apr 2021 13:32:40 -0400 Subject: c++: Add testcase for already fixed PR [PR16617] We correctly diagnose the invalid access since r11-1350. gcc/testsuite/ChangeLog: PR c++/16617 * g++.dg/template/access36.C: New test. --- gcc/testsuite/g++.dg/template/access36.C | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 gcc/testsuite/g++.dg/template/access36.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/template/access36.C b/gcc/testsuite/g++.dg/template/access36.C new file mode 100644 index 0000000..72ca23c --- /dev/null +++ b/gcc/testsuite/g++.dg/template/access36.C @@ -0,0 +1,25 @@ +// PR c++/16617 + +class B +{ + protected: + int i; +}; + +template void fr (); + +class D2 : public B +{ + friend void fr (); +}; + +template struct X +{}; + +template void fr () +{ + X<&B::i> x1; // { dg-error "protected" } + X<&D2::i> x2; // { dg-error "protected" } +} + +template void fr(); -- cgit v1.1 From 3275f2e2af24541f55462c23af4c6530ac12c5e2 Mon Sep 17 00:00:00 2001 From: Patrick Palka Date: Thu, 22 Apr 2021 13:32:44 -0400 Subject: c++: Add testcase for already fixed PR [PR84689] We correctly accept this testcase since r11-1638. gcc/testsuite/ChangeLog: PR c++/84689 * g++.dg/cpp0x/sfinae67.C: New test. --- gcc/testsuite/g++.dg/cpp0x/sfinae67.C | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/sfinae67.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp0x/sfinae67.C b/gcc/testsuite/g++.dg/cpp0x/sfinae67.C new file mode 100644 index 0000000..cfed92a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/sfinae67.C @@ -0,0 +1,20 @@ +// PR c++/84689 +// { dg-do compile { target c++11 } } + +struct base { + void operator()(); +}; + +struct a : base { }; +struct b : base { }; + +struct f : a, b { + using a::operator(); + using b::operator(); +}; + +template auto g(int) -> decltype(T()()); +template auto g(...) -> int; + +using type = decltype(g(0)); +using type = int; -- cgit v1.1 From 244dfb95119106e9267f37583caac565c39eb0ec Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Tue, 20 Apr 2021 20:24:09 -0400 Subject: c++: Prevent bogus -Wtype-limits warning with NTTP [PR100161] Recently, we made sure that we never call value_dependent_expression_p on an expression that isn't potential_constant_expression. That caused this bogus warning with a non-type template parameter, something that users don't want to see. The problem is that in tsubst_copy_and_build/LE_EXPR 't' is "i < n", which, due to 'i', is not p_c_e, therefore we call t_d_e_p. But the type of 'n' isn't dependent, so we think the whole 't' expression is not dependent. It seems we need to test both op0 and op1 separately to suppress this warning. gcc/cp/ChangeLog: PR c++/100161 * pt.c (tsubst_copy_and_build) : Test op0 and op1 separately for value- or type-dependence. gcc/testsuite/ChangeLog: PR c++/100161 * g++.dg/warn/Wtype-limits6.C: New test. --- gcc/testsuite/g++.dg/warn/Wtype-limits6.C | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 gcc/testsuite/g++.dg/warn/Wtype-limits6.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/warn/Wtype-limits6.C b/gcc/testsuite/g++.dg/warn/Wtype-limits6.C new file mode 100644 index 0000000..9d5886d --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wtype-limits6.C @@ -0,0 +1,17 @@ +// PR c++/100161 +// { dg-additional-options "-Wtype-limits" } + +void f(unsigned); + +template +void g() +{ + for (unsigned i = 0; i < n; i++) { // { dg-bogus "always false" } + f(i); + } +} + +void h() +{ + g<0>(); +} -- cgit v1.1 From 92664c058d705fcaf57875f93b4dfc36cf011afd Mon Sep 17 00:00:00 2001 From: Patrick Palka Date: Thu, 22 Apr 2021 17:47:00 -0400 Subject: c++: Add testcase for already fixed PR [PR77435] We correctly accept this testcase since r8-1437. gcc/testsuite/ChangeLog: PR c++/77435 * g++.dg/template/partial-specialization9.C: New test. --- gcc/testsuite/g++.dg/template/partial-specialization9.C | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 gcc/testsuite/g++.dg/template/partial-specialization9.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/template/partial-specialization9.C b/gcc/testsuite/g++.dg/template/partial-specialization9.C new file mode 100644 index 0000000..49f3500 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/partial-specialization9.C @@ -0,0 +1,7 @@ +// PR c++/77435 + +template struct S; +template struct S<0, T, A> {}; +int i; +S<0, int*, &i> r; // OK +S<0, int&, i> s; // error: aggregate 'S<0, int&, i> s' has incomplete type -- cgit v1.1 From 4e1aaf32ddf13cc79fcf146d6b62a6e0feb82be0 Mon Sep 17 00:00:00 2001 From: Patrick Palka Date: Thu, 22 Apr 2021 17:47:02 -0400 Subject: c++: Add testcase for already fixed PR [PR94508] We correctly accept this testcase since r11-8144. gcc/testsuite/ChangeLog: PR c++/94508 * g++.dg/cpp2a/concepts-uneval3.C: New test. --- gcc/testsuite/g++.dg/cpp2a/concepts-uneval3.C | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp2a/concepts-uneval3.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-uneval3.C b/gcc/testsuite/g++.dg/cpp2a/concepts-uneval3.C new file mode 100644 index 0000000..7fc4065 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/concepts-uneval3.C @@ -0,0 +1,9 @@ +// PR c++/94508 +// { dg-do compile { target c++20 } } + +template +struct A { + void f() requires (this, true) { } +}; + +template struct A; -- cgit v1.1 From e3948473e927a7c3197ce1a63628fe427f15f6c6 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 23 Apr 2021 00:16:25 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 67 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d7e47c1..2988817 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,70 @@ +2021-04-22 Patrick Palka + + PR c++/94508 + * g++.dg/cpp2a/concepts-uneval3.C: New test. + +2021-04-22 Patrick Palka + + PR c++/77435 + * g++.dg/template/partial-specialization9.C: New test. + +2021-04-22 Marek Polacek + + PR c++/100161 + * g++.dg/warn/Wtype-limits6.C: New test. + +2021-04-22 Patrick Palka + + PR c++/84689 + * g++.dg/cpp0x/sfinae67.C: New test. + +2021-04-22 Patrick Palka + + PR c++/16617 + * g++.dg/template/access36.C: New test. + +2021-04-22 Tobias Burnus + + * substr_9.f90: Move to ... + * gfortran.dg/substr_9.f90: ... here. + * substr_10.f90: Move to ... + * gfortran.dg/substr_10.f90: ... here. + +2021-04-22 Martin Liska + + PR testsuite/100159 + PR testsuite/100192 + * g++.dg/template/nontype29.C: Fix typos and missing comments. + * gcc.dg/Warray-bounds-64.c: Likewise. + * gcc.dg/Warray-parameter.c: Likewise. + * gcc.dg/Wstring-compare.c: Likewise. + * gcc.dg/format/gcc_diag-11.c: Likewise. + * gfortran.dg/array_constructor_3.f90: Likewise. + * gfortran.dg/matmul_bounds_9.f90: Likewise. + * gfortran.dg/pr78033.f90: Likewise. + * gfortran.dg/pr96325.f90: Likewise. + +2021-04-22 UroÅ¡ Bizjak + + PR target/100119 + * gcc.target/i386/pr100119.c: New test. + +2021-04-22 Christophe Lyon + + PR target/99988 + * gcc.target/aarch64/pr99988.c: Skip if not lp64 target. + +2021-04-22 Tobias Burnus + + * gfortran.dg/set_vm_limit.c (set_vm_limit): Call getrlimit, use + obtained hard limit, and only call setrlimit if new softlimit is lower. + +2021-04-22 Richard Biener + + PR testsuite/100176 + * objc.dg/gnu-encoding/struct-layout-encoding-1_generate.c: Add + missing return. + 2021-04-21 David Edelsohn * gfortran.dg/bind_c_array_params_2.f90: Look for AIX-specific call -- cgit v1.1 From 342de04d993beaa644d0b0087c20bef5dad5bf5f Mon Sep 17 00:00:00 2001 From: liuhongt Date: Fri, 16 Apr 2021 11:29:10 +0800 Subject: MASK_AVX256_SPLIT_UNALIGNED_STORE/LOAD should be cleared in opts->x_target_flags when X86_TUNE_AVX256_UNALIGNED_LOAD/STORE_OPTIMAL is enabled by target attribute. gcc/ChangeLog: PR target/100093 * config/i386/i386-options.c (ix86_option_override_internal): Clear MASK_AVX256_SPLIT_UNALIGNED_LOAD/STORE in x_target_flags when X86_TUNE_AVX256_UNALIGNED_LOAD/STORE_OPTIMAL is enabled by target attribute. gcc/testsuite/ChangeLog: PR target/100093 * gcc.target/i386/pr100093.c: New test. --- gcc/testsuite/gcc.target/i386/pr100093.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr100093.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/i386/pr100093.c b/gcc/testsuite/gcc.target/i386/pr100093.c new file mode 100644 index 0000000..f32a4bc --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr100093.c @@ -0,0 +1,12 @@ +/* PR target/100093 */ +/* { dg-do compile } */ +/* { dg-options "-O3 -march=znver1" } */ +/* { dg-final { scan-assembler-not "vextractf128" } } */ + +__attribute__((target("tune=skylake-avx512"))) +void fill_avx2(double *__restrict__ data, int n, double value) +{ + for (int i = 0; i < n * 16; i++) { + data[i] = value; + } +} -- cgit v1.1 From 700e542971251b11623cce877075567815f72965 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Fri, 9 Apr 2021 09:35:51 +0200 Subject: tree-optimization/99971 - improve BB vect dependence analysis We can use TBAA even when we have a DR, do so. For the testcase that means fully vectorizing it instead of only vectorizing the first store group resulting in suboptimal code. 2021-04-09 Richard Biener PR tree-optimization/99971 * tree-vect-data-refs.c (vect_slp_analyze_node_dependences): Always use TBAA for loads. * g++.dg/vect/slp-pr99971.cc: New testcase. --- gcc/testsuite/g++.dg/vect/slp-pr99971.cc | 36 ++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 gcc/testsuite/g++.dg/vect/slp-pr99971.cc (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/vect/slp-pr99971.cc b/gcc/testsuite/g++.dg/vect/slp-pr99971.cc new file mode 100644 index 0000000..bec6418 --- /dev/null +++ b/gcc/testsuite/g++.dg/vect/slp-pr99971.cc @@ -0,0 +1,36 @@ +// { dg-do compile } +// { dg-require-effective-target vect_int } + +struct A +{ + unsigned int a, b, c, d; + + A& operator+= (A const& that) + { + a += that.a; + b += that.b; + c += that.c; + d += that.d; + return *this; + } + + A& operator-= (A const& that) + { + a -= that.a; + b -= that.b; + c -= that.c; + d -= that.d; + return *this; + } +}; + +void test(A& x, A const& y1, A const& y2) +{ + x += y1; + x -= y2; +} + +// We want to SLP vectorize a single connected SLP subgraph with two instances +// { dg-final { scan-tree-dump-not "removing SLP instance" "slp2" } } +// { dg-final { scan-tree-dump-times "SLPing BB part" 1 "slp2" } } +// { dg-final { scan-tree-dump-times "Vectorizing SLP" 2 "slp2" } } -- cgit v1.1 From 5f8aed72e76970d2c6fa06fb23fdaa47660555b0 Mon Sep 17 00:00:00 2001 From: Patrick Palka Date: Fri, 23 Apr 2021 08:28:58 -0400 Subject: c++: Refine enum direct-list-initialization [CWG2374] This implements the wording changes of CWG2374, which clarifies the wording of P0138 to forbid e.g. direct-list-initialization of a scoped enumeration from a different scoped enumeration. gcc/cp/ChangeLog: DR 2374 * decl.c (is_direct_enum_init): Check the implicit convertibility requirement added by CWG 2374. gcc/testsuite/ChangeLog: DR 2374 * g++.dg/cpp1z/direct-enum-init2.C: New test. --- gcc/testsuite/g++.dg/cpp1z/direct-enum-init2.C | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1z/direct-enum-init2.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp1z/direct-enum-init2.C b/gcc/testsuite/g++.dg/cpp1z/direct-enum-init2.C new file mode 100644 index 0000000..5b94a8d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/direct-enum-init2.C @@ -0,0 +1,8 @@ +// DR 2374 +// { dg-do compile { target c++17 } } + +enum class Orange; +enum class Apple; + +extern Orange o; +Apple a{o}; // { dg-error "cannot convert" } -- cgit v1.1 From 87fc34a461cf362947a430d8a241f653fd83bc7b Mon Sep 17 00:00:00 2001 From: Patrick Palka Date: Fri, 23 Apr 2021 08:47:02 -0400 Subject: c++: Fix pretty printing pointer to function type [PR98767] When pretty printing a pointer to function type, pp_cxx_parameter_declaration_clause ends up always outputting an empty function parameter list because the loop that outputs the list iterates over 'args' instead of 'types', and 'args' is empty when a FUNCTION_TYPE is passed to this routine (as opposed to a FUNCTION_DECL). This patch fixes this by making the loop iterate over 'types' instead. This patch also moves the retrofitted chain-of-PARM_DECLs printing from here to pp_cxx_requires_expr, the only caller that uses it. Doing so lets us easily output the trailing '...' in the parameter list of a variadic function, which this patch also implements. gcc/cp/ChangeLog: PR c++/98767 * cxx-pretty-print.c (pp_cxx_parameter_declaration_clause): Adjust parameter list loop to iterate over 'types' instead of 'args'. Output the trailing '...' for a variadic function. Remove PARM_DECL support. (pp_cxx_requires_expr): Pretty print the parameter list directly instead of going through pp_cxx_parameter_declaration_clause. gcc/testsuite/ChangeLog: PR c++/98767 * g++.dg/concepts/diagnostic17.C: New test. --- gcc/testsuite/g++.dg/concepts/diagnostic17.C | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 gcc/testsuite/g++.dg/concepts/diagnostic17.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/concepts/diagnostic17.C b/gcc/testsuite/g++.dg/concepts/diagnostic17.C new file mode 100644 index 0000000..49d5733 --- /dev/null +++ b/gcc/testsuite/g++.dg/concepts/diagnostic17.C @@ -0,0 +1,17 @@ +// PR c++/98767 +// { dg-do compile { target c++20 } } + +template +concept Callable = requires(Function func, Args... args) { func(args...); }; + +static_assert(Callable); // { dg-error "failed" } +// { dg-message {Function = int \(\*\)\(\)} "" { target *-*-* } 5 } + +static_assert(Callable); // { dg-error "failed" } +// { dg-message {Function = char \(\*\)\(int\*\)} "" { target *-*-* } 5 } + +static_assert(Callable); // { dg-error "failed" } +// { dg-message {Function = short int \(\*\)\(int\*, int\)} "" { target *-*-* } 5 } + +static_assert(Callable); // { dg-error "failed" } +// { dg-message {Function = long int \(\*\)\(int\*, int, \.\.\.\)} "" { target *-*-* } 5 } -- cgit v1.1 From d2324a5ab3ff097864ae6828cb1db4dd013c70d1 Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Fri, 23 Apr 2021 17:29:29 +0200 Subject: i386: Fix atomic FP peepholes [PR100182] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 64bit loads to/stores from x87 and SSE registers are atomic also on 32-bit targets, so there is no need for additional atomic moves to a temporary register. Introduced load peephole2 patterns assume that there won't be any additional loads from the load location outside the peepholed sequence and wrongly removed the source location initialization. OTOH, introduced store peephole2 patterns assume there won't be any additional loads from the stored location outside the peepholed sequence and wrongly removed the destination location initialization. Note that we can't use plain x87 FST instruction to initialize destination location because FST converts the value to the double-precision format, changing bits during move. The patch restores removed initializations in load and store patterns. Additionally, plain x87 FST in store peephole2 patterns is prevented by limiting the store operand source to SSE registers. 2021-04-23 UroÅ¡ Bizjak gcc/ PR target/100182 * config/i386/sync.md (FILD_ATOMIC/FIST_ATOMIC FP load peephole2): Copy operand 3 to operand 4. Use sse_reg_operand as operand 3 predicate. (FILD_ATOMIC/FIST_ATOMIC FP load peephole2 with mem blockage): Ditto. (LDX_ATOMIC/STX_ATOMIC FP load peephole2): Ditto. (LDX_ATOMIC/LDX_ATOMIC FP load peephole2 with mem blockage): Ditto. (FILD_ATOMIC/FIST_ATOMIC FP store peephole2): Copy operand 1 to operand 0. (FILD_ATOMIC/FIST_ATOMIC FP store peephole2 with mem blockage): Ditto. (LDX_ATOMIC/STX_ATOMIC FP store peephole2): Ditto. (LDX_ATOMIC/LDX_ATOMIC FP store peephole2 with mem blockage): Ditto. gcc/testsuite/ PR target/100182 * gcc.target/i386/pr100182.c: New test. * gcc.target/i386/pr71245-1.c (dg-final): Xfail scan-assembler-not. * gcc.target/i386/pr71245-2.c (dg-final): Ditto. --- gcc/testsuite/gcc.target/i386/pr100182.c | 30 ++++++++++++++++++++++++++++++ gcc/testsuite/gcc.target/i386/pr71245-1.c | 2 +- gcc/testsuite/gcc.target/i386/pr71245-2.c | 2 +- 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr100182.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/i386/pr100182.c b/gcc/testsuite/gcc.target/i386/pr100182.c new file mode 100644 index 0000000..2f92a04 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr100182.c @@ -0,0 +1,30 @@ +/* { dg-do run { target ia32 } } */ +/* { dg-options "-O2 -march=i686" } */ + +struct S { double _M_fp; }; +union U { double d; unsigned long long int l; }; + +void +__attribute__((noipa)) +foo (void) +{ + struct S a0, a1; + union U u; + double d0, d1; + a0._M_fp = 0.0; + a1._M_fp = 1.0; + __atomic_store_8 (&a0._M_fp, __atomic_load_8 (&a1._M_fp, __ATOMIC_SEQ_CST), __ATOMIC_SEQ_CST); + u.l = __atomic_load_8 (&a0._M_fp, __ATOMIC_SEQ_CST); + d0 = u.d; + u.l = __atomic_load_8 (&a1._M_fp, __ATOMIC_SEQ_CST); + d1 = u.d; + if (d0 != d1) + __builtin_abort (); +} + +int +main () +{ + foo (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/pr71245-1.c b/gcc/testsuite/gcc.target/i386/pr71245-1.c index be0b760..02c0dcb 100644 --- a/gcc/testsuite/gcc.target/i386/pr71245-1.c +++ b/gcc/testsuite/gcc.target/i386/pr71245-1.c @@ -19,4 +19,4 @@ void foo_d (void) __atomic_store_n (&d.ll, tmp.ll, __ATOMIC_SEQ_CST); } -/* { dg-final { scan-assembler-not "(fistp|fild)" } } */ +/* { dg-final { scan-assembler-not "(fistp|fild)" { xfail *-*-* } } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr71245-2.c b/gcc/testsuite/gcc.target/i386/pr71245-2.c index 65c1398..bf37a8c 100644 --- a/gcc/testsuite/gcc.target/i386/pr71245-2.c +++ b/gcc/testsuite/gcc.target/i386/pr71245-2.c @@ -19,4 +19,4 @@ void foo_d (void) __atomic_store_n (&d.ll, tmp.ll, __ATOMIC_SEQ_CST); } -/* { dg-final { scan-assembler-not "movlps" } } */ +/* { dg-final { scan-assembler-not "movlps" { xfail *-*-* } } } */ -- cgit v1.1 From 716bb02b40ecef5564abb5ba45a594323123a104 Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Fri, 23 Apr 2021 18:45:14 +0200 Subject: i386: Reject -m96bit-long-double for 64bit targets [PR100041] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 64bit targets default to 128bit long double, so -m96bit-long-double should not be used. Together with -m128bit-long-double, this option was intended to be an optimization for 32bit targets only. Error out when -m96bit-long-double is used with 64bit targets. 2021-04-23 UroÅ¡ Bizjak gcc/ PR target/100041 * config/i386/i386-options.c (ix86_option_override_internal): Error out when -m96bit-long-double is used with 64bit targets. * config/i386/i386.md (*pushxf_rounded): Remove pattern. gcc/testsuite/ PR target/100041 * gcc.target/i386/pr79514.c (dg-error): Expect error for 64bit targets. --- gcc/testsuite/gcc.target/i386/pr79514.c | 1 + 1 file changed, 1 insertion(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/i386/pr79514.c b/gcc/testsuite/gcc.target/i386/pr79514.c index c5b7bf8..8235da6 100644 --- a/gcc/testsuite/gcc.target/i386/pr79514.c +++ b/gcc/testsuite/gcc.target/i386/pr79514.c @@ -1,6 +1,7 @@ /* PR target/79514 */ /* { dg-do compile } */ /* { dg-options "-m96bit-long-double" } */ +/* { dg-error "'-m96bit-long-double' is not compatible" "" { target { ! ia32 } } 0 } */ extern void bar (long double); -- cgit v1.1 From 9a30a3f06b908e4e781324c2e813cd1db87119df Mon Sep 17 00:00:00 2001 From: Michael Meissner Date: Fri, 23 Apr 2021 18:16:03 -0400 Subject: Fix logic error in 32-bit trampolines. The test in the PowerPC 32-bit trampoline support is backwards. It aborts if the trampoline size is greater than the expected size. It should abort when the trampoline size is less than the expected size. I fixed the test so the operands are reversed. I then folded the load immediate into the compare instruction. I verified this by creating a 32-bit trampoline program and manually changing the size of the trampoline to be 48 instead of 40. The program aborted with the larger size. I updated this code and ran the test again and it passed. I added a test case that runs on PowerPC 32-bit Linux systems and it calls the __trampoline_setup function with a larger buffer size than the compiler uses. The test is not run on 64-bit systems, since the function __trampoline_setup is not called. I also limited the test to just Linux systems, in case trampolines are handled differently in other systems. libgcc/ 2021-04-23 Michael Meissner PR target/98952 * config/rs6000/tramp.S (__trampoline_setup, elfv1 #ifdef): Fix trampoline size comparison in 32-bit by reversing test and combining load immediate with compare. (__trampoline_setup, elfv2 #ifdef): Fix trampoline size comparison in 32-bit by reversing test and combining load immediate with compare. gcc/testsuite/ 2021-04-23 Michael Meissner PR target/98952 * gcc.target/powerpc/pr98952.c: New test. --- gcc/testsuite/gcc.target/powerpc/pr98952.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 gcc/testsuite/gcc.target/powerpc/pr98952.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/powerpc/pr98952.c b/gcc/testsuite/gcc.target/powerpc/pr98952.c new file mode 100644 index 0000000..c487fbc --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr98952.c @@ -0,0 +1,28 @@ +/* { dg-do run { target { powerpc*-*-linux* && ilp32 } } } */ +/* { dg-options "-O2" } */ + +/* PR 96983 reported that the test in libgcc's tramp.S was backwards and it + would abort if the trampoline size passed to the function was greater than + the size the runtime was expecting (40). It should abort if the size is less + than 40, not greater than 40. This test creates a call to __trampoline_setup + with a much larger buffer to make sure the function does not abort. + + We do not run this test on 64-bit since __trampoline_setup is not present in + 64-bit systems. + + We only run the test under Linux in case the other systems have some + different variant for __trampoline_setup. */ + +#ifndef SIZE +#define SIZE 100 +#endif + +extern void __trampoline_setup (int *, unsigned, void *, void *); + +int main (void) +{ + int tramp[SIZE / sizeof (int)]; + + __trampoline_setup (tramp, SIZE, 0, 0); + return 0; +} -- cgit v1.1 From 05ec629f05646837301820b89354a64673185224 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 24 Apr 2021 00:16:37 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2988817..905cd01 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,41 @@ +2021-04-23 Michael Meissner + + PR target/98952 + * gcc.target/powerpc/pr98952.c: New test. + +2021-04-23 UroÅ¡ Bizjak + + PR target/100041 + * gcc.target/i386/pr79514.c (dg-error): + Expect error for 64bit targets. + +2021-04-23 UroÅ¡ Bizjak + + PR target/100182 + * gcc.target/i386/pr100182.c: New test. + * gcc.target/i386/pr71245-1.c (dg-final): Xfail scan-assembler-not. + * gcc.target/i386/pr71245-2.c (dg-final): Ditto. + +2021-04-23 Patrick Palka + + PR c++/98767 + * g++.dg/concepts/diagnostic17.C: New test. + +2021-04-23 Patrick Palka + + DR 2374 + * g++.dg/cpp1z/direct-enum-init2.C: New test. + +2021-04-23 Richard Biener + + PR tree-optimization/99971 + * g++.dg/vect/slp-pr99971.cc: New testcase. + +2021-04-23 liuhongt + + PR target/100093 + * gcc.target/i386/pr100093.c: New test. + 2021-04-22 Patrick Palka PR c++/94508 -- cgit v1.1 From 5f1a2cb9c2dc09eed53da5d5787d14bec700b10b Mon Sep 17 00:00:00 2001 From: Patrick Palka Date: Sat, 24 Apr 2021 00:01:42 -0400 Subject: c++: Hard error with tentative parse and CTAD [PR87709] When parsing e.g. the operand of sizeof, where both types and expressions are accepted, if during the tentative type parse we encounter an unexpected template placeholder, we must simulate an error rather than issue a real error because the expression parse can still succeed. gcc/cp/ChangeLog: PR c++/87709 * parser.c (cp_parser_type_id_1): If we see a template placeholder, first try simulating an error before issuing a real error. gcc/testsuite/ChangeLog: PR c++/87709 * g++.dg/cpp1z/class-deduction86.C: New test. --- gcc/testsuite/g++.dg/cpp1z/class-deduction86.C | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1z/class-deduction86.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction86.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction86.C new file mode 100644 index 0000000..a198ed2 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction86.C @@ -0,0 +1,16 @@ +// PR c++/87709 +// { dg-do compile { target c++17 } } + +template +struct lit { + lit(T) { } +}; + +template +int operator+(lit, lit) { + return 0; +} + +auto r2 = (lit(0)) + lit(0); + +static_assert(sizeof(lit(0))); -- cgit v1.1 From bcd77b7b9f35bd5b559ed593c3b3e346c1e6f364 Mon Sep 17 00:00:00 2001 From: Patrick Palka Date: Sat, 24 Apr 2021 00:14:29 -0400 Subject: c++: do_class_deduction and dependent init [PR93383] Here we're crashing during CTAD with a dependent initializer (performed from convert_template_argument) because one of the initializer's elements has an empty TREE_TYPE, which ends up making resolve_args unhappy. Besides the case where we're initializing one template placeholder from another, which is already specifically handled earlier in do_class_deduction, it seems we can't in general correctly resolve a template placeholder using a dependent initializer, so this patch makes the function just punt until instantiation time instead. gcc/cp/ChangeLog: PR c++/89565 PR c++/93383 PR c++/95291 PR c++/99200 PR c++/99683 * pt.c (do_class_deduction): Punt if the initializer is type-dependent. gcc/testsuite/ChangeLog: PR c++/89565 PR c++/93383 PR c++/95291 PR c++/99200 PR c++/99683 * g++.dg/cpp2a/nontype-class39.C: Remove dg-ice directive. * g++.dg/cpp2a/nontype-class45.C: New test. * g++.dg/cpp2a/nontype-class46.C: New test. * g++.dg/cpp2a/nontype-class47.C: New test. * g++.dg/cpp2a/nontype-class48.C: New test. --- gcc/testsuite/g++.dg/cpp2a/nontype-class39.C | 2 -- gcc/testsuite/g++.dg/cpp2a/nontype-class45.C | 32 +++++++++++++++++++++++++ gcc/testsuite/g++.dg/cpp2a/nontype-class46.C | 11 +++++++++ gcc/testsuite/g++.dg/cpp2a/nontype-class47.C | 11 +++++++++ gcc/testsuite/g++.dg/cpp2a/nontype-class48.C | 36 ++++++++++++++++++++++++++++ 5 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp2a/nontype-class45.C create mode 100644 gcc/testsuite/g++.dg/cpp2a/nontype-class46.C create mode 100644 gcc/testsuite/g++.dg/cpp2a/nontype-class47.C create mode 100644 gcc/testsuite/g++.dg/cpp2a/nontype-class48.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-class39.C b/gcc/testsuite/g++.dg/cpp2a/nontype-class39.C index 512afad..9b4da4f 100644 --- a/gcc/testsuite/g++.dg/cpp2a/nontype-class39.C +++ b/gcc/testsuite/g++.dg/cpp2a/nontype-class39.C @@ -1,7 +1,5 @@ // PR c++/89565 // { dg-do compile { target c++20 } } -// { dg-additional-options "-fchecking" } -// { dg-ice "resolve_args" } template struct N{}; diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-class45.C b/gcc/testsuite/g++.dg/cpp2a/nontype-class45.C new file mode 100644 index 0000000..e7addf5 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/nontype-class45.C @@ -0,0 +1,32 @@ +// PR c++/99200 +// { dg-do compile { target c++20 } } + +template +struct A +{ + constexpr A (const char (&s)[N]) { for (int i = 0; i < N; i++) v[i] = s[i]; v[N] = 0; } + char v[N + 1]; +}; + +template +struct B +{ + constexpr operator const char *() { return s.v; } +}; + +template +const char * +foo () +{ + return B<__PRETTY_FUNCTION__>{}; +} + +template +const char * +bar () +{ + return B<__FUNCTION__>{}; +} + +auto a = foo (); +auto b = bar (); diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-class46.C b/gcc/testsuite/g++.dg/cpp2a/nontype-class46.C new file mode 100644 index 0000000..d91e800 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/nontype-class46.C @@ -0,0 +1,11 @@ +// PR c++/93383 +// { dg-do compile { target c++20 } } + +template struct A {}; + +template struct B { + void foo(B<+a>); + void bar(B); + template using type = B; + template static inline auto y = A{0}; // { dg-error "deduction|no match" } +}; diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-class47.C b/gcc/testsuite/g++.dg/cpp2a/nontype-class47.C new file mode 100644 index 0000000..1f31b9b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/nontype-class47.C @@ -0,0 +1,11 @@ +// PR c++/95291 +// { dg-do compile { target c++20 } } + +template +class xy { }; + +template +struct window_root { }; + +template +struct flip_horizontally : window_root { }; diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-class48.C b/gcc/testsuite/g++.dg/cpp2a/nontype-class48.C new file mode 100644 index 0000000..9024436 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/nontype-class48.C @@ -0,0 +1,36 @@ +// PR c++/99683 +// { dg-do compile { target c++20 } } + +template +struct nttp_tag {}; + +template +struct type_tag {}; + + +/************************************************/ +template +struct use_ctad +{ + template requires (!is_type) + constexpr use_ctad(nttp_tag) {} +}; + +template +use_ctad(nttp_tag) -> use_ctad; + +/**********************************************/ +template +struct wrapper +{ + template + wrapper(Tag); +}; + +template +wrapper(Tag) -> wrapper; + +int main() +{ + wrapper t{nttp_tag<42>{}}; +} -- cgit v1.1 From 0d923657c2fefac8aeb8eb317fe5c7e7c55880c9 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Sat, 24 Apr 2021 09:35:16 +0100 Subject: Add dg-final option-based target selectors This patch adds target selectors of the form: { any-opts "opt1" ... "optn" } { no-opts "opt1" ... "optn" } for skipping or xfailing tests based on compiler options. It only works for dg-final selectors. The patch then uses no-opts to exclude -O0 and (sometimes) -Og from some guality.exp xfails. AFAICT (based on gcc-testresults) these tests pass for those options for all targets. gcc/ * doc/sourcebuild.texi: Document no-opts and any-opts target selectors. gcc/testsuite/ * lib/target-supports-dg.exp (selector_expression): Handle any-opts and no-opts. * gcc.dg/guality/pr41353-1.c: Exclude -O0 from xfail. * gcc.dg/guality/pr59776.c: Likewise. * gcc.dg/guality/pr54970.c: Likewise -O0 and -Og. --- gcc/testsuite/gcc.dg/guality/pr41353-1.c | 2 +- gcc/testsuite/gcc.dg/guality/pr54970.c | 16 ++++++++-------- gcc/testsuite/gcc.dg/guality/pr59776.c | 4 ++-- gcc/testsuite/lib/target-supports-dg.exp | 10 +++++++++- 4 files changed, 20 insertions(+), 12 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/guality/pr41353-1.c b/gcc/testsuite/gcc.dg/guality/pr41353-1.c index cd30632..6639a52 100644 --- a/gcc/testsuite/gcc.dg/guality/pr41353-1.c +++ b/gcc/testsuite/gcc.dg/guality/pr41353-1.c @@ -22,7 +22,7 @@ f2 (int i, int j) { j += i; /* { dg-final { gdb-test .+4 "i" "37" } } */ - /* { dg-final { gdb-test .+3 "j" "28 + 37" { xfail *-*-* } } } */ + /* { dg-final { gdb-test .+3 "j" "28 + 37" { xfail { no-opts "-O0" } } } } */ int i1 = 2 * i; /* { dg-final { gdb-test .+2 "i1" "2 * 37" } } */ int i2 = 3 * i; /* { dg-final { gdb-test .+1 "i2" "3 * 37" } } */ return j; diff --git a/gcc/testsuite/gcc.dg/guality/pr54970.c b/gcc/testsuite/gcc.dg/guality/pr54970.c index 2e0bc57..e60cc04 100644 --- a/gcc/testsuite/gcc.dg/guality/pr54970.c +++ b/gcc/testsuite/gcc.dg/guality/pr54970.c @@ -8,39 +8,39 @@ int main () { - int a[] = { 1, 2, 3 }; /* { dg-final { gdb-test .+4 "a\[0\]" "1" { xfail { *-*-* } } } } */ + int a[] = { 1, 2, 3 }; /* { dg-final { gdb-test .+4 "a\[0\]" "1" { xfail { no-opts "-O0" "-Og" } } } } */ int *p = a + 2; /* { dg-final { gdb-test .+3 "a\[1\]" "2" } } */ int *q = a + 1; /* { dg-final { gdb-test .+2 "a\[2\]" "3" } } */ /* { dg-final { gdb-test .+1 "*p" "3" } } */ asm volatile (NOP); /* { dg-final { gdb-test . "*q" "2" } } */ - *p += 10; /* { dg-final { gdb-test .+4 "a\[0\]" "1" { xfail { *-*-* } } } } */ + *p += 10; /* { dg-final { gdb-test .+4 "a\[0\]" "1" { xfail { no-opts "-O0" "-Og" } } } } */ /* { dg-final { gdb-test .+3 "a\[1\]" "2" } } */ /* { dg-final { gdb-test .+2 "a\[2\]" "13" } } */ /* { dg-final { gdb-test .+1 "*p" "13" } } */ asm volatile (NOP); /* { dg-final { gdb-test . "*q" "2" } } */ - *q += 10; /* { dg-final { gdb-test .+4 "a\[0\]" "1" { xfail { *-*-* } } } } */ + *q += 10; /* { dg-final { gdb-test .+4 "a\[0\]" "1" { xfail { no-opts "-O0" "-Og" } } } } */ /* { dg-final { gdb-test .+3 "a\[1\]" "12" } } */ /* { dg-final { gdb-test .+2 "a\[2\]" "13" } } */ /* { dg-final { gdb-test .+1 "*p" "13" } } */ asm volatile (NOP); /* { dg-final { gdb-test . "*q" "12" } } */ __builtin_memcpy (&a, (int [3]) { 4, 5, 6 }, sizeof (a)); - /* { dg-final { gdb-test .+4 "a\[0\]" "4" { xfail { *-*-* } } } } */ + /* { dg-final { gdb-test .+4 "a\[0\]" "4" { xfail { no-opts "-O0" "-Og" } } } } */ /* { dg-final { gdb-test .+3 "a\[1\]" "5" } } */ /* { dg-final { gdb-test .+2 "a\[2\]" "6" } } */ /* { dg-final { gdb-test .+1 "*p" "6" } } */ asm volatile (NOP); /* { dg-final { gdb-test . "*q" "5" } } */ - *p += 20; /* { dg-final { gdb-test .+4 "a\[0\]" "4" { xfail { *-*-* } } } } */ + *p += 20; /* { dg-final { gdb-test .+4 "a\[0\]" "4" { xfail { no-opts "-O0" "-Og" } } } } */ /* { dg-final { gdb-test .+3 "a\[1\]" "5" } } */ /* { dg-final { gdb-test .+2 "a\[2\]" "26" } } */ /* { dg-final { gdb-test .+1 "*p" "26" } } */ asm volatile (NOP); /* { dg-final { gdb-test . "*q" "5" } } */ - *q += 20; /* { dg-final { gdb-test .+8 "a\[0\]" "4" { xfail { *-*-* } } } } */ + *q += 20; /* { dg-final { gdb-test .+8 "a\[0\]" "4" { xfail { no-opts "-O0" "-Og" } } } } */ /* { dg-final { gdb-test .+7 "a\[1\]" "25" } } */ /* { dg-final { gdb-test .+6 "a\[2\]" "26" } } */ /* { dg-final { gdb-test .+5 "*p" "26" } } */ /* { dg-final { gdb-test .+4 "p\[-1\]" "25" } } */ - /* { dg-final { gdb-test .+3 "p\[-2\]" "4" { xfail { *-*-* } } } } */ - /* { dg-final { gdb-test .+2 "q\[-1\]" "4" { xfail { *-*-* } } } } */ + /* { dg-final { gdb-test .+3 "p\[-2\]" "4" { xfail { no-opts "-O0" "-Og" } } } } */ + /* { dg-final { gdb-test .+2 "q\[-1\]" "4" { xfail { no-opts "-O0" "-Og" } } } } */ /* { dg-final { gdb-test .+1 "q\[1\]" "26" } } */ asm volatile (NOP); /* { dg-final { gdb-test . "*q" "25" } } */ return 0; diff --git a/gcc/testsuite/gcc.dg/guality/pr59776.c b/gcc/testsuite/gcc.dg/guality/pr59776.c index 7c95a9f..9777f62 100644 --- a/gcc/testsuite/gcc.dg/guality/pr59776.c +++ b/gcc/testsuite/gcc.dg/guality/pr59776.c @@ -12,11 +12,11 @@ foo (struct S *p) struct S s1, s2; /* { dg-final { gdb-test pr59776.c:17 "s1.f" "5.0" } } */ s1 = *p; /* { dg-final { gdb-test pr59776.c:17 "s1.g" "6.0" } } */ s2 = s1; /* { dg-final { gdb-test pr59776.c:17 "s2.f" "0.0" } } */ - *(int *) &s2.f = 0; /* { dg-final { gdb-test pr59776.c:17 "s2.g" "6.0" { xfail *-*-* } } } */ + *(int *) &s2.f = 0; /* { dg-final { gdb-test pr59776.c:17 "s2.g" "6.0" { xfail { no-opts "-O0" } } } } */ asm volatile (NOP : : : "memory"); /* { dg-final { gdb-test pr59776.c:20 "s1.f" "5.0" } } */ asm volatile (NOP : : : "memory"); /* { dg-final { gdb-test pr59776.c:20 "s1.g" "6.0" } } */ s2 = s1; /* { dg-final { gdb-test pr59776.c:20 "s2.f" "5.0" } } */ - asm volatile (NOP : : : "memory"); /* { dg-final { gdb-test pr59776.c:20 "s2.g" "6.0" { xfail *-*-* } } } */ + asm volatile (NOP : : : "memory"); /* { dg-final { gdb-test pr59776.c:20 "s2.g" "6.0" { xfail { no-opts "-O0" } } } } */ asm volatile (NOP : : : "memory"); } diff --git a/gcc/testsuite/lib/target-supports-dg.exp b/gcc/testsuite/lib/target-supports-dg.exp index c014abc..94ba79e 100644 --- a/gcc/testsuite/lib/target-supports-dg.exp +++ b/gcc/testsuite/lib/target-supports-dg.exp @@ -570,7 +570,15 @@ if { [info procs saved-dg-process-target] == [list] } { # Evaluate a selector expression. proc selector_expression { exp } { - if { [llength $exp] == 2 } { + if { [llength $exp] >= 2 + && [string match "any-opts" [lindex $exp 0]] } { + set args [list "" { *-*-* } [lrange $exp 1 end] ""] + set answer [check_conditional_xfail $args] + } elseif { [llength $exp] >= 2 + && [string match "no-opts" [lindex $exp 0]] } { + set args [list "" { *-*-* } "*" [lrange $exp 1 end]] + set answer [check_conditional_xfail $args] + } elseif { [llength $exp] == 2 } { if [string match "!" [lindex $exp 0]] { set op1 [lindex $exp 1] set answer [expr { ! [selector_opd $op1] }] -- cgit v1.1 From f31ddad8ac8f11b8b11ab0c39f2e0740fd40ba8e Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Sat, 24 Apr 2021 09:35:16 +0100 Subject: Adjust guality xfails for aarch64*-*-* MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch gives clean guality.exp test results for aarch64-linux-gnu with modern (top-of-tree) gdb. For people using older gdbs, it will trade one set of noisy results for another set. I still think it's better to have the xfails based on one “clean†and “modern†run rather than have FAILs and XPASSes for all runs. It's hard to tell which of these results are aarch64-specific and which aren't. If other target maintainers want to do something similar, and are prepared to assume the same gdb version, then it should become clearer over time which ones are target-specific and which aren't. There are no new skips here, so changes in test results will still show up as XPASSes. I've not analysed the failures or filed PRs for them. In some ways the guality directory itself seems like the best place to start looking for xfails, if someone's interested in working in this area. gcc/testsuite/ * gcc.dg/guality/example.c: Update aarch64*-*-* xfails. * gcc.dg/guality/guality.c: Likewise. * gcc.dg/guality/inline-params.c: Likewise. * gcc.dg/guality/loop-1.c: Likewise. * gcc.dg/guality/pr36728-1.c: Likewise. * gcc.dg/guality/pr36728-2.c: Likewise. * gcc.dg/guality/pr36728-3.c: Likewise. * gcc.dg/guality/pr41447-1.c: Likewise. * gcc.dg/guality/pr54200.c: Likewise. * gcc.dg/guality/pr54519-1.c: Likewise. * gcc.dg/guality/pr54519-2.c: Likewise. * gcc.dg/guality/pr54519-3.c: Likewise. * gcc.dg/guality/pr54519-4.c: Likewise. * gcc.dg/guality/pr54519-5.c: Likewise. * gcc.dg/guality/pr54519-6.c: Likewise. * gcc.dg/guality/pr54693-2.c: Likewise. * gcc.dg/guality/pr56154-1.c: Likewise. * gcc.dg/guality/pr59776.c: Likewise. * gcc.dg/guality/pr68860-1.c: Likewise. * gcc.dg/guality/pr68860-2.c: Likewise. * gcc.dg/guality/pr90074.c: Likewise. * gcc.dg/guality/pr90716.c: Likewise. * gcc.dg/guality/sra-1.c: Likewise. --- gcc/testsuite/gcc.dg/guality/example.c | 3 ++- gcc/testsuite/gcc.dg/guality/guality.c | 2 +- gcc/testsuite/gcc.dg/guality/inline-params.c | 2 +- gcc/testsuite/gcc.dg/guality/loop-1.c | 2 +- gcc/testsuite/gcc.dg/guality/pr36728-1.c | 2 +- gcc/testsuite/gcc.dg/guality/pr36728-2.c | 30 ++++++++++++++-------------- gcc/testsuite/gcc.dg/guality/pr36728-3.c | 2 +- gcc/testsuite/gcc.dg/guality/pr41447-1.c | 1 + gcc/testsuite/gcc.dg/guality/pr54200.c | 2 +- gcc/testsuite/gcc.dg/guality/pr54519-1.c | 8 ++++---- gcc/testsuite/gcc.dg/guality/pr54519-2.c | 2 +- gcc/testsuite/gcc.dg/guality/pr54519-3.c | 8 ++++---- gcc/testsuite/gcc.dg/guality/pr54519-4.c | 2 +- gcc/testsuite/gcc.dg/guality/pr54519-5.c | 2 +- gcc/testsuite/gcc.dg/guality/pr54519-6.c | 2 +- gcc/testsuite/gcc.dg/guality/pr54693-2.c | 2 +- gcc/testsuite/gcc.dg/guality/pr56154-1.c | 2 +- gcc/testsuite/gcc.dg/guality/pr59776.c | 12 +++++------ gcc/testsuite/gcc.dg/guality/pr68860-1.c | 2 +- gcc/testsuite/gcc.dg/guality/pr68860-2.c | 2 +- gcc/testsuite/gcc.dg/guality/pr90074.c | 4 ++-- gcc/testsuite/gcc.dg/guality/pr90716.c | 2 +- gcc/testsuite/gcc.dg/guality/sra-1.c | 8 ++++---- 23 files changed, 53 insertions(+), 51 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/guality/example.c b/gcc/testsuite/gcc.dg/guality/example.c index 26d25c2..6f1c017 100644 --- a/gcc/testsuite/gcc.dg/guality/example.c +++ b/gcc/testsuite/gcc.dg/guality/example.c @@ -1,5 +1,6 @@ -/* { dg-do run { xfail *-*-* } } */ +/* { dg-do run { xfail { ! aarch64*-*-* } } } */ /* { dg-options "-g" } */ +/* { dg-xfail-run-if "" aarch64*-*-* "*" { "-O[01g]" } } */ #define GUALITY_DONT_FORCE_LIVE_AFTER -1 diff --git a/gcc/testsuite/gcc.dg/guality/guality.c b/gcc/testsuite/gcc.dg/guality/guality.c index db015e6..a4de564 100644 --- a/gcc/testsuite/gcc.dg/guality/guality.c +++ b/gcc/testsuite/gcc.dg/guality/guality.c @@ -1,4 +1,4 @@ -/* { dg-do run { xfail *-*-* } } */ +/* { dg-do run { xfail { ! aarch64*-*-* } } } */ /* { dg-options "-g" } */ /* { dg-require-effective-target alloca } */ diff --git a/gcc/testsuite/gcc.dg/guality/inline-params.c b/gcc/testsuite/gcc.dg/guality/inline-params.c index f4c5f15..6be240a 100644 --- a/gcc/testsuite/gcc.dg/guality/inline-params.c +++ b/gcc/testsuite/gcc.dg/guality/inline-params.c @@ -3,7 +3,7 @@ inlining inlines the functions too early to test the real IPA passes (such as IPA-CP). */ /* { dg-options "-g -fno-early-inlining -fno-ipa-sra" } */ -/* { dg-xfail-run-if "" { "*-*-*" } { "-O2" "-O3" "-Os" } } */ +/* { dg-xfail-run-if "" { ! aarch64*-*-* } { "-O2" "-O3" "-Os" } } */ #define GUALITY_DONT_FORCE_LIVE_AFTER -1 diff --git a/gcc/testsuite/gcc.dg/guality/loop-1.c b/gcc/testsuite/gcc.dg/guality/loop-1.c index 8da447d..1b1f6d3 100644 --- a/gcc/testsuite/gcc.dg/guality/loop-1.c +++ b/gcc/testsuite/gcc.dg/guality/loop-1.c @@ -17,6 +17,6 @@ foo (int n) /* The following works only with final value replacement or with the NOP but not without (which means -Og). Vectorization breaks it, so disable that. At -O3 it currently fails, PR89983. */ - __asm__ volatile (NOP : : "g" (i) : "memory"); /* { dg-final { gdb-test . "i" "1" } } */ + __asm__ volatile (NOP : : "g" (i) : "memory"); /* { dg-final { gdb-test . "i" "1" { xfail { aarch64*-*-* && { any-opts "-ftracer" } } } } } */ } int main() { foo(1); } diff --git a/gcc/testsuite/gcc.dg/guality/pr36728-1.c b/gcc/testsuite/gcc.dg/guality/pr36728-1.c index 0ab475a..5864c2a 100644 --- a/gcc/testsuite/gcc.dg/guality/pr36728-1.c +++ b/gcc/testsuite/gcc.dg/guality/pr36728-1.c @@ -32,7 +32,7 @@ foo (int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7) /* { dg-final { gdb-test 16 "arg5" "5" } } */ /* { dg-final { gdb-test 16 "arg6" "6" } } */ /* { dg-final { gdb-test 16 "arg7" "30" } } */ -/* { dg-final { gdb-test 16 "y" "2" } } */ +/* { dg-final { gdb-test 16 "y" "2" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" } } } } } */ /* { dg-final { gdb-test 18 "arg1" "1" { target { ! "s390*-*-*" } } } } */ /* { dg-final { gdb-test 18 "arg2" "2" { target { ! "s390*-*-*" } } } } */ /* { dg-final { gdb-test 18 "arg3" "3" } } */ diff --git a/gcc/testsuite/gcc.dg/guality/pr36728-2.c b/gcc/testsuite/gcc.dg/guality/pr36728-2.c index 7ba8663..6e8d775 100644 --- a/gcc/testsuite/gcc.dg/guality/pr36728-2.c +++ b/gcc/testsuite/gcc.dg/guality/pr36728-2.c @@ -25,21 +25,21 @@ foo (int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7) and arg2. So it is expected that these values are unavailable in some of these tests. */ -/* { dg-final { gdb-test 16 "arg1" "1" { target { ! "s390*-*-*" } } } } */ -/* { dg-final { gdb-test 16 "arg2" "2" { target { ! "s390*-*-*" } } } } */ -/* { dg-final { gdb-test 16 "arg3" "3" } } */ -/* { dg-final { gdb-test 16 "arg4" "4" } } */ -/* { dg-final { gdb-test 16 "arg5" "5" } } */ -/* { dg-final { gdb-test 16 "arg6" "6" } } */ -/* { dg-final { gdb-test 16 "arg7" "30" } } */ -/* { dg-final { gdb-test 16 "y" "2" } } */ -/* { dg-final { gdb-test 18 "arg1" "1" { target { ! "s390*-*-*" } } } } */ -/* { dg-final { gdb-test 18 "arg2" "2" { target { ! "s390*-*-*" } } } } */ -/* { dg-final { gdb-test 18 "arg3" "3" } } */ -/* { dg-final { gdb-test 18 "arg4" "4" } } */ -/* { dg-final { gdb-test 18 "arg5" "5" } } */ -/* { dg-final { gdb-test 18 "arg6" "6" } } */ -/* { dg-final { gdb-test 18 "arg7" "30" } } */ +/* { dg-final { gdb-test 16 "arg1" "1" { target { ! "s390*-*-*" } xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-O3" } } } } } */ +/* { dg-final { gdb-test 16 "arg2" "2" { target { ! "s390*-*-*" } xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-O3" } } } } } */ +/* { dg-final { gdb-test 16 "arg3" "3" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-O3" } } } } } */ +/* { dg-final { gdb-test 16 "arg4" "4" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-O3" } } } } } */ +/* { dg-final { gdb-test 16 "arg5" "5" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-O3" } } } } } */ +/* { dg-final { gdb-test 16 "arg6" "6" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-O3" } } } } } */ +/* { dg-final { gdb-test 16 "arg7" "30" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-O3" } } } } } */ +/* { dg-final { gdb-test 16 "y" "2" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" } } } } } */ +/* { dg-final { gdb-test 18 "arg1" "1" { target { ! "s390*-*-*" } xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-O3" } } } } } */ +/* { dg-final { gdb-test 18 "arg2" "2" { target { ! "s390*-*-*" } xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-O3" } } } } } */ +/* { dg-final { gdb-test 18 "arg3" "3" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-O3" } } } } } */ +/* { dg-final { gdb-test 18 "arg4" "4" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-O3" } } } } } */ +/* { dg-final { gdb-test 18 "arg5" "5" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-O3" } } } } } */ +/* { dg-final { gdb-test 18 "arg6" "6" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-O3" } } } } } */ +/* { dg-final { gdb-test 18 "arg7" "30" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-O3" } } } } } */ /* { dg-final { gdb-test 18 "*x" "(char) 25" } } */ /* { dg-final { gdb-test 18 "y" "2" } } */ diff --git a/gcc/testsuite/gcc.dg/guality/pr36728-3.c b/gcc/testsuite/gcc.dg/guality/pr36728-3.c index 4700d50..589009b 100644 --- a/gcc/testsuite/gcc.dg/guality/pr36728-3.c +++ b/gcc/testsuite/gcc.dg/guality/pr36728-3.c @@ -30,7 +30,7 @@ foo (int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7) /* { dg-final { gdb-test 14 "arg5" "5" } } */ /* { dg-final { gdb-test 14 "arg6" "6" } } */ /* { dg-final { gdb-test 14 "arg7" "30" } } */ -/* { dg-final { gdb-test 14 "y" "2" } } */ +/* { dg-final { gdb-test 14 "y" "2" { xfail { aarch64*-*-* && { any-opts "-O3" } } } } } */ /* { dg-final { gdb-test 16 "arg1" "1" { target { ! "s390*-*-*" } } } } */ /* { dg-final { gdb-test 16 "arg2" "2" { target { ! "s390*-*-*" } } } } */ /* { dg-final { gdb-test 16 "arg3" "3" } } */ diff --git a/gcc/testsuite/gcc.dg/guality/pr41447-1.c b/gcc/testsuite/gcc.dg/guality/pr41447-1.c index 308ef94..9fde33e 100644 --- a/gcc/testsuite/gcc.dg/guality/pr41447-1.c +++ b/gcc/testsuite/gcc.dg/guality/pr41447-1.c @@ -1,5 +1,6 @@ /* { dg-do run } */ /* { dg-options "-g" } */ +/* { dg-xfail-run-if "" { aarch64*-*-* } { "-O2" "-O3" "-Os" } { "-fno-fat-lto-objects" } } */ #include "guality.h" diff --git a/gcc/testsuite/gcc.dg/guality/pr54200.c b/gcc/testsuite/gcc.dg/guality/pr54200.c index e873d1b..ba14221 100644 --- a/gcc/testsuite/gcc.dg/guality/pr54200.c +++ b/gcc/testsuite/gcc.dg/guality/pr54200.c @@ -17,7 +17,7 @@ foo (int z, int x, int b) else { int a = (x + z) + b; - return a; /* { dg-final { gdb-test . "z" "3" } } */ + return a; /* { dg-final { gdb-test . "z" "3" { xfail { aarch64*-*-* && { no-opts "-O0" "-Og" } } } } } */ } } diff --git a/gcc/testsuite/gcc.dg/guality/pr54519-1.c b/gcc/testsuite/gcc.dg/guality/pr54519-1.c index a4105ab..81703eb 100644 --- a/gcc/testsuite/gcc.dg/guality/pr54519-1.c +++ b/gcc/testsuite/gcc.dg/guality/pr54519-1.c @@ -16,11 +16,11 @@ fn2 (int x, int y, int z) { fn1 (x); fn1 (x); /* { dg-final { gdb-test .+2 "x" "36" } } */ - if (x == 36) /* { dg-final { gdb-test .+1 "y" "25" } } */ - fn1 (x); /* { dg-final { gdb-test . "z" "6" } } */ + if (x == 36) /* { dg-final { gdb-test .+1 "y" "25" { xfail { aarch64*-*-* && { any-opts "-flto" } } } } } */ + fn1 (x); /* { dg-final { gdb-test . "z" "6" { xfail { aarch64*-*-* && { any-opts "-flto" } } } } } */ fn1 (x); /* { dg-final { gdb-test .+2 "x" "98" } } */ - if (x == 98) /* { dg-final { gdb-test .+1 "y" "117" } } */ - fn1 (x); /* { dg-final { gdb-test . "z" "8" } } */ + if (x == 98) /* { dg-final { gdb-test .+1 "y" "117" { xfail { aarch64*-*-* && { any-opts "-flto" } } } } } */ + fn1 (x); /* { dg-final { gdb-test . "z" "8" { xfail { aarch64*-*-* && { any-opts "-flto" } } } } } */ fn1 (x); fn1 (x + a); } diff --git a/gcc/testsuite/gcc.dg/guality/pr54519-2.c b/gcc/testsuite/gcc.dg/guality/pr54519-2.c index 6bc1683..e1368bf 100644 --- a/gcc/testsuite/gcc.dg/guality/pr54519-2.c +++ b/gcc/testsuite/gcc.dg/guality/pr54519-2.c @@ -14,7 +14,7 @@ fn2 (int x, int y) if (y) { fn1 (x); /* { dg-final { gdb-test .+1 "x" "6" } } */ - fn1 (x); /* { dg-final { gdb-test . "y" "25" } } */ + fn1 (x); /* { dg-final { gdb-test . "y" "25" { xfail { aarch64*-*-* && { any-opts "-flto" } } } } } */ fn1 (x); fn1 (x); y = -2 + x; diff --git a/gcc/testsuite/gcc.dg/guality/pr54519-3.c b/gcc/testsuite/gcc.dg/guality/pr54519-3.c index da18247..fabab96 100644 --- a/gcc/testsuite/gcc.dg/guality/pr54519-3.c +++ b/gcc/testsuite/gcc.dg/guality/pr54519-3.c @@ -16,11 +16,11 @@ fn2 (int x, int y, int z) { fn1 (x); fn1 (x); /* { dg-final { gdb-test .+2 "x" "36" } } */ - if (x == 36) /* { dg-final { gdb-test .+1 "y" "25" } } */ - fn1 (x); /* { dg-final { gdb-test . "z" "6" } } */ + if (x == 36) /* { dg-final { gdb-test .+1 "y" "25" { xfail { aarch64*-*-* && { any-opts "-flto" } } } } } */ + fn1 (x); /* { dg-final { gdb-test . "z" "6" { xfail { aarch64*-*-* && { any-opts "-flto" } } } } } */ fn1 (x); /* { dg-final { gdb-test .+2 "x" "98" } } */ - if (x == 98) /* { dg-final { gdb-test .+1 "y" "117" } } */ - fn1 (x); /* { dg-final { gdb-test . "z" "8" } } */ + if (x == 98) /* { dg-final { gdb-test .+1 "y" "117" { xfail { aarch64*-*-* && { any-opts "-flto" } } } } } */ + fn1 (x); /* { dg-final { gdb-test . "z" "8" { xfail { aarch64*-*-* && { any-opts "-flto" } } } } } */ fn1 (x); fn1 (x + a); } diff --git a/gcc/testsuite/gcc.dg/guality/pr54519-4.c b/gcc/testsuite/gcc.dg/guality/pr54519-4.c index c82de58..fd8465f 100644 --- a/gcc/testsuite/gcc.dg/guality/pr54519-4.c +++ b/gcc/testsuite/gcc.dg/guality/pr54519-4.c @@ -14,7 +14,7 @@ fn2 (int x, int y) if (y) { fn1 (x); /* { dg-final { gdb-test .+1 "x" "6" } } */ - fn1 (x); /* { dg-final { gdb-test . "y" "25" } } */ + fn1 (x); /* { dg-final { gdb-test . "y" "25" { xfail { aarch64*-*-* && { any-opts "-flto" } } } } } */ fn1 (x); fn1 (x); y = -2 + x; diff --git a/gcc/testsuite/gcc.dg/guality/pr54519-5.c b/gcc/testsuite/gcc.dg/guality/pr54519-5.c index 0903fbf..76fa1e3 100644 --- a/gcc/testsuite/gcc.dg/guality/pr54519-5.c +++ b/gcc/testsuite/gcc.dg/guality/pr54519-5.c @@ -14,7 +14,7 @@ fn2 (int x, int y) if (y) { fn1 (x); /* { dg-final { gdb-test .+1 "x" "6" } } */ - fn1 (x); /* { dg-final { gdb-test . "y" "25" } } */ + fn1 (x); /* { dg-final { gdb-test . "y" "25" { xfail { aarch64*-*-* && { any-opts "-flto" } } } } } */ fn1 (x); fn1 (x); y = -2 + x; diff --git a/gcc/testsuite/gcc.dg/guality/pr54519-6.c b/gcc/testsuite/gcc.dg/guality/pr54519-6.c index bb3fb5f..732c268 100644 --- a/gcc/testsuite/gcc.dg/guality/pr54519-6.c +++ b/gcc/testsuite/gcc.dg/guality/pr54519-6.c @@ -7,7 +7,7 @@ static inline void f1 (int x, int y) { - asm volatile (NOP); /* { dg-final { gdb-test .+1 "x" "2" } } */ + asm volatile (NOP); /* { dg-final { gdb-test .+1 "x" "2" { xfail { aarch64*-*-* && { any-opts "-Os" } } } } } */ asm volatile (NOP); /* { dg-final { gdb-test . "y" "0" } } */ } diff --git a/gcc/testsuite/gcc.dg/guality/pr54693-2.c b/gcc/testsuite/gcc.dg/guality/pr54693-2.c index 1741a38..68aa6c6 100644 --- a/gcc/testsuite/gcc.dg/guality/pr54693-2.c +++ b/gcc/testsuite/gcc.dg/guality/pr54693-2.c @@ -19,7 +19,7 @@ foo (int x, int y, int z) { /* { dg-final { gdb-test .+2 "i" "v + 1" } } */ /* { dg-final { gdb-test .+1 "x" "10 - i" } } */ bar (i); /* { dg-final { gdb-test . "y" "20 - 2 * i" } } */ - /* { dg-final { gdb-test .-1 "z" "30 - 3 * i" } } */ + /* { dg-final { gdb-test .-1 "z" "30 - 3 * i" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-Os" } } } } } */ i++, x--, y -= 2, z -= 3; } } diff --git a/gcc/testsuite/gcc.dg/guality/pr56154-1.c b/gcc/testsuite/gcc.dg/guality/pr56154-1.c index 4f02bc9..d6da4a7 100644 --- a/gcc/testsuite/gcc.dg/guality/pr56154-1.c +++ b/gcc/testsuite/gcc.dg/guality/pr56154-1.c @@ -17,7 +17,7 @@ foo (int fd, union U x) asm (NOP : : : "memory"); /* { dg-final { gdb-test pr56154-1.c:17 "x.a" "4" } } */ z = x.a; x.a = 6; - asm (NOP : : : "memory"); /* { dg-final { gdb-test pr56154-1.c:20 "x.a" "6" } } */ + asm (NOP : : : "memory"); /* { dg-final { gdb-test pr56154-1.c:20 "x.a" "6" { xfail { aarch64*-*-* && { any-opts "-Og" } } } } } */ return result; } diff --git a/gcc/testsuite/gcc.dg/guality/pr59776.c b/gcc/testsuite/gcc.dg/guality/pr59776.c index 9777f62..0e48559 100644 --- a/gcc/testsuite/gcc.dg/guality/pr59776.c +++ b/gcc/testsuite/gcc.dg/guality/pr59776.c @@ -9,13 +9,13 @@ struct S { float f, g; }; __attribute__((noipa)) void foo (struct S *p) { - struct S s1, s2; /* { dg-final { gdb-test pr59776.c:17 "s1.f" "5.0" } } */ - s1 = *p; /* { dg-final { gdb-test pr59776.c:17 "s1.g" "6.0" } } */ - s2 = s1; /* { dg-final { gdb-test pr59776.c:17 "s2.f" "0.0" } } */ + struct S s1, s2; /* { dg-final { gdb-test pr59776.c:17 "s1.f" "5.0" { xfail { aarch64*-*-* && { any-opts "-Og" } } } } } */ + s1 = *p; /* { dg-final { gdb-test pr59776.c:17 "s1.g" "6.0" { xfail { aarch64*-*-* && { any-opts "-Og" } } } } } */ + s2 = s1; /* { dg-final { gdb-test pr59776.c:17 "s2.f" "0.0" { xfail { aarch64*-*-* && { any-opts "-Og" } } } } } */ *(int *) &s2.f = 0; /* { dg-final { gdb-test pr59776.c:17 "s2.g" "6.0" { xfail { no-opts "-O0" } } } } */ - asm volatile (NOP : : : "memory"); /* { dg-final { gdb-test pr59776.c:20 "s1.f" "5.0" } } */ - asm volatile (NOP : : : "memory"); /* { dg-final { gdb-test pr59776.c:20 "s1.g" "6.0" } } */ - s2 = s1; /* { dg-final { gdb-test pr59776.c:20 "s2.f" "5.0" } } */ + asm volatile (NOP : : : "memory"); /* { dg-final { gdb-test pr59776.c:20 "s1.f" "5.0" { xfail { aarch64*-*-* && { any-opts "-Og" } } } } } */ + asm volatile (NOP : : : "memory"); /* { dg-final { gdb-test pr59776.c:20 "s1.g" "6.0" { xfail { aarch64*-*-* && { any-opts "-Og" } } } } } */ + s2 = s1; /* { dg-final { gdb-test pr59776.c:20 "s2.f" "5.0" { xfail { aarch64*-*-* && { any-opts "-Og" } } } } } */ asm volatile (NOP : : : "memory"); /* { dg-final { gdb-test pr59776.c:20 "s2.g" "6.0" { xfail { no-opts "-O0" } } } } */ asm volatile (NOP : : : "memory"); } diff --git a/gcc/testsuite/gcc.dg/guality/pr68860-1.c b/gcc/testsuite/gcc.dg/guality/pr68860-1.c index 8c8d835..bbd9d6e 100644 --- a/gcc/testsuite/gcc.dg/guality/pr68860-1.c +++ b/gcc/testsuite/gcc.dg/guality/pr68860-1.c @@ -31,7 +31,7 @@ foo (int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int a /* { dg-final { gdb-test 14 "arg6" "6" } } */ /* { dg-final { gdb-test 14 "arg7" "30" } } */ /* { dg-final { gdb-test 14 "arg8" "7" } } */ -/* { dg-final { gdb-test 14 "y" "2" } } */ +/* { dg-final { gdb-test 14 "y" "2" { xfail { aarch64*-*-* && { { any-opts "-O2" "-O3" } && { no-opts "-flto" } } } } } } */ /* { dg-final { gdb-test 16 "arg1" "1" { target { ! "s390*-*-*" } } } } */ /* { dg-final { gdb-test 16 "arg2" "2" { target { ! "s390*-*-*" } } } } */ /* { dg-final { gdb-test 16 "arg3" "3" } } */ diff --git a/gcc/testsuite/gcc.dg/guality/pr68860-2.c b/gcc/testsuite/gcc.dg/guality/pr68860-2.c index 070efbc..a18a04e 100644 --- a/gcc/testsuite/gcc.dg/guality/pr68860-2.c +++ b/gcc/testsuite/gcc.dg/guality/pr68860-2.c @@ -31,7 +31,7 @@ foo (int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int a /* { dg-final { gdb-test 14 "arg6" "6" } } */ /* { dg-final { gdb-test 14 "arg7" "30" } } */ /* { dg-final { gdb-test 14 "arg8" "7" } } */ -/* { dg-final { gdb-test 14 "y" "2" } } */ +/* { dg-final { gdb-test 14 "y" "2" { xfail { aarch64*-*-* && { any-opts "-O3" } } } } } */ /* { dg-final { gdb-test 16 "arg1" "1" { target { ! "s390*-*-*" } } } } */ /* { dg-final { gdb-test 16 "arg2" "2" { target { ! "s390*-*-*" } } } } */ /* { dg-final { gdb-test 16 "arg3" "3" } } */ diff --git a/gcc/testsuite/gcc.dg/guality/pr90074.c b/gcc/testsuite/gcc.dg/guality/pr90074.c index 1294928..2fd8842 100644 --- a/gcc/testsuite/gcc.dg/guality/pr90074.c +++ b/gcc/testsuite/gcc.dg/guality/pr90074.c @@ -25,7 +25,7 @@ int main() debug stmt for the final value of the loop during loop distribution which would fix the UNSUPPORTED cases. c is optimized out at -Og for no obvious reason. */ - optimize_me_not(); /* { dg-final { gdb-test . "i + 1" "8" } } */ - /* { dg-final { gdb-test .-1 "c + 1" "2" } } */ + optimize_me_not(); /* { dg-final { gdb-test . "i + 1" "8" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" } } } } } */ + /* { dg-final { gdb-test .-1 "c + 1" "2" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" } } } } } */ return 0; } diff --git a/gcc/testsuite/gcc.dg/guality/pr90716.c b/gcc/testsuite/gcc.dg/guality/pr90716.c index b2f5c9d..fe7e556 100644 --- a/gcc/testsuite/gcc.dg/guality/pr90716.c +++ b/gcc/testsuite/gcc.dg/guality/pr90716.c @@ -20,6 +20,6 @@ int main() Instead test j + 1 which will make the test UNSUPPORTED if i is optimized out. Since the test previously had wrong debug with j == 0 this is acceptable. */ - optimize_me_not(); /* { dg-final { gdb-test . "j + 1" "9" } } */ + optimize_me_not(); /* { dg-final { gdb-test . "j + 1" "9" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" } } } } } */ return 0; } diff --git a/gcc/testsuite/gcc.dg/guality/sra-1.c b/gcc/testsuite/gcc.dg/guality/sra-1.c index 8ad57cf..e9b920e 100644 --- a/gcc/testsuite/gcc.dg/guality/sra-1.c +++ b/gcc/testsuite/gcc.dg/guality/sra-1.c @@ -18,7 +18,7 @@ f1 (int k) asm ("" : "+r" (a.i)); a.j++; bar (a.i); /* { dg-final { gdb-test .+1 "a.i" "4" } } */ - bar (a.j); /* { dg-final { gdb-test . "a.j" "14" } } */ + bar (a.j); /* { dg-final { gdb-test . "a.j" "14" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" } } } } } */ return a.i + a.j; } @@ -29,7 +29,7 @@ f2 (int k) asm ("" : "+r" (a[0])); a[1]++; bar (a[0]); /* { dg-final { gdb-test .+1 "a\[0\]" "4" } } */ - bar (a[1]); /* { dg-final { gdb-test . "a\[1\]" "14" } } */ + bar (a[1]); /* { dg-final { gdb-test . "a\[1\]" "14" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" } } } } } */ return a[0] + a[1]; } @@ -39,8 +39,8 @@ f3 (int k) struct B a = { 4, k + 6 }; asm ("" : "+r" (a.i)); a.j++; - bar (a.i); /* { dg-final { gdb-test .+1 "a.i" "4" } } */ - bar (a.j); /* { dg-final { gdb-test . "a.j" "14" } } */ + bar (a.i); /* { dg-final { gdb-test .+1 "a.i" "4" { xfail { aarch64*-*-* && { any-opts "-Og" } } } } } */ + bar (a.j); /* { dg-final { gdb-test . "a.j" "14" { xfail { aarch64*-*-* && { any-opts "-Og" "-fno-fat-lto-objects" } } } } } */ return a.i + a.j; } -- cgit v1.1 From 32c4d970ea3a9fc330d6aa8fd83f9dae0b9afc64 Mon Sep 17 00:00:00 2001 From: Harald Anlauf Date: Sat, 24 Apr 2021 20:38:06 +0200 Subject: Fortran - allow target of pointer from evaluation of function-reference Fortran allows the target of a pointer from the evaluation of a function-reference in a variable definition context (e.g. F2018:R902). gcc/fortran/ChangeLog: PR fortran/100218 * expr.c (gfc_check_vardef_context): Extend check to allow pointer from a function reference. gcc/testsuite/ChangeLog: PR fortran/100218 * gfortran.dg/ptr-func-4.f90: New test. --- gcc/testsuite/gfortran.dg/ptr-func-4.f90 | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/ptr-func-4.f90 (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gfortran.dg/ptr-func-4.f90 b/gcc/testsuite/gfortran.dg/ptr-func-4.f90 new file mode 100644 index 0000000..62b18f6 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/ptr-func-4.f90 @@ -0,0 +1,19 @@ +! { dg-do run } +! { dg-options "-O2 -std=f2008" } +! PR fortran/100218 - target of pointer from evaluation of function-reference + +program p + implicit none + integer, target :: z = 0 + call g (f ()) + if (z /= 1) stop 1 +contains + function f () result (r) + integer, pointer :: r + r => z + end function f + subroutine g (x) + integer, intent(out) :: x + x = 1 + end subroutine g +end program p -- cgit v1.1 From d0e7833b94953ba6b4a915150666969ad9fc66af Mon Sep 17 00:00:00 2001 From: Harald Anlauf Date: Sat, 24 Apr 2021 20:51:41 +0200 Subject: PR fortran/100154 - ICE in gfc_conv_procedure_call, at fortran/trans-expr.c:6131 Add appropriate static checks for the character and status arguments to the GNU Fortran intrinsic extensions fget[c], fput[c]. Extend variable check to allow a function reference having a data pointer result. gcc/fortran/ChangeLog: PR fortran/100154 * check.c (variable_check): Allow function reference having a data pointer result. (arg_strlen_is_zero): New function. (gfc_check_fgetputc_sub): Add static check of character and status arguments. (gfc_check_fgetput_sub): Likewise. * intrinsic.c (add_subroutines): Fix argument name for the character argument to intrinsic subroutines fget[c], fput[c]. gcc/testsuite/ChangeLog: PR fortran/100154 * gfortran.dg/pr100154.f90: New test. --- gcc/testsuite/gfortran.dg/pr100154.f90 | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/pr100154.f90 (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gfortran.dg/pr100154.f90 b/gcc/testsuite/gfortran.dg/pr100154.f90 new file mode 100644 index 0000000..3a1489a --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr100154.f90 @@ -0,0 +1,26 @@ +! { dg-do compile } +! { dg-options "-std=gnu" } +! PR100154 - ICE in gfc_conv_procedure_call, at fortran/trans-expr.c:6131 + +program p + implicit none + integer :: n + character, target :: c + character(len=0) :: c0 + character(len=:), allocatable :: cc + n = fget(cc) + n = fget('a') ! { dg-error "must be a variable" } + n = fget(c0) ! { dg-error "must have length at least 1" } + call fget('x') ! { dg-error "must be a variable" } + n = fgetc(5,'a') ! { dg-error "must be a variable" } + call fgetc(5,c0) ! { dg-error "must have length at least 1" } + call fgetc(5,c,1) ! { dg-error "must be a variable" } + call fputc(5,'x',1) ! { dg-error "must be a variable" } + n = fget (ptr_returning_func()) + print *, c +contains + function ptr_returning_func () result (res) + character, pointer :: res + res => c + end +end -- cgit v1.1 From 61bfff562e3b6091d5a0a412a7d496bd523868a8 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Sat, 24 Apr 2021 19:49:31 -0400 Subject: analyzer: fix ICE on NULL change.m_expr [PR100244] PR analyzer/100244 reports an ICE on a -Wanalyzer-free-of-non-heap due to a case where free_of_non_heap::describe_state_change can be passed a NULL change.m_expr for a suitably complicated symbolic value. Bulletproof it by checking for change.m_expr being NULL before dereferencing it. gcc/analyzer/ChangeLog: PR analyzer/100244 * sm-malloc.cc (free_of_non_heap::describe_state_change): Bulletproof against change.m_expr being NULL. gcc/testsuite/ChangeLog: PR analyzer/100244 * g++.dg/analyzer/pr100244.C: New test. --- gcc/testsuite/g++.dg/analyzer/pr100244.C | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 gcc/testsuite/g++.dg/analyzer/pr100244.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/analyzer/pr100244.C b/gcc/testsuite/g++.dg/analyzer/pr100244.C new file mode 100644 index 0000000..261b3cf --- /dev/null +++ b/gcc/testsuite/g++.dg/analyzer/pr100244.C @@ -0,0 +1,22 @@ +// { dg-additional-options "-O1 -Wno-free-nonheap-object" } + +inline void *operator new (__SIZE_TYPE__, void *__p) { return __p; } + +struct __aligned_buffer { + int _M_storage; + int *_M_addr() { return &_M_storage; } +}; + +struct _Hashtable_alloc { + int _M_single_bucket; + int *_M_buckets; + _Hashtable_alloc () { _M_buckets = &_M_single_bucket; } + ~_Hashtable_alloc () { delete _M_buckets; } // { dg-warning "not on the heap" } +}; + +void +test01 (__aligned_buffer buf) +{ + _Hashtable_alloc *tmp = new (buf._M_addr ()) _Hashtable_alloc; + tmp->~_Hashtable_alloc (); +} -- cgit v1.1 From 502ef97c4f442777e5f61c506d17f8776a69b207 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sun, 25 Apr 2021 00:16:26 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 67 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 905cd01..732f442 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,70 @@ +2021-04-24 David Malcolm + + PR analyzer/100244 + * g++.dg/analyzer/pr100244.C: New test. + +2021-04-24 Harald Anlauf + + PR fortran/100154 + * gfortran.dg/pr100154.f90: New test. + +2021-04-24 Harald Anlauf + + PR fortran/100218 + * gfortran.dg/ptr-func-4.f90: New test. + +2021-04-24 Richard Sandiford + + * gcc.dg/guality/example.c: Update aarch64*-*-* xfails. + * gcc.dg/guality/guality.c: Likewise. + * gcc.dg/guality/inline-params.c: Likewise. + * gcc.dg/guality/loop-1.c: Likewise. + * gcc.dg/guality/pr36728-1.c: Likewise. + * gcc.dg/guality/pr36728-2.c: Likewise. + * gcc.dg/guality/pr36728-3.c: Likewise. + * gcc.dg/guality/pr41447-1.c: Likewise. + * gcc.dg/guality/pr54200.c: Likewise. + * gcc.dg/guality/pr54519-1.c: Likewise. + * gcc.dg/guality/pr54519-2.c: Likewise. + * gcc.dg/guality/pr54519-3.c: Likewise. + * gcc.dg/guality/pr54519-4.c: Likewise. + * gcc.dg/guality/pr54519-5.c: Likewise. + * gcc.dg/guality/pr54519-6.c: Likewise. + * gcc.dg/guality/pr54693-2.c: Likewise. + * gcc.dg/guality/pr56154-1.c: Likewise. + * gcc.dg/guality/pr59776.c: Likewise. + * gcc.dg/guality/pr68860-1.c: Likewise. + * gcc.dg/guality/pr68860-2.c: Likewise. + * gcc.dg/guality/pr90074.c: Likewise. + * gcc.dg/guality/pr90716.c: Likewise. + * gcc.dg/guality/sra-1.c: Likewise. + +2021-04-24 Richard Sandiford + + * lib/target-supports-dg.exp (selector_expression): Handle any-opts + and no-opts. + * gcc.dg/guality/pr41353-1.c: Exclude -O0 from xfail. + * gcc.dg/guality/pr59776.c: Likewise. + * gcc.dg/guality/pr54970.c: Likewise -O0 and -Og. + +2021-04-24 Patrick Palka + + PR c++/89565 + PR c++/93383 + PR c++/95291 + PR c++/99200 + PR c++/99683 + * g++.dg/cpp2a/nontype-class39.C: Remove dg-ice directive. + * g++.dg/cpp2a/nontype-class45.C: New test. + * g++.dg/cpp2a/nontype-class46.C: New test. + * g++.dg/cpp2a/nontype-class47.C: New test. + * g++.dg/cpp2a/nontype-class48.C: New test. + +2021-04-24 Patrick Palka + + PR c++/87709 + * g++.dg/cpp1z/class-deduction86.C: New test. + 2021-04-23 Michael Meissner PR target/98952 -- cgit v1.1 From c54a9f7259fce1a221270f21d8076c960c7d0163 Mon Sep 17 00:00:00 2001 From: liuhongt Date: Tue, 23 Feb 2021 11:17:40 +0800 Subject: Add folding and remove expanders for x86 *pcmp{et,gt}* builtins [PR target/98911] gcc/ChangeLog: PR target/98911 * config/i386/i386-builtin.def (BDESC): Change the icode of the following builtins to CODE_FOR_nothing. * config/i386/i386.c (ix86_gimple_fold_builtin): Fold IX86_BUILTIN_PCMPEQB128, IX86_BUILTIN_PCMPEQW128, IX86_BUILTIN_PCMPEQD128, IX86_BUILTIN_PCMPEQQ, IX86_BUILTIN_PCMPEQB256, IX86_BUILTIN_PCMPEQW256, IX86_BUILTIN_PCMPEQD256, IX86_BUILTIN_PCMPEQQ256, IX86_BUILTIN_PCMPGTB128, IX86_BUILTIN_PCMPGTW128, IX86_BUILTIN_PCMPGTD128, IX86_BUILTIN_PCMPGTQ, IX86_BUILTIN_PCMPGTB256, IX86_BUILTIN_PCMPGTW256, IX86_BUILTIN_PCMPGTD256, IX86_BUILTIN_PCMPGTQ256. * config/i386/sse.md (avx2_eq3): Deleted. (sse2_eq3): Ditto. (sse4_1_eqv2di3): Ditto. (sse2_gt3): Rename to .. (*sse2_gt3): .. this. gcc/testsuite/ChangeLog: PR target/98911 * gcc.target/i386/pr98911.c: New test. * gcc.target/i386/funcspec-8.c: Replace __builtin_ia32_pcmpgtq with __builtin_ia32_pcmpistrm128 since it has been folded. --- gcc/testsuite/gcc.target/i386/funcspec-8.c | 17 +++-- gcc/testsuite/gcc.target/i386/pr98911.c | 116 +++++++++++++++++++++++++++++ 2 files changed, 125 insertions(+), 8 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr98911.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/i386/funcspec-8.c b/gcc/testsuite/gcc.target/i386/funcspec-8.c index 8bd95fc..0a6c709 100644 --- a/gcc/testsuite/gcc.target/i386/funcspec-8.c +++ b/gcc/testsuite/gcc.target/i386/funcspec-8.c @@ -8,6 +8,7 @@ typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__)); typedef double __m128d __attribute__ ((__vector_size__ (16), __may_alias__)); typedef int __m128w __attribute__ ((__vector_size__ (16), __may_alias__)); typedef long long __m128i __attribute__ ((__vector_size__ (16), __may_alias__)); +typedef char __m128qi __attribute__ ((__vector_size__ (16), __may_alias__)); #ifdef __SSE3__ #error "-msse3 should not be set for this test" @@ -70,19 +71,19 @@ generic_blendvpd (__m128d a, __m128d b, __m128d c) #error "-msse4.2 should not be set for this test" #endif -__m128i sse4_2_pcmpgtq (__m128i a, __m128i b) __attribute__((__target__("sse4.2"))); -__m128i generic_pcmpgtq (__m128i ab, __m128i b); +__m128qi sse4_2_cmpistrm (__m128qi a, __m128qi b) __attribute__((__target__("sse4.2"))); +__m128qi generic_cmpistrm (__m128qi a, __m128qi b); -__m128i -sse4_2_pcmpgtq (__m128i a, __m128i b) +__m128qi +sse4_2_cmpistrm (__m128qi a, __m128qi b) { - return __builtin_ia32_pcmpgtq (a, b); + return __builtin_ia32_pcmpistrm128 (a, b, 0); } -__m128i -generic_pcmpgtq (__m128i a, __m128i b) +__m128qi +generic_comistrm (__m128qi a, __m128qi b) { - return __builtin_ia32_pcmpgtq (a, b); /* { dg-error "needs isa option" } */ + return __builtin_ia32_pcmpistrm128 (a, b, 0); /* { dg-error "needs isa option" } */ } #ifdef __SSE4A__ diff --git a/gcc/testsuite/gcc.target/i386/pr98911.c b/gcc/testsuite/gcc.target/i386/pr98911.c new file mode 100644 index 0000000..f08cea0 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr98911.c @@ -0,0 +1,116 @@ +/* PR target/98911 */ +/* { dg-do compile } */ +/* { dg-options "-O -mavx2" } */ +/* { dg-final { scan-assembler-times "pcmpeqb" 2 } } */ +/* { dg-final { scan-assembler-times "pcmpeqw" 2 } } */ +/* { dg-final { scan-assembler-times "pcmpeqd" 2 } } */ +/* { dg-final { scan-assembler-times "pcmpeqq" 2 } } */ +/* { dg-final { scan-assembler-times "pcmpgtb" 2 } } */ +/* { dg-final { scan-assembler-times "pcmpgtw" 2 } } */ +/* { dg-final { scan-assembler-times "pcmpgtd" 2 } } */ +/* { dg-final { scan-assembler-times "pcmpgtq" 2 } } */ + +typedef char v16qi __attribute__ ((vector_size (16))); +typedef char v32qi __attribute__ ((vector_size (32))); +typedef short v8hi __attribute__ ((vector_size (16))); +typedef short v16hi __attribute__ ((vector_size (32))); +typedef int v4si __attribute__ ((vector_size (16))); +typedef int v8si __attribute__ ((vector_size (32))); +typedef long long v2di __attribute__ ((vector_size (16))); +typedef long long v4di __attribute__ ((vector_size (32))); + +v16qi +f1 (v16qi a, v16qi b) +{ + return __builtin_ia32_pcmpeqb128 (a, b); +} + +v8hi +f2 (v8hi a, v8hi b) +{ + return __builtin_ia32_pcmpeqw128 (a, b); +} + +v4si +f3 (v4si a, v4si b) +{ + return __builtin_ia32_pcmpeqd128 (a, b); +} + +v2di +f4 (v2di a, v2di b) +{ + return __builtin_ia32_pcmpeqq (a, b); +} + +v16qi +f5 (v16qi a, v16qi b) +{ + return __builtin_ia32_pcmpgtb128 (a, b); +} + +v8hi +f6 (v8hi a, v8hi b) +{ + return __builtin_ia32_pcmpgtw128 (a, b); +} + +v4si +f7 (v4si a, v4si b) +{ + return __builtin_ia32_pcmpgtd128 (a, b); +} + +v2di +f8 (v2di a, v2di b) +{ + return __builtin_ia32_pcmpgtq (a, b); +} + +v32qi +f9 (v32qi a, v32qi b) +{ + return __builtin_ia32_pcmpeqb256 (a, b); +} + +v16hi +f10 (v16hi a, v16hi b) +{ + return __builtin_ia32_pcmpeqw256 (a, b); +} + +v8si +f11 (v8si a, v8si b) +{ + return __builtin_ia32_pcmpeqd256 (a, b); +} + +v4di +f12 (v4di a, v4di b) +{ + return __builtin_ia32_pcmpeqq256 (a, b); +} + +v32qi +f13 (v32qi a, v32qi b) +{ + return __builtin_ia32_pcmpgtb256 (a, b); +} + +v16hi +f14 (v16hi a, v16hi b) +{ + return __builtin_ia32_pcmpgtw256 (a, b); +} + +v8si +f15 (v8si a, v8si b) +{ + return __builtin_ia32_pcmpgtd256 (a, b); +} + +v4di +f16 (v4di a, v4di b) +{ + return __builtin_ia32_pcmpgtq256 (a, b); +} -- cgit v1.1 From 3971aee9dd8d6323c377d1b241173f7d2b51a835 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 26 Apr 2021 00:16:26 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 732f442..c79adfd 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2021-04-25 liuhongt + + PR target/98911 + * gcc.target/i386/pr98911.c: New test. + * gcc.target/i386/funcspec-8.c: Replace __builtin_ia32_pcmpgtq + with __builtin_ia32_pcmpistrm128 since it has been folded. + 2021-04-24 David Malcolm PR analyzer/100244 -- cgit v1.1 From 577d05fc914338cd7ddc254f3bee4532331f5c13 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 9 Mar 2021 09:29:29 +0100 Subject: tree-optimization/99473 - more cselim This fixes the pre-condition on cselim to include all references and decls when they end up as auto-var. Bootstrapped/tested on x86_64-linux 2021-03-09 Richard Biener PR tree-optimization/99473 * tree-ssa-phiopt.c (cond_store_replacement): Handle all stores. * gcc.dg/tree-ssa/pr99473-1.c: New testcase. --- gcc/testsuite/gcc.dg/tree-ssa/pr99473-1.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr99473-1.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr99473-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr99473-1.c new file mode 100644 index 0000000..a9fd542 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr99473-1.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fallow-store-data-races -fdump-tree-cselim-details" } */ + +void f (int*); + +void g3 (int i) +{ + int x = 0; + if (i) + x = i; + f (&x); +} + +/* { dg-final { scan-tree-dump "Conditional store replacement happened" "cselim" } } */ -- cgit v1.1 From 22cff118f7526bec195ed6e41452980820fdf3a8 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Fri, 23 Apr 2021 12:23:51 +0200 Subject: Add '-Wopenacc-parallelism' ... to diagnose potentially suboptimal choices regarding OpenACC parallelism. Not enabled by default: too noisy ("*potentially* suboptimal choices"); see XFAILed 'dg-bogus'es. gcc/c-family/ * c.opt (Wopenacc-parallelism): New. gcc/fortran/ * lang.opt (Wopenacc-parallelism): New. gcc/ * omp-offload.c (oacc_validate_dims): Implement '-Wopenacc-parallelism'. * doc/invoke.texi (-Wopenacc-parallelism): Document. gcc/testsuite/ * c-c++-common/goacc/diag-parallelism-1.c: New. * c-c++-common/goacc/acc-icf.c: Specify '-Wopenacc-parallelism', and match diagnostics, as appropriate. * c-c++-common/goacc/classify-kernels-unparallelized.c: Likewise. * c-c++-common/goacc/classify-kernels.c: Likewise. * c-c++-common/goacc/classify-parallel.c: Likewise. * c-c++-common/goacc/classify-routine.c: Likewise. * c-c++-common/goacc/classify-serial.c: Likewise. * c-c++-common/goacc/kernels-decompose-1.c: Likewise. * c-c++-common/goacc/kernels-decompose-2.c: Likewise. * c-c++-common/goacc/parallel-dims-1.c: Likewise. * c-c++-common/goacc/parallel-reduction.c: Likewise. * c-c++-common/goacc/pr70688.c: Likewise. * c-c++-common/goacc/routine-1.c: Likewise. * c-c++-common/goacc/routine-level-of-parallelism-2.c: Likewise. * c-c++-common/goacc/uninit-dim-clause.c: Likewise. * gfortran.dg/goacc/classify-kernels-unparallelized.f95: Likewise. * gfortran.dg/goacc/classify-kernels.f95: Likewise. * gfortran.dg/goacc/classify-parallel.f95: Likewise. * gfortran.dg/goacc/classify-routine.f95: Likewise. * gfortran.dg/goacc/classify-serial.f95: Likewise. * gfortran.dg/goacc/kernels-decompose-1.f95: Likewise. * gfortran.dg/goacc/kernels-decompose-2.f95: Likewise. * gfortran.dg/goacc/parallel-tree.f95: Likewise. * gfortran.dg/goacc/routine-4.f90: Likewise. * gfortran.dg/goacc/routine-level-of-parallelism-1.f90: Likewise. * gfortran.dg/goacc/routine-module-mod-1.f90: Likewise. * gfortran.dg/goacc/routine-multiple-directives-1.f90: Likewise. * gfortran.dg/goacc/uninit-dim-clause.f95: Likewise. libgomp/ * testsuite/libgomp.oacc-c-c++-common/firstprivate-1.c: Specify '-Wopenacc-parallelism', and match diagnostics, as appropriate. * testsuite/libgomp.oacc-c-c++-common/loop-auto-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/loop-red-w-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/loop-red-w-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/loop-w-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/mode-transitions.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/par-reduction-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/par-reduction-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/parallel-dims.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/parallel-reduction.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/pr85381-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/private-variables.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-5.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-7.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/routine-g-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/routine-w-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/routine-wv-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/static-variable-1.c: Likewise. * testsuite/libgomp.oacc-fortran/optional-private.f90: Likewise. * testsuite/libgomp.oacc-fortran/par-reduction-2-1.f: Likewise. * testsuite/libgomp.oacc-fortran/par-reduction-2-2.f: Likewise. * testsuite/libgomp.oacc-fortran/parallel-dims.f90: Likewise. * testsuite/libgomp.oacc-fortran/parallel-reduction.f90: Likewise. * testsuite/libgomp.oacc-fortran/pr84028.f90: Likewise. * testsuite/libgomp.oacc-fortran/private-variables.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-5.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-6.f90: Likewise. * testsuite/libgomp.oacc-fortran/routine-7.f90: Likewise. Co-Authored-By: Nathan Sidwell Co-Authored-By: Tom de Vries Co-Authored-By: Julian Brown Co-Authored-By: Kwok Cheung Yeung --- gcc/testsuite/c-c++-common/goacc/acc-icf.c | 7 ++ .../goacc/classify-kernels-unparallelized.c | 3 + .../c-c++-common/goacc/classify-kernels.c | 3 + .../c-c++-common/goacc/classify-parallel.c | 3 + .../c-c++-common/goacc/classify-routine.c | 3 + gcc/testsuite/c-c++-common/goacc/classify-serial.c | 8 ++ .../c-c++-common/goacc/diag-parallelism-1.c | 124 +++++++++++++++++++++ .../c-c++-common/goacc/kernels-decompose-1.c | 3 + .../c-c++-common/goacc/kernels-decompose-2.c | 4 + gcc/testsuite/c-c++-common/goacc/parallel-dims-1.c | 7 ++ .../c-c++-common/goacc/parallel-reduction.c | 4 + gcc/testsuite/c-c++-common/goacc/pr70688.c | 6 + gcc/testsuite/c-c++-common/goacc/routine-1.c | 8 ++ .../goacc/routine-level-of-parallelism-2.c | 6 + .../c-c++-common/goacc/uninit-dim-clause.c | 6 + .../goacc/classify-kernels-unparallelized.f95 | 3 + .../gfortran.dg/goacc/classify-kernels.f95 | 3 + .../gfortran.dg/goacc/classify-parallel.f95 | 3 + .../gfortran.dg/goacc/classify-routine.f95 | 3 + .../gfortran.dg/goacc/classify-serial.f95 | 6 + .../gfortran.dg/goacc/kernels-decompose-1.f95 | 3 + .../gfortran.dg/goacc/kernels-decompose-2.f95 | 4 + gcc/testsuite/gfortran.dg/goacc/parallel-tree.f95 | 6 + gcc/testsuite/gfortran.dg/goacc/routine-4.f90 | 9 ++ .../goacc/routine-level-of-parallelism-1.f90 | 6 + .../gfortran.dg/goacc/routine-module-mod-1.f90 | 4 + .../goacc/routine-multiple-directives-1.f90 | 5 + .../gfortran.dg/goacc/uninit-dim-clause.f95 | 6 + 28 files changed, 256 insertions(+) create mode 100644 gcc/testsuite/c-c++-common/goacc/diag-parallelism-1.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/c-c++-common/goacc/acc-icf.c b/gcc/testsuite/c-c++-common/goacc/acc-icf.c index 98b536c..9cf119b 100644 --- a/gcc/testsuite/c-c++-common/goacc/acc-icf.c +++ b/gcc/testsuite/c-c++-common/goacc/acc-icf.c @@ -2,7 +2,12 @@ /* { dg-additional-options "-fopenacc -O2 -fdump-ipa-icf" } */ +/* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting + aspects of that functionality. */ + #pragma acc routine gang +/* { dg-bogus "warning: region is worker partitioned but does not contain worker partitioned code" "TODO default 'gang' 'vector'" { xfail *-*-* } .+3 } + TODO It's the compiler's own decision to not use 'worker' parallelism here, so it doesn't make sense to bother the user about it. */ int routine1 (int n) { @@ -16,6 +21,8 @@ routine1 (int n) } #pragma acc routine gang +/* { dg-bogus "warning: region is worker partitioned but does not contain worker partitioned code" "TODO default 'gang' 'vector'" { xfail *-*-* } .+3 } + TODO It's the compiler's own decision to not use 'worker' parallelism here, so it doesn't make sense to bother the user about it. */ int routine2 (int n) { diff --git a/gcc/testsuite/c-c++-common/goacc/classify-kernels-unparallelized.c b/gcc/testsuite/c-c++-common/goacc/classify-kernels-unparallelized.c index d4c4b2c..218f624 100644 --- a/gcc/testsuite/c-c++-common/goacc/classify-kernels-unparallelized.c +++ b/gcc/testsuite/c-c++-common/goacc/classify-kernels-unparallelized.c @@ -7,6 +7,9 @@ { dg-additional-options "-fdump-tree-parloops1-all" } { dg-additional-options "-fdump-tree-oaccdevlow" } */ +/* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting + aspects of that functionality. */ + #define N 1024 extern unsigned int *__restrict a; diff --git a/gcc/testsuite/c-c++-common/goacc/classify-kernels.c b/gcc/testsuite/c-c++-common/goacc/classify-kernels.c index 16e9b9e..95a150c 100644 --- a/gcc/testsuite/c-c++-common/goacc/classify-kernels.c +++ b/gcc/testsuite/c-c++-common/goacc/classify-kernels.c @@ -7,6 +7,9 @@ { dg-additional-options "-fdump-tree-parloops1-all" } { dg-additional-options "-fdump-tree-oaccdevlow" } */ +/* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting + aspects of that functionality. */ + #define N 1024 extern unsigned int *__restrict a; diff --git a/gcc/testsuite/c-c++-common/goacc/classify-parallel.c b/gcc/testsuite/c-c++-common/goacc/classify-parallel.c index 933d766..230e70c 100644 --- a/gcc/testsuite/c-c++-common/goacc/classify-parallel.c +++ b/gcc/testsuite/c-c++-common/goacc/classify-parallel.c @@ -6,6 +6,9 @@ { dg-additional-options "-fdump-tree-ompexp" } { dg-additional-options "-fdump-tree-oaccdevlow" } */ +/* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting + aspects of that functionality. */ + #define N 1024 extern unsigned int *__restrict a; diff --git a/gcc/testsuite/c-c++-common/goacc/classify-routine.c b/gcc/testsuite/c-c++-common/goacc/classify-routine.c index 0b9ba6e..81fe369 100644 --- a/gcc/testsuite/c-c++-common/goacc/classify-routine.c +++ b/gcc/testsuite/c-c++-common/goacc/classify-routine.c @@ -6,6 +6,9 @@ { dg-additional-options "-fdump-tree-ompexp" } { dg-additional-options "-fdump-tree-oaccdevlow" } */ +/* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting + aspects of that functionality. */ + #define N 1024 extern unsigned int *__restrict a; diff --git a/gcc/testsuite/c-c++-common/goacc/classify-serial.c b/gcc/testsuite/c-c++-common/goacc/classify-serial.c index 94ace1b..ae052ae 100644 --- a/gcc/testsuite/c-c++-common/goacc/classify-serial.c +++ b/gcc/testsuite/c-c++-common/goacc/classify-serial.c @@ -6,6 +6,9 @@ { dg-additional-options "-fdump-tree-ompexp" } { dg-additional-options "-fdump-tree-oaccdevlow" } */ +/* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting + aspects of that functionality. */ + #define N 1024 extern unsigned int *__restrict a; @@ -15,6 +18,11 @@ extern unsigned int *__restrict c; void SERIAL () { #pragma acc serial loop copyin (a[0:N], b[0:N]) copyout (c[0:N]) /* { dg-message "optimized: assigned OpenACC gang vector loop parallelism" } */ + /* { dg-bogus "warning: region contains gang partitioned code but is not gang partitioned" "TODO 'serial'" { xfail *-*-* } .-1 } + { dg-bogus "warning: region contains worker partitioned code but is not worker partitioned" "" { target *-*-* } .-2 } + { dg-bogus "warning: region contains vector partitioned code but is not vector partitioned" "TODO 'serial'" { xfail *-*-* } .-3 } + TODO Should we really diagnose this if the user explicitly requested 'serial'? + TODO Should we instead diagnose ('-Wextra' category?) that the user may enable use of parallelism if replacing 'serial' with 'parallel', if applicable? */ for (unsigned int i = 0; i < N; i++) c[i] = a[i] + b[i]; } diff --git a/gcc/testsuite/c-c++-common/goacc/diag-parallelism-1.c b/gcc/testsuite/c-c++-common/goacc/diag-parallelism-1.c new file mode 100644 index 0000000..6ee7bd0 --- /dev/null +++ b/gcc/testsuite/c-c++-common/goacc/diag-parallelism-1.c @@ -0,0 +1,124 @@ +/* Diagnostics about potentially suboptimal choices related to OpenACC + parallelism. + + { dg-additional-options "-Wopenacc-parallelism" } +*/ + + +//TODO 'kernels' + +//TODO 'serial' + +//TODO 'routine' + +//TODO Fortran + + +static void f1 () +{ + int ary[10]; + + +#pragma acc parallel num_gangs (1) + /* { dg-warning "region contains gang partitioned code but is not gang partitioned" "" { target *-*-* } .-1 } */ + { + #pragma acc loop gang + for (int i = 0; i < 10; i++) + ary[i] = i; + } + +#pragma acc parallel num_workers (1) + /* { dg-warning "region contains worker partitioned code but is not worker partitioned" "" { target *-*-* } .-1 } */ + { + #pragma acc loop worker + for (int i = 0; i < 10; i++) + ary[i] = i; + } + +#pragma acc parallel vector_length (1) + /* { dg-warning "region contains vector partitioned code but is not vector partitioned" "" { target *-*-* } .-1 } */ + { + #pragma acc loop vector + for (int i = 0; i < 10; i++) + ary[i] = i; + } +} + + +static void f2 () +{ + int ary[10]; + + +#pragma acc parallel num_gangs (8) + /* { dg-warning "region is gang partitioned but does not contain gang partitioned code" "" { target *-*-* } .-1 } */ + { + #pragma acc loop worker + for (int i = 0; i < 10; i++) + ary[i] = i; + } + +#pragma acc parallel num_gangs (8) + /* { dg-warning "region is gang partitioned but does not contain gang partitioned code" "" { target *-*-* } .-1 } */ + { + #pragma acc loop vector + for (int i = 0; i < 10; i++) + ary[i] = i; + } + +#pragma acc parallel num_gangs (8) + /* { dg-warning "region is gang partitioned but does not contain gang partitioned code" "" { target *-*-* } .-1 } */ + { + #pragma acc loop worker vector + for (int i = 0; i < 10; i++) + ary[i] = i; + } + +#pragma acc parallel num_workers (8) + /* { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .-1 } */ + { + #pragma acc loop gang + for (int i = 0; i < 10; i++) + ary[i] = i; + } + +#pragma acc parallel num_workers (8) + /* { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .-1 } */ + { + #pragma acc loop vector + for (int i = 0; i < 10; i++) + ary[i] = i; + } + +#pragma acc parallel num_workers (8) + /* { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .-1 } */ + { + #pragma acc loop gang vector + for (int i = 0; i < 10; i++) + ary[i] = i; + } + +#pragma acc parallel vector_length (8) + /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-1 } */ + { + #pragma acc loop gang + for (int i = 0; i < 10; i++) + ary[i] = i; + } + +#pragma acc parallel vector_length (8) + /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-1 } */ + { + #pragma acc loop worker + for (int i = 0; i < 10; i++) + ary[i] = i; + } + +#pragma acc parallel vector_length (8) + /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-1 } */ + { + #pragma acc loop gang worker + for (int i = 0; i < 10; i++) + ary[i] = i; + } +} diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-1.c b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-1.c index 87219c8..f549cba 100644 --- a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-1.c +++ b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-1.c @@ -5,6 +5,9 @@ /* { dg-additional-options "--param=openacc-kernels=decompose" } { dg-additional-options "-fdump-tree-omp_oacc_kernels_decompose" } */ +/* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting + aspects of that functionality. */ + /* See also '../../gfortran.dg/goacc/kernels-decompose-1.f95'. */ /* It's only with Tcl 8.5 (released in 2007) that "the variable 'varName' diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-2.c b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-2.c index 3781e75..cdf85d4 100644 --- a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-2.c +++ b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-2.c @@ -4,6 +4,9 @@ /* { dg-additional-options "--param=openacc-kernels=decompose" } /* { dg-additional-options "-O2" } for 'parloops'. */ +/* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting + aspects of that functionality. */ + /* See also '../../gfortran.dg/goacc/kernels-decompose-2.f95'. */ /* It's only with Tcl 8.5 (released in 2007) that "the variable 'varName' @@ -116,6 +119,7 @@ main () } #pragma acc kernels + /* { dg-bogus "warning: region contains gang partitioned code but is not gang partitioned" "TODO 'kernels'" { xfail *-*-* } .-1 } */ { y = f_g (a[5]); /* { dg-line l_part[incr c_part] } */ /*TODO If such a construct is placed in its own part (like it is, here), can't this actually use gang paralelism, instead of "gang-single"? diff --git a/gcc/testsuite/c-c++-common/goacc/parallel-dims-1.c b/gcc/testsuite/c-c++-common/goacc/parallel-dims-1.c index 57f682f..2a8d35d 100644 --- a/gcc/testsuite/c-c++-common/goacc/parallel-dims-1.c +++ b/gcc/testsuite/c-c++-common/goacc/parallel-dims-1.c @@ -1,11 +1,18 @@ /* Valid use of OpenACC parallelism dimensions clauses: num_gangs, num_workers, vector_length. */ +/* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting + aspects of that functionality. */ + void f(int i) { #pragma acc kernels num_gangs(i) num_workers(i) vector_length(i) ; #pragma acc parallel num_gangs(i) num_workers(i) vector_length(i) + /* { dg-bogus "warning: region is gang partitioned but does not contain gang partitioned code" "TODO runtime" { xfail *-*-* } .-1 } + { dg-bogus "warning: region is worker partitioned but does not contain worker partitioned code" "TODO runtime" { xfail *-*-* } .-2 } + { dg-bogus "warning: region is vector partitioned but does not contain vector partitioned code" "TODO runtime" { xfail *-*-* } .-3 } + TODO 'region is [...] partitioned' isn't correct for 'i == 1'. */ ; } diff --git a/gcc/testsuite/c-c++-common/goacc/parallel-reduction.c b/gcc/testsuite/c-c++-common/goacc/parallel-reduction.c index d7cc947..c5c0edc 100644 --- a/gcc/testsuite/c-c++-common/goacc/parallel-reduction.c +++ b/gcc/testsuite/c-c++-common/goacc/parallel-reduction.c @@ -1,3 +1,6 @@ +/* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting + aspects of that functionality. */ + int main () { @@ -7,6 +10,7 @@ main () #pragma acc data copy (dummy) { #pragma acc parallel num_gangs (10) copy (sum) reduction (+:sum) + /* { dg-bogus "warning: region is gang partitioned but does not contain gang partitioned code" "TODO 'reduction'" { xfail *-*-* } .-1 } */ { int v = 5; sum += 10 + v; diff --git a/gcc/testsuite/c-c++-common/goacc/pr70688.c b/gcc/testsuite/c-c++-common/goacc/pr70688.c index 5a23665..e96a853 100644 --- a/gcc/testsuite/c-c++-common/goacc/pr70688.c +++ b/gcc/testsuite/c-c++-common/goacc/pr70688.c @@ -1,3 +1,6 @@ +/* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting + aspects of that functionality. */ + const int n = 100; int @@ -22,6 +25,7 @@ parallel_reduction () #pragma acc data copy (dummy) { #pragma acc parallel num_gangs (10) copy (sum) reduction (+:sum) + /* { dg-bogus "warning: region is gang partitioned but does not contain gang partitioned code" "TODO 'reduction'" { xfail *-*-* } .-1 } */ { int v = 5; sum += 10 + v; @@ -37,10 +41,12 @@ main () int i, s = 0; #pragma acc parallel num_gangs (10) copy (s) reduction (+:s) + /* { dg-bogus "warning: region is gang partitioned but does not contain gang partitioned code" "TODO 'reduction'" { xfail *-*-* } .-1 } */ for (i = 0; i < n; i++) s += i+1; #pragma acc parallel num_gangs (10) reduction (+:s) copy (s) + /* { dg-bogus "warning: region is gang partitioned but does not contain gang partitioned code" "TODO 'reduction'" { xfail *-*-* } .-1 } */ for (i = 0; i < n; i++) s += i+1; diff --git a/gcc/testsuite/c-c++-common/goacc/routine-1.c b/gcc/testsuite/c-c++-common/goacc/routine-1.c index a756922..051f793 100644 --- a/gcc/testsuite/c-c++-common/goacc/routine-1.c +++ b/gcc/testsuite/c-c++-common/goacc/routine-1.c @@ -1,15 +1,23 @@ +/* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting + aspects of that functionality. */ #pragma acc routine gang +/* { dg-warning "region is gang partitioned but does not contain gang partitioned code" "" { target *-*-* } .+3 } + { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .+2 } + { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .+1 } */ void gang (void) { } #pragma acc routine worker +/* { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .+2 } + { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .+1 } */ void worker (void) { } #pragma acc routine vector +/* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .+1 } */ void vector (void) { } diff --git a/gcc/testsuite/c-c++-common/goacc/routine-level-of-parallelism-2.c b/gcc/testsuite/c-c++-common/goacc/routine-level-of-parallelism-2.c index a066f2b..33678fe 100644 --- a/gcc/testsuite/c-c++-common/goacc/routine-level-of-parallelism-2.c +++ b/gcc/testsuite/c-c++-common/goacc/routine-level-of-parallelism-2.c @@ -2,7 +2,13 @@ with the OpenACC 'routine' directive. The Fortran counterpart is '../../gfortran.dg/goacc/routine-level-of-parallelism-1.f90'. */ +/* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting + aspects of that functionality. */ + #pragma acc routine gang +/* { dg-warning "region is gang partitioned but does not contain gang partitioned code" "" { target *-*-* } .+3 } + { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .+2 } + { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .+1 } */ void g_1 (void) { } diff --git a/gcc/testsuite/c-c++-common/goacc/uninit-dim-clause.c b/gcc/testsuite/c-c++-common/goacc/uninit-dim-clause.c index 827dac7..d9b143b 100644 --- a/gcc/testsuite/c-c++-common/goacc/uninit-dim-clause.c +++ b/gcc/testsuite/c-c++-common/goacc/uninit-dim-clause.c @@ -1,16 +1,22 @@ /* { dg-additional-options "-Wuninitialized" } */ +/* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting + aspects of that functionality. */ + void acc_parallel() { int i, j, k; #pragma acc parallel num_gangs(i) /* { dg-warning "is used uninitialized" } */ + /* { dg-warning "region is gang partitioned but does not contain gang partitioned code" "" { target *-*-* } .-1 } */ ; #pragma acc parallel num_workers(j) /* { dg-warning "is used uninitialized" } */ + /* { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .-1 } */ ; #pragma acc parallel vector_length(k) /* { dg-warning "is used uninitialized" } */ + /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-1 } */ ; } diff --git a/gcc/testsuite/gfortran.dg/goacc/classify-kernels-unparallelized.f95 b/gcc/testsuite/gfortran.dg/goacc/classify-kernels-unparallelized.f95 index 6cca3d6..cb5251a 100644 --- a/gcc/testsuite/gfortran.dg/goacc/classify-kernels-unparallelized.f95 +++ b/gcc/testsuite/gfortran.dg/goacc/classify-kernels-unparallelized.f95 @@ -7,6 +7,9 @@ ! { dg-additional-options "-fdump-tree-parloops1-all" } ! { dg-additional-options "-fdump-tree-oaccdevlow" } +! { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting +! aspects of that functionality. + program main implicit none integer, parameter :: n = 1024 diff --git a/gcc/testsuite/gfortran.dg/goacc/classify-kernels.f95 b/gcc/testsuite/gfortran.dg/goacc/classify-kernels.f95 index 715a983..07aaf06 100644 --- a/gcc/testsuite/gfortran.dg/goacc/classify-kernels.f95 +++ b/gcc/testsuite/gfortran.dg/goacc/classify-kernels.f95 @@ -7,6 +7,9 @@ ! { dg-additional-options "-fdump-tree-parloops1-all" } ! { dg-additional-options "-fdump-tree-oaccdevlow" } +! { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting +! aspects of that functionality. + program main implicit none integer, parameter :: n = 1024 diff --git a/gcc/testsuite/gfortran.dg/goacc/classify-parallel.f95 b/gcc/testsuite/gfortran.dg/goacc/classify-parallel.f95 index 01f06bb..a41e0e6 100644 --- a/gcc/testsuite/gfortran.dg/goacc/classify-parallel.f95 +++ b/gcc/testsuite/gfortran.dg/goacc/classify-parallel.f95 @@ -6,6 +6,9 @@ ! { dg-additional-options "-fdump-tree-ompexp" } ! { dg-additional-options "-fdump-tree-oaccdevlow" } +! { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting +! aspects of that functionality. + program main implicit none integer, parameter :: n = 1024 diff --git a/gcc/testsuite/gfortran.dg/goacc/classify-routine.f95 b/gcc/testsuite/gfortran.dg/goacc/classify-routine.f95 index 401d527..52cc870 100644 --- a/gcc/testsuite/gfortran.dg/goacc/classify-routine.f95 +++ b/gcc/testsuite/gfortran.dg/goacc/classify-routine.f95 @@ -6,6 +6,9 @@ ! { dg-additional-options "-fdump-tree-ompexp" } ! { dg-additional-options "-fdump-tree-oaccdevlow" } +! { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting +! aspects of that functionality. + subroutine ROUTINE !$acc routine worker integer, parameter :: n = 1024 diff --git a/gcc/testsuite/gfortran.dg/goacc/classify-serial.f95 b/gcc/testsuite/gfortran.dg/goacc/classify-serial.f95 index 51061af..6d402e6 100644 --- a/gcc/testsuite/gfortran.dg/goacc/classify-serial.f95 +++ b/gcc/testsuite/gfortran.dg/goacc/classify-serial.f95 @@ -6,6 +6,9 @@ ! { dg-additional-options "-fdump-tree-ompexp" } ! { dg-additional-options "-fdump-tree-oaccdevlow" } +! { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting +! aspects of that functionality. + program main implicit none integer, parameter :: n = 1024 @@ -15,6 +18,9 @@ program main call setup(a, b) !$acc serial loop copyin (a(0:n-1), b(0:n-1)) copyout (c(0:n-1)) ! { dg-message "optimized: assigned OpenACC gang vector loop parallelism" } + ! { dg-bogus "warning: region contains gang partitioned code but is not gang partitioned" "TODO 'serial'" { xfail *-*-* } .-1 } + ! { dg-bogus "warning: region contains worker partitioned code but is not worker partitioned" "" { target *-*-* } .-2 } + ! { dg-bogus "warning: region contains vector partitioned code but is not vector partitioned" "TODO 'serial'" { xfail *-*-* } .-3 } do i = 0, n - 1 c(i) = a(i) + b(i) end do diff --git a/gcc/testsuite/gfortran.dg/goacc/kernels-decompose-1.f95 b/gcc/testsuite/gfortran.dg/goacc/kernels-decompose-1.f95 index e252350..ddaf7f8 100644 --- a/gcc/testsuite/gfortran.dg/goacc/kernels-decompose-1.f95 +++ b/gcc/testsuite/gfortran.dg/goacc/kernels-decompose-1.f95 @@ -5,6 +5,9 @@ ! { dg-additional-options "--param=openacc-kernels=decompose" } ! { dg-additional-options "-fdump-tree-omp_oacc_kernels_decompose" } +! { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting +! aspects of that functionality. + ! See also '../../c-c++-common/goacc/kernels-decompose-1.c'. ! It's only with Tcl 8.5 (released in 2007) that "the variable 'varName' diff --git a/gcc/testsuite/gfortran.dg/goacc/kernels-decompose-2.f95 b/gcc/testsuite/gfortran.dg/goacc/kernels-decompose-2.f95 index cc12b77..a3cec83 100644 --- a/gcc/testsuite/gfortran.dg/goacc/kernels-decompose-2.f95 +++ b/gcc/testsuite/gfortran.dg/goacc/kernels-decompose-2.f95 @@ -4,6 +4,9 @@ ! { dg-additional-options "--param=openacc-kernels=decompose" } ! { dg-additional-options "-O2" } for 'parloops'. +! { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting +! aspects of that functionality. + ! See also '../../c-c++-common/goacc/kernels-decompose-2.c'. ! It's only with Tcl 8.5 (released in 2007) that "the variable 'varName' @@ -119,6 +122,7 @@ program main !$acc end kernels !$acc kernels + ! { dg-bogus "warning: region contains gang partitioned code but is not gang partitioned" "TODO 'kernels'" { xfail *-*-* } .-1 } y = f_g (a(5)) ! { dg-line l_part[incr c_part] } !TODO If such a construct is placed in its own part (like it is, here), can't this actually use gang paralelism, instead of "gang-single"? ! { dg-message "note: beginning 'gang-single' part in OpenACC 'kernels' region" "" { target *-*-* } l_part$c_part } diff --git a/gcc/testsuite/gfortran.dg/goacc/parallel-tree.f95 b/gcc/testsuite/gfortran.dg/goacc/parallel-tree.f95 index e33653b..c51cb2a 100644 --- a/gcc/testsuite/gfortran.dg/goacc/parallel-tree.f95 +++ b/gcc/testsuite/gfortran.dg/goacc/parallel-tree.f95 @@ -2,6 +2,9 @@ ! test for tree-dump-original and spaces-commas +! { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting +! aspects of that functionality. + program test implicit none integer :: q, i, j, k, m, n, o, p, r, s, t, u, v, w @@ -12,6 +15,9 @@ program test !$acc no_create(n) & !$acc present(o), pcopy(p), pcopyin(r), pcopyout(s), pcreate(t) & !$acc deviceptr(u), private(v), firstprivate(w) + ! { dg-warning "region is gang partitioned but does not contain gang partitioned code" "" { target *-*-* } .-1 } + ! { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .-2 } + ! { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-3 } !$acc end parallel end program test diff --git a/gcc/testsuite/gfortran.dg/goacc/routine-4.f90 b/gcc/testsuite/gfortran.dg/goacc/routine-4.f90 index 6714c7b..53b1fbe 100644 --- a/gcc/testsuite/gfortran.dg/goacc/routine-4.f90 +++ b/gcc/testsuite/gfortran.dg/goacc/routine-4.f90 @@ -1,5 +1,8 @@ ! Test invalid calls to routines. +! { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting +! aspects of that functionality. + module param integer, parameter :: N = 32 end module param @@ -120,6 +123,9 @@ contains subroutine gang (a) ! { dg-message "declared here" 3 } !$acc routine gang + ! { dg-warning "region is gang partitioned but does not contain gang partitioned code" "" { target *-*-* } .-2 } + ! { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .-3 } + ! { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-4 } integer, intent (inout) :: a(N) integer :: i @@ -130,6 +136,8 @@ contains subroutine worker (a) ! { dg-message "declared here" 2 } !$acc routine worker + ! { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .-2 } + ! { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-3 } integer, intent (inout) :: a(N) integer :: i @@ -140,6 +148,7 @@ contains subroutine vector (a) ! { dg-message "declared here" } !$acc routine vector + ! { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-2 } integer, intent (inout) :: a(N) integer :: i diff --git a/gcc/testsuite/gfortran.dg/goacc/routine-level-of-parallelism-1.f90 b/gcc/testsuite/gfortran.dg/goacc/routine-level-of-parallelism-1.f90 index 83b8c24..99929f1 100644 --- a/gcc/testsuite/gfortran.dg/goacc/routine-level-of-parallelism-1.f90 +++ b/gcc/testsuite/gfortran.dg/goacc/routine-level-of-parallelism-1.f90 @@ -2,8 +2,14 @@ ! with the OpenACC routine directive. The C/C++ counterpart is ! '../../c-c++-common/goacc/routine-level-of-parallelism-2.c'. +! { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting +! aspects of that functionality. + subroutine g_1 !$acc routine gang + ! { dg-warning "region is gang partitioned but does not contain gang partitioned code" "" { target *-*-* } .-2 } + ! { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .-3 } + ! { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-4 } end subroutine g_1 subroutine s_1_2a diff --git a/gcc/testsuite/gfortran.dg/goacc/routine-module-mod-1.f90 b/gcc/testsuite/gfortran.dg/goacc/routine-module-mod-1.f90 index 23c673f..2210650 100644 --- a/gcc/testsuite/gfortran.dg/goacc/routine-module-mod-1.f90 +++ b/gcc/testsuite/gfortran.dg/goacc/routine-module-mod-1.f90 @@ -2,6 +2,9 @@ ! { dg-additional-options "-fopt-info-optimized-omp" } +! { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting +! aspects of that functionality. + module routine_module_mod_1 contains subroutine s_1 @@ -53,6 +56,7 @@ contains subroutine g_1 implicit none !$acc routine gang + ! { dg-bogus "warning: region is worker partitioned but does not contain worker partitioned code" "TODO default 'gang' 'vector'" { xfail *-*-* } .-3 } integer :: i diff --git a/gcc/testsuite/gfortran.dg/goacc/routine-multiple-directives-1.f90 b/gcc/testsuite/gfortran.dg/goacc/routine-multiple-directives-1.f90 index 6e12ee9..622a9d9 100644 --- a/gcc/testsuite/gfortran.dg/goacc/routine-multiple-directives-1.f90 +++ b/gcc/testsuite/gfortran.dg/goacc/routine-multiple-directives-1.f90 @@ -1,5 +1,8 @@ ! Check for valid cases of multiple OpenACC 'routine' directives. +! { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting +! aspects of that functionality. + SUBROUTINE s_1 !$ACC ROUTINE(s_1) !$ACC ROUTINE(s_1) SEQ @@ -17,12 +20,14 @@ !$ACC ROUTINE VECTOR !$ACC ROUTINE(v_1) VECTOR !$ACC ROUTINE VECTOR +! { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-5 } END SUBROUTINE v_1 SUBROUTINE v_2 !$ACC ROUTINE(v_2) VECTOR !$ACC ROUTINE VECTOR !$ACC ROUTINE(v_2) VECTOR +! { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-4 } END SUBROUTINE v_2 SUBROUTINE sub_1 diff --git a/gcc/testsuite/gfortran.dg/goacc/uninit-dim-clause.f95 b/gcc/testsuite/gfortran.dg/goacc/uninit-dim-clause.f95 index c77d47a..59e923f 100644 --- a/gcc/testsuite/gfortran.dg/goacc/uninit-dim-clause.f95 +++ b/gcc/testsuite/gfortran.dg/goacc/uninit-dim-clause.f95 @@ -1,16 +1,22 @@ ! { dg-additional-options "-Wuninitialized" } +! { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting +! aspects of that functionality. + subroutine acc_parallel implicit none integer :: i, j, k !$acc parallel num_gangs(i) ! { dg-warning "is used uninitialized" } + ! { dg-warning "region is gang partitioned but does not contain gang partitioned code" "" { target *-*-* } .-1 } !$acc end parallel !$acc parallel num_workers(j) ! { dg-warning "is used uninitialized" } + ! { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .-1 } !$acc end parallel !$acc parallel vector_length(k) ! { dg-warning "is used uninitialized" } + ! { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-1 } !$acc end parallel end subroutine acc_parallel -- cgit v1.1 From bf3040836f41f0d719e6ec53820a692c443469d5 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Mon, 26 Apr 2021 12:55:24 +0200 Subject: Add XFAIL for gcc.dg/pr84877.c on the SPARC The maximum supported alignment is 64-bit on 32-bit mode. gcc/testsuite/ * gcc.dg/pr84877.c: XFAIL on SPARC as well. --- gcc/testsuite/gcc.dg/pr84877.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/pr84877.c b/gcc/testsuite/gcc.dg/pr84877.c index 8551d27..234fcd2 100644 --- a/gcc/testsuite/gcc.dg/pr84877.c +++ b/gcc/testsuite/gcc.dg/pr84877.c @@ -1,4 +1,4 @@ -/* { dg-do run { xfail { cris-*-* } } } */ +/* { dg-do run { xfail { cris-*-* sparc*-*-* } } } */ /* { dg-options "-O2" } */ #include -- cgit v1.1 From e9046be4ffa0a941b15315317a90b437f2c1ac28 Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Mon, 26 Apr 2021 11:23:41 +0000 Subject: testsuite/arm: Add arm_cmse_hw effective target Some of the CMSE tests have 'dg-do run', but qemu-arm does not support the privileged instructions involved; one has to use qemu-system-arm for this, which in turn requires modifications to the default newlib/libgloss startup code to enable the FPU as the FP status registers need to be saved when using CMSE code. This patch introduces arm_cmse_hw, similar to arm_neon_hw, to detect whether the execution engine supports the CMSE instructions. If not, we set dg-do-what-default to assemble instead of run. We thus remove all the 'dg-do run' directives from CMSE tests, to rely on dg-do-what-default instead. Note that cmse-16.c used to pass with dg-do run under qemu-arm, because the property being tested is not available (qemu-arm does not model secure vs non-secure memory). The patch removes dg-do from it too, since it is relevant only with an adequate simulator. Before the patch, bitfield-[123].c and struct-1.c fail at execution under qemu-arm. With the patch, execution is skipped. The same tests pass under qemu-system-arm both with and without the patch. This avoids failures when testing with -mthumb/-mfloat-abi=hard/-march=armv8-m.main+fp+dsp under qemu-arm for cortex-m33. I'm also running tests with qemu-system-arm for cortex-m33, but I run only cmse.exp with a patched newlib in this case: I use qemu-arm for all combinations except that one because it's faster and supports semihosting. I do not have a setup to check this with actual hardware or another simulator. 2021-04-26 Christophe Lyon gcc/ * doc/sourcebuild.texi (arm_cmse_hw): Document. gcc/testsuite/ * gcc.target/arm/cmse/bitfield-1.c: Remove dg-do. * gcc.target/arm/cmse/bitfield-2.c: Likewise. * gcc.target/arm/cmse/bitfield-3.c: Likewise. * gcc.target/arm/cmse/cmse-16.c: Likewise. * gcc.target/arm/cmse/struct-1.c: Likewise. * gcc.target/arm/cmse/cmse.exp: Set dg-do-what-default depending on arm_cmse_hw. * lib/target-supports.exp (check_effective_target_arm_cmse_hw): New. --- gcc/testsuite/gcc.target/arm/cmse/bitfield-1.c | 2 +- gcc/testsuite/gcc.target/arm/cmse/bitfield-2.c | 2 +- gcc/testsuite/gcc.target/arm/cmse/bitfield-3.c | 2 +- gcc/testsuite/gcc.target/arm/cmse/cmse-16.c | 6 +++++- gcc/testsuite/gcc.target/arm/cmse/cmse.exp | 7 ++++++- gcc/testsuite/gcc.target/arm/cmse/struct-1.c | 2 +- gcc/testsuite/lib/target-supports.exp | 15 +++++++++++++++ 7 files changed, 30 insertions(+), 6 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/arm/cmse/bitfield-1.c b/gcc/testsuite/gcc.target/arm/cmse/bitfield-1.c index cae2f06..5685f74 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/bitfield-1.c +++ b/gcc/testsuite/gcc.target/arm/cmse/bitfield-1.c @@ -1,4 +1,4 @@ -/* { dg-do run } */ +/* This test is executed only if the execution engine supports CMSE instructions. */ /* { dg-options "--save-temps -mcmse -Wl,--section-start,.gnu.sgstubs=0x00400000" } */ typedef struct diff --git a/gcc/testsuite/gcc.target/arm/cmse/bitfield-2.c b/gcc/testsuite/gcc.target/arm/cmse/bitfield-2.c index 21a53cd..7a794d4 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/bitfield-2.c +++ b/gcc/testsuite/gcc.target/arm/cmse/bitfield-2.c @@ -1,4 +1,4 @@ -/* { dg-do run } */ +/* This test is executed only if the execution engine supports CMSE instructions. */ /* { dg-options "--save-temps -mcmse -Wl,--section-start,.gnu.sgstubs=0x00400000" } */ typedef struct diff --git a/gcc/testsuite/gcc.target/arm/cmse/bitfield-3.c b/gcc/testsuite/gcc.target/arm/cmse/bitfield-3.c index e8f973e..5875f8df 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/bitfield-3.c +++ b/gcc/testsuite/gcc.target/arm/cmse/bitfield-3.c @@ -1,4 +1,4 @@ -/* { dg-do run } */ +/* This test is executed only if the execution engine supports CMSE instructions. */ /* { dg-options "--save-temps -mcmse -Wl,--section-start,.gnu.sgstubs=0x00400000" } */ typedef struct diff --git a/gcc/testsuite/gcc.target/arm/cmse/cmse-16.c b/gcc/testsuite/gcc.target/arm/cmse/cmse-16.c index 3fb0380..6a243d5 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/cmse-16.c +++ b/gcc/testsuite/gcc.target/arm/cmse/cmse-16.c @@ -1,4 +1,8 @@ -/* { dg-do run } */ +/* This test is executed only if the execution engine supports CMSE instructions. */ +/* Note that it "passes" on qemu-arm while it shouldn't because that simulator + does not model secure memory: it's better to skip it in this case, and rely + on do-what-default as set in cmse.exp. (It works as expected with + qemu-system-mode). */ /* { dg-options "-Os -mcmse" } */ #include diff --git a/gcc/testsuite/gcc.target/arm/cmse/cmse.exp b/gcc/testsuite/gcc.target/arm/cmse/cmse.exp index 6ce99fe..4da1a46 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/cmse.exp +++ b/gcc/testsuite/gcc.target/arm/cmse/cmse.exp @@ -34,7 +34,12 @@ if ![info exists DEFAULT_CFLAGS] then { dg-init set saved-dg-do-what-default ${dg-do-what-default} -set dg-do-what-default "assemble" + +if {[is-effective-target arm_cmse_hw]} then { + set dg-do-what-default run +} else { + set dg-do-what-default assemble +} set saved-lto_torture_options ${LTO_TORTURE_OPTIONS} set LTO_TORTURE_OPTIONS "" diff --git a/gcc/testsuite/gcc.target/arm/cmse/struct-1.c b/gcc/testsuite/gcc.target/arm/cmse/struct-1.c index 7555643..75a99f4 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/struct-1.c +++ b/gcc/testsuite/gcc.target/arm/cmse/struct-1.c @@ -1,4 +1,4 @@ -/* { dg-do run } */ +/* This test is executed only if the execution engine supports CMSE instructions. */ /* { dg-options "--save-temps -mcmse -Wl,--section-start,.gnu.sgstubs=0x00400000" } */ typedef struct diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index ad32310..a522da3 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -4861,6 +4861,21 @@ proc check_effective_target_arm_cmse_ok {} { } "-mcmse"]; } +# Return 1 if the target supports executing CMSE instructions, 0 +# otherwise. Cache the result. + +proc check_effective_target_arm_cmse_hw { } { + return [check_runtime arm_cmse_hw_available { + int __attribute__ ((cmse_nonsecure_entry)) ns_func(void) + { + return 0; + } + int main (void) + { + return ns_func(); + } + } "-mcmse -Wl,--section-start,.gnu.sgstubs=0x00400000"] +} # Return 1 if the target supports executing MVE instructions, 0 # otherwise. -- cgit v1.1 From 6ff66d1ea48960fe96bb51a750c01135e65fe452 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 7 Apr 2021 14:53:40 +0200 Subject: tree-optimization/99956 - improve loop interchange When we apply store motion and DSE manually to the bwaves kernel in gfortran.dg/pr81303.f loop interchange no longer happens because the perfect nest considered covers outer loops we cannot analyze strides for. The following compensates for this by shrinking the nest in this analysis which was already possible but on a too coarse granularity. It shares the shrinked nest with the rest of the DRs so the complexity overhead should be negligible. 2021-04-07 Richard Biener PR tree-optimization/99956 * gimple-loop-interchange.cc (compute_access_stride): Try instantiating the access in a shallower loop nest if instantiating failed. (compute_access_strides): Pass adjustable loop_nest to compute_access_stride. * gfortran.dg/pr99956.f: New testcase. --- gcc/testsuite/gfortran.dg/pr99956.f | 45 +++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/pr99956.f (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gfortran.dg/pr99956.f b/gcc/testsuite/gfortran.dg/pr99956.f new file mode 100644 index 0000000..b5c0be3 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr99956.f @@ -0,0 +1,45 @@ +! { dg-do compile } +! { dg-options "-O3 -ffast-math -floop-interchange -fdump-tree-linterchange-details" } + + subroutine mat_times_vec(y,x,a,axp,ayp,azp,axm,aym,azm, + $ nb,nx,ny,nz) + implicit none + integer nb,nx,ny,nz,i,j,k,m,l,kit,im1,ip1,jm1,jp1,km1,kp1 + + real*8 y(nb,nx,ny,nz),x(nb,nx,ny,nz),tem + + real*8 a(nb,nb,nx,ny,nz), + 1 axp(nb,nb,nx,ny,nz),ayp(nb,nb,nx,ny,nz),azp(nb,nb,nx,ny,nz), + 2 axm(nb,nb,nx,ny,nz),aym(nb,nb,nx,ny,nz),azm(nb,nb,nx,ny,nz) + + + do k=1,nz + km1=mod(k+nz-2,nz)+1 + kp1=mod(k,nz)+1 + do j=1,ny + jm1=mod(j+ny-2,ny)+1 + jp1=mod(j,ny)+1 + do i=1,nx + im1=mod(i+nx-2,nx)+1 + ip1=mod(i,nx)+1 + do l=1,nb + tem=0.0 + do m=1,nb + tem=tem+ + 1 a(l,m,i,j,k)*x(m,i,j,k)+ + 2 axp(l,m,i,j,k)*x(m,ip1,j,k)+ + 3 ayp(l,m,i,j,k)*x(m,i,jp1,k)+ + 4 azp(l,m,i,j,k)*x(m,i,j,kp1)+ + 5 axm(l,m,i,j,k)*x(m,im1,j,k)+ + 6 aym(l,m,i,j,k)*x(m,i,jm1,k)+ + 7 azm(l,m,i,j,k)*x(m,i,j,km1) + enddo + y(l,i,j,k)=tem + enddo + enddo + enddo + enddo + return + end + +! { dg-final { scan-tree-dump-times "is interchanged" 1 "linterchange" } } -- cgit v1.1 From 5a26ba75de623f75fb44cddc2a9c982d31c96213 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Mon, 26 Apr 2021 21:57:31 +0200 Subject: OpenACC: Fix pattern in dg-bogus in Fortran testcases libgomp/ChangeLog: * testsuite/libgomp.oacc-fortran/par-reduction-2-1.f: Correct spelling in dg-bogus to match -Wopenacc-parallelism. * testsuite/libgomp.oacc-fortran/par-reduction-2-2.f: Likewise. * testsuite/libgomp.oacc-fortran/parallel-dims.f90: Likewise. * testsuite/libgomp.oacc-fortran/parallel-reduction.f90: Likewise. gcc/testsuite/ChangeLog: * gfortran.dg/goacc/classify-serial.f95: Correct spelling in dg-bogus to match -Wopenacc-parallelism. * gfortran.dg/goacc/kernels-decompose-2.f95: Likewise. * gfortran.dg/goacc/routine-module-mod-1.f90: Likewise. --- gcc/testsuite/gfortran.dg/goacc/classify-serial.f95 | 6 +++--- gcc/testsuite/gfortran.dg/goacc/kernels-decompose-2.f95 | 2 +- gcc/testsuite/gfortran.dg/goacc/routine-module-mod-1.f90 | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gfortran.dg/goacc/classify-serial.f95 b/gcc/testsuite/gfortran.dg/goacc/classify-serial.f95 index 6d402e6..386b95e 100644 --- a/gcc/testsuite/gfortran.dg/goacc/classify-serial.f95 +++ b/gcc/testsuite/gfortran.dg/goacc/classify-serial.f95 @@ -18,9 +18,9 @@ program main call setup(a, b) !$acc serial loop copyin (a(0:n-1), b(0:n-1)) copyout (c(0:n-1)) ! { dg-message "optimized: assigned OpenACC gang vector loop parallelism" } - ! { dg-bogus "warning: region contains gang partitioned code but is not gang partitioned" "TODO 'serial'" { xfail *-*-* } .-1 } - ! { dg-bogus "warning: region contains worker partitioned code but is not worker partitioned" "" { target *-*-* } .-2 } - ! { dg-bogus "warning: region contains vector partitioned code but is not vector partitioned" "TODO 'serial'" { xfail *-*-* } .-3 } + ! { dg-bogus "Warning: region contains gang partitioned code but is not gang partitioned" "TODO 'serial'" { xfail *-*-* } .-1 } + ! { dg-bogus "Warning: region contains worker partitioned code but is not worker partitioned" "" { target *-*-* } .-2 } + ! { dg-bogus "Warning: region contains vector partitioned code but is not vector partitioned" "TODO 'serial'" { xfail *-*-* } .-3 } do i = 0, n - 1 c(i) = a(i) + b(i) end do diff --git a/gcc/testsuite/gfortran.dg/goacc/kernels-decompose-2.f95 b/gcc/testsuite/gfortran.dg/goacc/kernels-decompose-2.f95 index a3cec83..1277ad9 100644 --- a/gcc/testsuite/gfortran.dg/goacc/kernels-decompose-2.f95 +++ b/gcc/testsuite/gfortran.dg/goacc/kernels-decompose-2.f95 @@ -122,7 +122,7 @@ program main !$acc end kernels !$acc kernels - ! { dg-bogus "warning: region contains gang partitioned code but is not gang partitioned" "TODO 'kernels'" { xfail *-*-* } .-1 } + ! { dg-bogus "Warning: region contains gang partitioned code but is not gang partitioned" "TODO 'kernels'" { xfail *-*-* } .-1 } y = f_g (a(5)) ! { dg-line l_part[incr c_part] } !TODO If such a construct is placed in its own part (like it is, here), can't this actually use gang paralelism, instead of "gang-single"? ! { dg-message "note: beginning 'gang-single' part in OpenACC 'kernels' region" "" { target *-*-* } l_part$c_part } diff --git a/gcc/testsuite/gfortran.dg/goacc/routine-module-mod-1.f90 b/gcc/testsuite/gfortran.dg/goacc/routine-module-mod-1.f90 index 2210650..198ae01 100644 --- a/gcc/testsuite/gfortran.dg/goacc/routine-module-mod-1.f90 +++ b/gcc/testsuite/gfortran.dg/goacc/routine-module-mod-1.f90 @@ -56,7 +56,7 @@ contains subroutine g_1 implicit none !$acc routine gang - ! { dg-bogus "warning: region is worker partitioned but does not contain worker partitioned code" "TODO default 'gang' 'vector'" { xfail *-*-* } .-3 } + ! { dg-bogus "Warning: region is worker partitioned but does not contain worker partitioned code" "TODO default 'gang' 'vector'" { xfail *-*-* } .-3 } integer :: i -- cgit v1.1 From bd7ebe9da745a62184052dd1b15f4dd10fbdc9f4 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Mon, 26 Apr 2021 22:59:21 +0200 Subject: OpenACC: Fix pattern in dg-bogus in Fortran testcases again It turned out that a compiler built without offloading support and one with can produce slightly different diagnostic. Offloading support implies ENABLE_OFFLOAD which implies that g->have_offload is set when offloading is actually needed. In cgraphunit.c, the latter causes flag_generate_offload = 1, which in turn affects tree.c's free_lang_data. The result is that the front-end specific diagnostic gets reset ('tree_diagnostics_defaults (global_dc)'), which affects in this case 'Warning' vs. 'warning' via the Fortran frontend. Result: 'Warning:' vs. 'warning:'. Side note: Other FE also override the diagnostic, leading to similar differences, e.g. the C++ FE outputs mangled function names differently, cf. patch thread. libgomp/ChangeLog: * testsuite/libgomp.oacc-fortran/par-reduction-2-1.f: Use [Ww]arning in dg-bogus as FE diagnostic and default diagnostic differ and the result depends on ENABLE_OFFLOAD. * testsuite/libgomp.oacc-fortran/par-reduction-2-2.f: Likewise. * testsuite/libgomp.oacc-fortran/parallel-dims.f90: Likewise. * testsuite/libgomp.oacc-fortran/parallel-reduction.f90: Likewise. gcc/testsuite/ChangeLog: * gfortran.dg/goacc/classify-serial.f95: Use [Ww]arning in dg-bogus as FE diagnostic and default diagnostic differ and the result depends on ENABLE_OFFLOAD. * gfortran.dg/goacc/kernels-decompose-2.f95: Likewise. * gfortran.dg/goacc/routine-module-mod-1.f90: Likewise. --- gcc/testsuite/gfortran.dg/goacc/classify-serial.f95 | 6 +++--- gcc/testsuite/gfortran.dg/goacc/kernels-decompose-2.f95 | 2 +- gcc/testsuite/gfortran.dg/goacc/routine-module-mod-1.f90 | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gfortran.dg/goacc/classify-serial.f95 b/gcc/testsuite/gfortran.dg/goacc/classify-serial.f95 index 386b95e..6dcb1b1 100644 --- a/gcc/testsuite/gfortran.dg/goacc/classify-serial.f95 +++ b/gcc/testsuite/gfortran.dg/goacc/classify-serial.f95 @@ -18,9 +18,9 @@ program main call setup(a, b) !$acc serial loop copyin (a(0:n-1), b(0:n-1)) copyout (c(0:n-1)) ! { dg-message "optimized: assigned OpenACC gang vector loop parallelism" } - ! { dg-bogus "Warning: region contains gang partitioned code but is not gang partitioned" "TODO 'serial'" { xfail *-*-* } .-1 } - ! { dg-bogus "Warning: region contains worker partitioned code but is not worker partitioned" "" { target *-*-* } .-2 } - ! { dg-bogus "Warning: region contains vector partitioned code but is not vector partitioned" "TODO 'serial'" { xfail *-*-* } .-3 } + ! { dg-bogus "\[Ww\]arning: region contains gang partitioned code but is not gang partitioned" "TODO 'serial'" { xfail *-*-* } .-1 } + ! { dg-bogus "\[Ww\]arning: region contains worker partitioned code but is not worker partitioned" "" { target *-*-* } .-2 } + ! { dg-bogus "\[Ww\]arning: region contains vector partitioned code but is not vector partitioned" "TODO 'serial'" { xfail *-*-* } .-3 } do i = 0, n - 1 c(i) = a(i) + b(i) end do diff --git a/gcc/testsuite/gfortran.dg/goacc/kernels-decompose-2.f95 b/gcc/testsuite/gfortran.dg/goacc/kernels-decompose-2.f95 index 1277ad9..238482b 100644 --- a/gcc/testsuite/gfortran.dg/goacc/kernels-decompose-2.f95 +++ b/gcc/testsuite/gfortran.dg/goacc/kernels-decompose-2.f95 @@ -122,7 +122,7 @@ program main !$acc end kernels !$acc kernels - ! { dg-bogus "Warning: region contains gang partitioned code but is not gang partitioned" "TODO 'kernels'" { xfail *-*-* } .-1 } + ! { dg-bogus "\[Ww\]arning: region contains gang partitioned code but is not gang partitioned" "TODO 'kernels'" { xfail *-*-* } .-1 } y = f_g (a(5)) ! { dg-line l_part[incr c_part] } !TODO If such a construct is placed in its own part (like it is, here), can't this actually use gang paralelism, instead of "gang-single"? ! { dg-message "note: beginning 'gang-single' part in OpenACC 'kernels' region" "" { target *-*-* } l_part$c_part } diff --git a/gcc/testsuite/gfortran.dg/goacc/routine-module-mod-1.f90 b/gcc/testsuite/gfortran.dg/goacc/routine-module-mod-1.f90 index 198ae01..835619c 100644 --- a/gcc/testsuite/gfortran.dg/goacc/routine-module-mod-1.f90 +++ b/gcc/testsuite/gfortran.dg/goacc/routine-module-mod-1.f90 @@ -56,7 +56,7 @@ contains subroutine g_1 implicit none !$acc routine gang - ! { dg-bogus "Warning: region is worker partitioned but does not contain worker partitioned code" "TODO default 'gang' 'vector'" { xfail *-*-* } .-3 } + ! { dg-bogus "\[Ww\]arning: region is worker partitioned but does not contain worker partitioned code" "TODO default 'gang' 'vector'" { xfail *-*-* } .-3 } integer :: i -- cgit v1.1 From 0120cd9382728fdc99d4cfdcb72cd0f55aca2ce3 Mon Sep 17 00:00:00 2001 From: Patrick Palka Date: Mon, 26 Apr 2021 17:30:39 -0400 Subject: c++: constexpr pointer indirection with negative offset [PR100209] During constexpr evaluation, a base-to-derived conversion may yield an expression like (Derived*)(&D.2217.D.2106 p+ -4) where D.2217 is the derived object and D.2106 is the base. But cxx_fold_indirect_ref doesn't know how to resolve an INDIRECT_REF thereof to just D.2217, because it doesn't handle POINTER_PLUS_EXPR of a COMPONENT_REF with negative offset well: when the offset N is positive, it knows that '&x p+ N' is equivalent to '&x.f p+ (N - bytepos(f))', but it doesn't know about the reverse transformation, that '&x.f p+ N' is equivalent to '&x p+ (N + bytepos(f))' when N is negative, which is important for resolving such base-to-derived conversions and for accessing subobjects backwards. This patch teaches cxx_fold_indirect_ref this reverse transformation. gcc/cp/ChangeLog: PR c++/100209 * constexpr.c (cxx_fold_indirect_ref): Try to canonicalize the object/offset pair for a POINTER_PLUS_EXPR of a COMPONENT_REF with a negative offset into one whose offset is nonnegative before calling cxx_fold_indirect_ref_1. gcc/testsuite/ChangeLog: PR c++/100209 * g++.dg/cpp1y/constexpr-base1.C: New test. * g++.dg/cpp1y/constexpr-ptrsub1.C: New test. --- gcc/testsuite/g++.dg/cpp1y/constexpr-base1.C | 28 ++++++++++++++++++++++++++ gcc/testsuite/g++.dg/cpp1y/constexpr-ptrsub1.C | 23 +++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1y/constexpr-base1.C create mode 100644 gcc/testsuite/g++.dg/cpp1y/constexpr-ptrsub1.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-base1.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-base1.C new file mode 100644 index 0000000..3c93aa8 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-base1.C @@ -0,0 +1,28 @@ +// PR c++/100209 +// { dg-do compile { target c++14 } } + +template +struct __a_t +{ + unsigned char A = 0; + constexpr Derived & SetA(const unsigned char & value) { + A = value; + return *static_cast(this); + } +}; + +template +struct __b_t +{ + unsigned char B = 0; + constexpr Derived & SetB(const unsigned char & value) { + B = value; + return *static_cast(this); + } +}; + +struct __ab_t : __a_t<__ab_t>, __b_t<__ab_t> { }; + +constexpr auto AB = __ab_t().SetA(100).SetB(10); +static_assert(AB.A == 100, ""); +static_assert(AB.B == 10, ""); diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-ptrsub1.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-ptrsub1.C new file mode 100644 index 0000000..d6cb6ad --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-ptrsub1.C @@ -0,0 +1,23 @@ +// PR c++/100209 +// { dg-do compile { target c++14 } } + +struct A { + int x = 1; +}; + +struct B : A { + int y = 2; + int z = 3; + int w = 4; +}; + +constexpr bool f() { + B b; + if (&b.w - &b.x != 3) + /* Effectively disable this test if the layout of B isn't + what we expect. */ + return true; + const int* w = &b.w; + return *w-- == 4 && *w-- == 3 && *w-- == 2 && *w-- == 1; +} +static_assert(f(), ""); -- cgit v1.1 From c0fa3f2fb365144b3a059920aeaf6ff37db1177d Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 27 Apr 2021 00:16:30 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 83 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c79adfd..26c41ac 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,86 @@ +2021-04-26 Patrick Palka + + PR c++/100209 + * g++.dg/cpp1y/constexpr-base1.C: New test. + * g++.dg/cpp1y/constexpr-ptrsub1.C: New test. + +2021-04-26 Tobias Burnus + + * gfortran.dg/goacc/classify-serial.f95: + Use [Ww]arning in dg-bogus as FE diagnostic and default + diagnostic differ and the result depends on ENABLE_OFFLOAD. + * gfortran.dg/goacc/kernels-decompose-2.f95: Likewise. + * gfortran.dg/goacc/routine-module-mod-1.f90: Likewise. + +2021-04-26 Tobias Burnus + + * gfortran.dg/goacc/classify-serial.f95: + Correct spelling in dg-bogus to match -Wopenacc-parallelism. + * gfortran.dg/goacc/kernels-decompose-2.f95: Likewise. + * gfortran.dg/goacc/routine-module-mod-1.f90: Likewise. + +2021-04-26 Richard Biener + + PR tree-optimization/99956 + * gfortran.dg/pr99956.f: New testcase. + +2021-04-26 Christophe Lyon + + * gcc.target/arm/cmse/bitfield-1.c: Remove dg-do. + * gcc.target/arm/cmse/bitfield-2.c: Likewise. + * gcc.target/arm/cmse/bitfield-3.c: Likewise. + * gcc.target/arm/cmse/cmse-16.c: Likewise. + * gcc.target/arm/cmse/struct-1.c: Likewise. + * gcc.target/arm/cmse/cmse.exp: Set dg-do-what-default depending + on arm_cmse_hw. + * lib/target-supports.exp (check_effective_target_arm_cmse_hw): + New. + +2021-04-26 Eric Botcazou + + * gcc.dg/pr84877.c: XFAIL on SPARC as well. + +2021-04-26 Thomas Schwinge + Nathan Sidwell + Tom de Vries + Julian Brown + Kwok Cheung Yeung + + * c-c++-common/goacc/diag-parallelism-1.c: New. + * c-c++-common/goacc/acc-icf.c: Specify '-Wopenacc-parallelism', + and match diagnostics, as appropriate. + * c-c++-common/goacc/classify-kernels-unparallelized.c: Likewise. + * c-c++-common/goacc/classify-kernels.c: Likewise. + * c-c++-common/goacc/classify-parallel.c: Likewise. + * c-c++-common/goacc/classify-routine.c: Likewise. + * c-c++-common/goacc/classify-serial.c: Likewise. + * c-c++-common/goacc/kernels-decompose-1.c: Likewise. + * c-c++-common/goacc/kernels-decompose-2.c: Likewise. + * c-c++-common/goacc/parallel-dims-1.c: Likewise. + * c-c++-common/goacc/parallel-reduction.c: Likewise. + * c-c++-common/goacc/pr70688.c: Likewise. + * c-c++-common/goacc/routine-1.c: Likewise. + * c-c++-common/goacc/routine-level-of-parallelism-2.c: Likewise. + * c-c++-common/goacc/uninit-dim-clause.c: Likewise. + * gfortran.dg/goacc/classify-kernels-unparallelized.f95: Likewise. + * gfortran.dg/goacc/classify-kernels.f95: Likewise. + * gfortran.dg/goacc/classify-parallel.f95: Likewise. + * gfortran.dg/goacc/classify-routine.f95: Likewise. + * gfortran.dg/goacc/classify-serial.f95: Likewise. + * gfortran.dg/goacc/kernels-decompose-1.f95: Likewise. + * gfortran.dg/goacc/kernels-decompose-2.f95: Likewise. + * gfortran.dg/goacc/parallel-tree.f95: Likewise. + * gfortran.dg/goacc/routine-4.f90: Likewise. + * gfortran.dg/goacc/routine-level-of-parallelism-1.f90: Likewise. + * gfortran.dg/goacc/routine-module-mod-1.f90: Likewise. + * gfortran.dg/goacc/routine-multiple-directives-1.f90: Likewise. + * gfortran.dg/goacc/uninit-dim-clause.f95: Likewise. + +2021-04-26 Richard Biener + + PR tree-optimization/99473 + * gcc.dg/tree-ssa/pr99473-1.c: New testcase. + 2021-04-25 liuhongt PR target/98911 -- cgit v1.1 From 7d6bb80931b429631f63e0fd27bee95f32eb57a9 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Fri, 26 Mar 2021 09:50:03 +0100 Subject: tree-optimization/99776 - relax condition on vector ctor element extract This relaxes the condition for the match.pd pattern doing vector ctor element extracts to not require type identity but only size equality. Since we vectorize pointer data as unsigned integer data such mismatches have to be tolerated to optimize scalar code uses of vector results. 2021-03-26 Richard Biener PR tree-optimization/99776 * match.pd (bit_field_ref (ctor)): Relax element extract type compatibility checks. * gcc.dg/tree-ssa/ssa-fre-91.c: New testcase. --- gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-91.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-91.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-91.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-91.c new file mode 100644 index 0000000..4999a3b --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-91.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -fdump-tree-fre4" } */ + +extern void foo(void); + +static int a[2], b, *c[2]; + +int main() { + for (b = 0; b < 2; b++) + c[b] = &a[1]; + if (!c[0]) + foo(); + return 0; +} + +/* Even when vectorizing we should eliminate the call to foo. */ +/* { dg-final { scan-tree-dump-not "foo" "fre4" } } */ -- cgit v1.1 From 71c8aaf29bb122ebe5e67c84903fd23ff05f04ec Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 27 Apr 2021 10:17:45 +0200 Subject: i386: Improve [QH]Imode rotates with masked shift count [PR99405] The following testcase shows that while we nicely optimize away the useless and? of shift count before rotation for [SD]Imode rotates, we don't do that for [QH]Imode. The following patch optimizes that by using the right iterator on those 4 patterns. 2021-04-27 Jakub Jelinek PR target/99405 * config/i386/i386.md (*3_mask, *3_mask_1): For any_rotate define_insn_split and following splitters, use SWI iterator instead of SWI48. * gcc.target/i386/pr99405.c: New test. --- gcc/testsuite/gcc.target/i386/pr99405.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr99405.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/i386/pr99405.c b/gcc/testsuite/gcc.target/i386/pr99405.c new file mode 100644 index 0000000..f3f49e3 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr99405.c @@ -0,0 +1,23 @@ +/* PR target/99405 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -mtune=generic -fomit-frame-pointer" } */ +/* { dg-final { scan-assembler-not "\tand\[bl]\t\\\$" } } */ + +unsigned char f1 (unsigned char x, unsigned y) { return (x << (y & 7)) | (x >> (-y & 7)); } +unsigned short f2 (unsigned short x, unsigned y) { return (x << (y & 15)) | (x >> (-y & 15)); } +unsigned int f3 (unsigned int x, unsigned y) { return (x << (y & 31)) | (x >> (-y & 31)); } +unsigned char f4 (unsigned char x, unsigned y) { return (x >> (y & 7)) | (x << (-y & 7)); } +unsigned short f5 (unsigned short x, unsigned y) { return (x >> (y & 15)) | (x << (-y & 15)); } +unsigned int f6 (unsigned int x, unsigned y) { return (x >> (y & 31)) | (x << (-y & 31)); } +unsigned char f7 (unsigned char x, unsigned char y) { unsigned char v = y & 7; unsigned char w = -y & 7; return (x << v) | (x >> w); } +unsigned short f8 (unsigned short x, unsigned char y) { unsigned char v = y & 15; unsigned char w = -y & 15; return (x << v) | (x >> w); } +unsigned int f9 (unsigned int x, unsigned char y) { unsigned char v = y & 31; unsigned char w = -y & 31; return (x << v) | (x >> w); } +unsigned char f10 (unsigned char x, unsigned char y) { unsigned char v = y & 7; unsigned char w = -y & 7; return (x >> v) | (x << w); } +unsigned short f11 (unsigned short x, unsigned char y) { unsigned char v = y & 15; unsigned char w = -y & 15; return (x >> v) | (x << w); } +unsigned int f12 (unsigned int x, unsigned char y) { unsigned char v = y & 31; unsigned char w = -y & 31; return (x >> v) | (x << w); } +#ifdef __x86_64__ +unsigned long long f13 (unsigned long long x, unsigned y) { return (x << (y & 63)) | (x >> (-y & 63)); } +unsigned long long f14 (unsigned long long x, unsigned y) { return (x >> (y & 63)) | (x << (-y & 63)); } +unsigned long long f15 (unsigned long long x, unsigned char y) { unsigned char v = y & 63; unsigned char w = -y & 63; return (x << v) | (x >> w); } +unsigned long long f16 (unsigned long long x, unsigned char y) { unsigned char v = y & 63; unsigned char w = -y & 63; return (x >> v) | (x << w); } +#endif -- cgit v1.1 From acfe5290406cc70485df8899d14982278a9371f8 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 27 Apr 2021 09:41:38 +0200 Subject: tree-optimization/100278 - handle mismatched code in TBAA adjust of PRE PRE has code to adjust TBAA behavior for refs that expects the base operation code to match. The testcase shows a case where we have a VAR_DECL vs. a MEM_REF so add code to give up in such cases. 2021-04-27 Richard Biener PR tree-optimization/100278 * tree-ssa-pre.c (compute_avail): Give up when we cannot adjust TBAA beacuse of mismatching bases. * gcc.dg/tree-ssa/pr100278.c: New testcase. --- gcc/testsuite/gcc.dg/tree-ssa/pr100278.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr100278.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr100278.c b/gcc/testsuite/gcc.dg/tree-ssa/pr100278.c new file mode 100644 index 0000000..8d70228 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr100278.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +void a() +{ +#if defined __s390__ + register int b asm("r5"); +#elif defined __x86_64__ + register int b asm("eax"); +#else + volatile int b; +#endif + if (b) + b = 1; + for (; b;) + ; +} -- cgit v1.1 From 3bc0d418a5d214a8ba57857656ca5c618df1a4bb Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 27 Apr 2021 10:45:32 +0200 Subject: testsuite/100272 - fix some malformed dg directives The bug points out several malformed dg directives, the following fixes the obvious ones where the testcases keep working after the change. 2021-04-27 Richard Biener PR testsuite/100272 * g++.dg/diagnostic/ptrtomem1.C: Fix dg directives. * g++.dg/ipa/pr45572-2.C: Likewise. * g++.dg/template/spec26.C: Likewise. * gcc.dg/pr20126.c: Likewise. * gcc.dg/tree-ssa/pr20739.c: Likewise. --- gcc/testsuite/g++.dg/diagnostic/ptrtomem1.C | 2 +- gcc/testsuite/g++.dg/ipa/pr45572-2.C | 2 +- gcc/testsuite/g++.dg/template/spec26.C | 2 +- gcc/testsuite/gcc.dg/pr20126.c | 4 ++-- gcc/testsuite/gcc.dg/tree-ssa/pr20739.c | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/diagnostic/ptrtomem1.C b/gcc/testsuite/g++.dg/diagnostic/ptrtomem1.C index bb1327f..9f9b77a 100644 --- a/gcc/testsuite/g++.dg/diagnostic/ptrtomem1.C +++ b/gcc/testsuite/g++.dg/diagnostic/ptrtomem1.C @@ -19,7 +19,7 @@ void f2(T) { } template -requires (sizeof(T)==1) // dg-message {\[with T = int \(X::\*\)\[5\]\]} } +requires (sizeof(T)==1) // { dg-message {\[with T = int \(X::\*\)\[5\]\]} } void f3(T) { } diff --git a/gcc/testsuite/g++.dg/ipa/pr45572-2.C b/gcc/testsuite/g++.dg/ipa/pr45572-2.C index 8b583d9..9bf49ac 100644 --- a/gcc/testsuite/g++.dg/ipa/pr45572-2.C +++ b/gcc/testsuite/g++.dg/ipa/pr45572-2.C @@ -1,5 +1,5 @@ // { dg-do compile } -// { dg-options "-finline-small-functions -findirect-inlining -finline-function+ +// { dg-options "-finline-small-functions -findirect-inlining -finline-functions -O" } typedef struct {} __mpf_struct; typedef __mpf_struct mpf_t[1]; diff --git a/gcc/testsuite/g++.dg/template/spec26.C b/gcc/testsuite/g++.dg/template/spec26.C index 3d18707..fad8e3e 100644 --- a/gcc/testsuite/g++.dg/template/spec26.C +++ b/gcc/testsuite/g++.dg/template/spec26.C @@ -1,4 +1,4 @@ -// dg-do run +// { dg-do run } // Copyright (C) 2005 Free Software Foundation, Inc. // Contributed by Nathan Sidwell 16 Sep 2005 diff --git a/gcc/testsuite/gcc.dg/pr20126.c b/gcc/testsuite/gcc.dg/pr20126.c index 257832a..a421ce1 100644 --- a/gcc/testsuite/gcc.dg/pr20126.c +++ b/gcc/testsuite/gcc.dg/pr20126.c @@ -1,5 +1,5 @@ -/* dg-do run */ -/* dg-options "-O2" */ +/* { dg-do run } */ +/* { dg-options "-O2" } */ /* PR target/20126 was not really target-specific, but rather a loop's failure to take into account the possibility that a DEST_ADDR giv diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr20739.c b/gcc/testsuite/gcc.dg/tree-ssa/pr20739.c index c1e7b58..d7fff14 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr20739.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr20739.c @@ -1,7 +1,7 @@ /* PR middle-end/20739 */ -/* dg-do compile */ -/* dg-options "-O" */ +/* { dg-do compile } */ +/* { dg-options "-O" } */ /* We used to fail to compile this because gimplification dropped the conversion that added the const qualifier to the sub-expression -- cgit v1.1 From dfdc02bf29670c1c7f5f2820b6db11c66c258716 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 27 Apr 2021 11:02:03 +0200 Subject: testsuite/100272 - undo PRE disabling for gcc.dg/tree-ssa/predcom-1.c This re-enables PRE and fixes the malformed dg directive pointed out in the PR. It all works as desired and I forgot why I disabled this in the past. 2021-04-27 Richard Biener PR testsuite/100272 * gcc.dg/tree-ssa/predcom-1.c: Re-enable PRE and fix malformed dg directive. --- gcc/testsuite/gcc.dg/tree-ssa/predcom-1.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/tree-ssa/predcom-1.c b/gcc/testsuite/gcc.dg/tree-ssa/predcom-1.c index 4bc2ea5..f68be2b 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/predcom-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/predcom-1.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-do run } */ -/* { dg-options "-O2 -funroll-loops --param max-unroll-times=8 -fpredictive-commoning -fdump-tree-pcom-details -fno-tree-pre" } */ +/* { dg-options "-O2 -funroll-loops --param max-unroll-times=8 -fpredictive-commoning -fdump-tree-pcom-details" } */ void abort (void); @@ -45,6 +45,5 @@ int main(void) /* Verify that both loops were transformed and unrolled. */ /* { dg-final { scan-tree-dump-times "Unrolling 2 times." 2 "pcom"} } */ -/* Also check that we undid the transformation previously made by PRE. - ??? PRE now does the predictive commoning in count_averages. */ -/* dg-final { scan-tree-dump-times "looparound ref" 1 "pcom" } */ +/* Also check that we undid the transformation previously made by PRE. */ +/* { dg-final { scan-tree-dump-times "looparound ref" 1 "pcom" } } */ -- cgit v1.1 From d1d01a66012a93cc8cb7dafbe1b5ec453ec96b59 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 13 Apr 2021 10:12:03 +0200 Subject: tree-optimization/100051 - disambiguate access size vs decl This adds disambiguation of the access size vs. the decl size in the pointer based vs. decl based disambiguator. We have a TBAA based check like this already but that's fend off when seeing alias-sets of zero or when -fno-strict-aliasing is in effect. Also the perceived dynamic type could be smaller than the actual access. 2021-04-13 Richard Biener PR tree-optimization/100051 * tree-ssa-alias.c (indirect_ref_may_alias_decl_p): Add disambiguator based on access size vs. decl size. * gcc.dg/tree-ssa/ssa-fre-92.c: New testcase. --- gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-92.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-92.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-92.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-92.c new file mode 100644 index 0000000..c67fcea --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-92.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-fre1" } */ + +extern void foo(void); +int a, c, *f, **d = &f; +char b; +int main() +{ + if (a) { + b = 0; + int *g = &c; + *g = 0; + f = *d; + *d = f; + if ((2 ^ b) == 0) + foo(); + } + return 0; +} + +/* { dg-final { scan-tree-dump-not "foo" "fre1" } } */ -- cgit v1.1 From 48d88cde0307aaba46f538359123c38f70052bd2 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Tue, 27 Apr 2021 12:18:02 +0100 Subject: aarch64: Add +nosve to two tests Adding +nosve is more robust than checking for command-line arguments, since SVE can be enabled by default or indirectly via other options. gcc/testsuite/ * gcc.target/aarch64/simd/ssra.c: Use +nosve * gcc.target/aarch64/simd/usra.c: Likewise. --- gcc/testsuite/gcc.target/aarch64/simd/ssra.c | 3 ++- gcc/testsuite/gcc.target/aarch64/simd/usra.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/aarch64/simd/ssra.c b/gcc/testsuite/gcc.target/aarch64/simd/ssra.c index e9c2e04..bd6b6bf 100644 --- a/gcc/testsuite/gcc.target/aarch64/simd/ssra.c +++ b/gcc/testsuite/gcc.target/aarch64/simd/ssra.c @@ -1,6 +1,7 @@ /* { dg-do compile { target aarch64*-*-* } } */ /* { dg-options "-O3" } */ -/* { dg-skip-if "" { *-*-* } {"*sve*"} {""} } */ + +#pragma GCC target "+nosve" #include diff --git a/gcc/testsuite/gcc.target/aarch64/simd/usra.c b/gcc/testsuite/gcc.target/aarch64/simd/usra.c index 4e7446d..10712b2 100644 --- a/gcc/testsuite/gcc.target/aarch64/simd/usra.c +++ b/gcc/testsuite/gcc.target/aarch64/simd/usra.c @@ -1,6 +1,7 @@ /* { dg-do compile { target aarch64*-*-* } } */ /* { dg-options "-O3" } */ -/* { dg-skip-if "" { *-*-* } {"*sve*"} {""} } */ + +#pragma GCC target "+nosve" #include -- cgit v1.1 From 4cea5b8cb715e40e10174e6de405f26202fa3d6a Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Tue, 27 Apr 2021 12:18:03 +0100 Subject: aarch64: Handle SVE attributes in comp_type_attributes [PR100270] Even though "SVE type" and "SVE sizeless type" are marked as affecting type identity, the middle end doesn't truly believe it unless we also handle them in comp_type_attributes. gcc/ PR target/100270 * config/aarch64/aarch64.c (aarch64_comp_type_attributes): Handle SVE attributes. gcc/testsuite/ PR target/100270 * gcc.target/aarch64/sve/acle/general-c/pr100270_1.c: New test. * gcc.target/aarch64/sve/acle/general-c/sizeless-2.c: Change expected error message when subtracting pointers to different vector types. Expect warnings when mixing them elsewhere. * gcc.target/aarch64/sve/acle/general/attributes_7.c: Remove XFAILs. Tweak error messages for some cases. --- .../aarch64/sve/acle/general-c/pr100270_1.c | 103 +++++++++++++++++++++ .../aarch64/sve/acle/general-c/sizeless-2.c | 36 +++---- .../aarch64/sve/acle/general/attributes_7.c | 72 +++++++------- 3 files changed, 162 insertions(+), 49 deletions(-) create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/pr100270_1.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/pr100270_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/pr100270_1.c new file mode 100644 index 0000000..05232d7 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/pr100270_1.c @@ -0,0 +1,103 @@ +/* { dg-options "-msve-vector-bits=256" } */ + +#include + +typedef svint32_t vls_svint32_t __attribute__((arm_sve_vector_bits(256))); +typedef svuint32_t vls_svuint32_t __attribute__((arm_sve_vector_bits(256))); + +typedef int32_t gnu_svint32_t __attribute__((vector_size(32))); +typedef uint32_t gnu_svuint32_t __attribute__((vector_size(32))); + +#define X_gnu_svint32_t 1 +#define X_gnu_svuint32_t 2 +#define X_vls_svint32_t 3 +#define X_vls_svuint32_t 4 + +#define CHECK(T) T: X_##T + +#define CHECK_TYPE(EXPR, TYPE) \ + do { \ + int x[_Generic (EXPR, \ + CHECK (gnu_svint32_t), \ + CHECK (gnu_svuint32_t), \ + CHECK (vls_svint32_t), \ + CHECK (vls_svuint32_t), \ + default : 0) == X_##TYPE ? 1 : -1]; \ + } while (0) + +void +f (gnu_svint32_t sg, gnu_svuint32_t ug, vls_svint32_t sn, vls_svuint32_t un, int c) +{ + CHECK_TYPE (sg, gnu_svint32_t); + CHECK_TYPE (ug, gnu_svuint32_t); + CHECK_TYPE (sn, vls_svint32_t); + CHECK_TYPE (un, vls_svuint32_t); + + CHECK_TYPE (sg + 1, gnu_svint32_t); + CHECK_TYPE (ug + 1, gnu_svuint32_t); + CHECK_TYPE (sn + 1, vls_svint32_t); + CHECK_TYPE (un + 1, vls_svuint32_t); + + CHECK_TYPE (1 + sg, gnu_svint32_t); + CHECK_TYPE (1 + ug, gnu_svuint32_t); + CHECK_TYPE (1 + sn, vls_svint32_t); + CHECK_TYPE (1 + un, vls_svuint32_t); + + CHECK_TYPE (sg + sg, gnu_svint32_t); + CHECK_TYPE (ug + ug, gnu_svuint32_t); + CHECK_TYPE (sn + sn, vls_svint32_t); + CHECK_TYPE (un + un, vls_svuint32_t); + + /* Traditional behavior for mixed signs is to pick the signedness of the + first operand. We don't have any Arm-specific reason for preferring that + behavior. */ + CHECK_TYPE (sg + ug, gnu_svint32_t); + CHECK_TYPE (ug + sg, gnu_svuint32_t); + CHECK_TYPE (sn + un, vls_svint32_t); + CHECK_TYPE (un + sn, vls_svuint32_t); + + CHECK_TYPE (c ? sg + sg : sg, gnu_svint32_t); + CHECK_TYPE (c ? ug + ug : ug, gnu_svuint32_t); + CHECK_TYPE (c ? sn + sn : sn, vls_svint32_t); + CHECK_TYPE (c ? un + un : un, vls_svuint32_t); + + CHECK_TYPE (c ? sg + 1 : sg, gnu_svint32_t); + CHECK_TYPE (c ? ug + 1 : ug, gnu_svuint32_t); + CHECK_TYPE (c ? sn + 1 : sn, vls_svint32_t); + CHECK_TYPE (c ? un + 1 : un, vls_svuint32_t); + + CHECK_TYPE (c ? 1 + sg : sg, gnu_svint32_t); + CHECK_TYPE (c ? 1 + ug : ug, gnu_svuint32_t); + CHECK_TYPE (c ? 1 + sn : sn, vls_svint32_t); + CHECK_TYPE (c ? 1 + un : un, vls_svuint32_t); + + CHECK_TYPE (c ? sg : sg + sg, gnu_svint32_t); + CHECK_TYPE (c ? ug : ug + ug, gnu_svuint32_t); + CHECK_TYPE (c ? sn : sn + sn, vls_svint32_t); + CHECK_TYPE (c ? un : un + un, vls_svuint32_t); + + CHECK_TYPE (c ? sg : sg + 1, gnu_svint32_t); + CHECK_TYPE (c ? ug : ug + 1, gnu_svuint32_t); + CHECK_TYPE (c ? sn : sn + 1, vls_svint32_t); + CHECK_TYPE (c ? un : un + 1, vls_svuint32_t); + + CHECK_TYPE (c ? sg : 1 + sg, gnu_svint32_t); + CHECK_TYPE (c ? ug : 1 + ug, gnu_svuint32_t); + CHECK_TYPE (c ? sn : 1 + sn, vls_svint32_t); + CHECK_TYPE (c ? un : 1 + un, vls_svuint32_t); + + CHECK_TYPE (c ? sg + sg : sg + sg, gnu_svint32_t); + CHECK_TYPE (c ? ug + ug : ug + ug, gnu_svuint32_t); + CHECK_TYPE (c ? sn + sn : sn + sn, vls_svint32_t); + CHECK_TYPE (c ? un + un : un + un, vls_svuint32_t); + + CHECK_TYPE (c ? sg + sg : sg + 1, gnu_svint32_t); + CHECK_TYPE (c ? ug + ug : ug + 1, gnu_svuint32_t); + CHECK_TYPE (c ? sn + sn : sn + 1, vls_svint32_t); + CHECK_TYPE (c ? un + un : un + 1, vls_svuint32_t); + + CHECK_TYPE (c ? 1 + sg : sg + sg, gnu_svint32_t); + CHECK_TYPE (c ? 1 + ug : ug + ug, gnu_svuint32_t); + CHECK_TYPE (c ? 1 + sn : sn + sn, vls_svint32_t); + CHECK_TYPE (c ? 1 + un : un + un, vls_svuint32_t); +} diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/sizeless-2.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/sizeless-2.c index 3af36de..c575492 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/sizeless-2.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/sizeless-2.c @@ -106,8 +106,8 @@ statements (int n) /* Pointer assignment. */ - gnu_sc_ptr = sve_sc_ptr; - sve_sc_ptr = gnu_sc_ptr; + gnu_sc_ptr = sve_sc_ptr; /* { dg-warning {incompatible pointer type} } */ + sve_sc_ptr = gnu_sc_ptr; /* { dg-warning {incompatible pointer type} } */ /* Pointer arithmetic. */ @@ -120,8 +120,8 @@ statements (int n) sve_sc_ptr -= 0; /* { dg-error {arithmetic on pointer to SVE type 'svint8_t'} } */ sve_sc_ptr -= 1; /* { dg-error {arithmetic on pointer to SVE type 'svint8_t'} } */ sve_sc_ptr - sve_sc_ptr; /* { dg-error {arithmetic on pointer to SVE type 'svint8_t'} } */ - gnu_sc_ptr - sve_sc_ptr; /* { dg-error {arithmetic on pointer to SVE type 'svint8_t'} } */ - sve_sc_ptr - gnu_sc_ptr; /* { dg-error {arithmetic on pointer to SVE type 'svint8_t'} } */ + gnu_sc_ptr - sve_sc_ptr; /* { dg-error {invalid operands to binary -} } */ + sve_sc_ptr - gnu_sc_ptr; /* { dg-error {invalid operands to binary -} } */ sve_sc1 = sve_sc_ptr[0]; /* { dg-error {arithmetic on pointer to SVE type 'svint8_t'} } */ sve_sc1 = sve_sc_ptr[1]; /* { dg-error {arithmetic on pointer to SVE type 'svint8_t'} } */ @@ -133,18 +133,18 @@ statements (int n) sve_sc_ptr <= &sve_sc1; sve_sc_ptr > &sve_sc1; sve_sc_ptr >= &sve_sc1; - gnu_sc_ptr == sve_sc_ptr; - gnu_sc_ptr != sve_sc_ptr; - gnu_sc_ptr < sve_sc_ptr; - gnu_sc_ptr <= sve_sc_ptr; - gnu_sc_ptr > sve_sc_ptr; - gnu_sc_ptr >= sve_sc_ptr; - sve_sc_ptr == gnu_sc_ptr; - sve_sc_ptr != gnu_sc_ptr; - sve_sc_ptr < gnu_sc_ptr; - sve_sc_ptr <= gnu_sc_ptr; - sve_sc_ptr > gnu_sc_ptr; - sve_sc_ptr >= gnu_sc_ptr; + gnu_sc_ptr == sve_sc_ptr; /* { dg-warning {comparison of distinct pointer types} } */ + gnu_sc_ptr != sve_sc_ptr; /* { dg-warning {comparison of distinct pointer types} } */ + gnu_sc_ptr < sve_sc_ptr; /* { dg-warning {comparison of distinct pointer types} } */ + gnu_sc_ptr <= sve_sc_ptr; /* { dg-warning {comparison of distinct pointer types} } */ + gnu_sc_ptr > sve_sc_ptr; /* { dg-warning {comparison of distinct pointer types} } */ + gnu_sc_ptr >= sve_sc_ptr; /* { dg-warning {comparison of distinct pointer types} } */ + sve_sc_ptr == gnu_sc_ptr; /* { dg-warning {comparison of distinct pointer types} } */ + sve_sc_ptr != gnu_sc_ptr; /* { dg-warning {comparison of distinct pointer types} } */ + sve_sc_ptr < gnu_sc_ptr; /* { dg-warning {comparison of distinct pointer types} } */ + sve_sc_ptr <= gnu_sc_ptr; /* { dg-warning {comparison of distinct pointer types} } */ + sve_sc_ptr > gnu_sc_ptr; /* { dg-warning {comparison of distinct pointer types} } */ + sve_sc_ptr >= gnu_sc_ptr; /* { dg-warning {comparison of distinct pointer types} } */ /* Conditional expressions. */ @@ -154,8 +154,8 @@ statements (int n) 0 ? 0 : sve_sc1; /* { dg-error {type mismatch in conditional expression} } */ 0 ?: sve_sc1; /* { dg-error {type mismatch in conditional expression} } */ 0 ? sve_sc_ptr : sve_sc_ptr; - 0 ? sve_sc_ptr : gnu_sc_ptr; - 0 ? gnu_sc_ptr : sve_sc_ptr; + 0 ? sve_sc_ptr : gnu_sc_ptr; /* { dg-warning {pointer type mismatch} } */ + 0 ? gnu_sc_ptr : sve_sc_ptr; /* { dg-warning {pointer type mismatch} } */ /* Generic associations. */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/attributes_7.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/attributes_7.c index e2e7470..621666c 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/attributes_7.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/attributes_7.c @@ -85,19 +85,19 @@ f (int c) (void) (c ? fs8 : ss8); // { dg-error {type mismatch|different types} } (void) (c ? fs8 : fs8); - (void) (c ? fs8 : gs8); // { dg-error {type mismatch|different types} "" { xfail c++ } } + (void) (c ? fs8 : gs8); // { dg-error {type mismatch|different types} } (void) (c ? gs8 : ss8); // { dg-error {type mismatch|different types} } - (void) (c ? gs8 : fs8); // { dg-error {type mismatch|different types} "" { xfail c++ } } + (void) (c ? gs8 : fs8); // { dg-error {type mismatch|different types} } (void) (c ? gs8 : gs8); sb = fb; fb = sb; (void) (c ? sb : sb); - (void) (c ? sb : fb); // { dg-error {type mismatch|different types} "" { xfail *-*-* } } + (void) (c ? sb : fb); // { dg-error {type mismatch|different types} "" { xfail c } } - (void) (c ? fb : sb); // { dg-error {type mismatch|different types} "" { xfail *-*-* } } + (void) (c ? fb : sb); // { dg-error {type mismatch|different types} "" { xfail c } } (void) (c ? fb : fb); } @@ -123,24 +123,22 @@ g (int c) void *select __attribute__((unused)); diff = ss8 - ss8; // { dg-error {arithmetic on pointer to SVE type 'svint8_t'} } - diff = ss8 - fs8; // { dg-error {invalid operands [^\n]* binary[^\n]*\-} "" { xfail c } } - // { dg-error {arithmetic on pointer to SVE type 'svint8_t'} "bogus" { target c } .-1 } - diff = ss8 - gs8; // { dg-error {invalid operands [^\n]* binary[^\n]*\-} "" { xfail c } } - // { dg-error {arithmetic on pointer to SVE type 'svint8_t'} "bogus" { target c } .-1 } + diff = ss8 - fs8; // { dg-error {invalid operands [^\n]* binary[^\n]*\-} "" } + diff = ss8 - gs8; // { dg-error {invalid operands [^\n]* binary[^\n]*\-} "" } - diff = fs8 - ss8; // { dg-error {invalid operands [^\n]* binary[^\n]*\-} "" { xfail c } } - // { dg-error {arithmetic on pointer to SVE type 'svint8_t'} "bogus" { target c } .-1 } + diff = fs8 - ss8; // { dg-error {invalid operands [^\n]* binary[^\n]*\-} "" } diff = fs8 - fs8; - diff = fs8 - gs8; + diff = fs8 - gs8; // { dg-error {invalid operands [^\n]* binary[^\n]*\-} "" } - diff = gs8 - ss8; // { dg-error {invalid operands [^\n]* binary[^\n]*\-} "" { xfail c } } - // { dg-error {arithmetic on pointer to SVE type 'svint8_t'} "bogus" { target c } .-1 } - diff = gs8 - fs8; + diff = gs8 - ss8; // { dg-error {invalid operands [^\n]* binary[^\n]*\-} "" } + diff = gs8 - fs8; // { dg-error {invalid operands [^\n]* binary[^\n]*\-} "" } diff = gs8 - gs8; - fs8 = ss8; // { dg-error {invalid conversion} "" { xfail c } } + fs8 = ss8; // { dg-error {invalid conversion} "" { target c++ } } + // { dg-warning {incompatible pointer type} "c" { target c } .-1 } fs8 = fs8; - fs8 = gs8; + fs8 = gs8; // { dg-error {invalid conversion} "" { target c++ } } + // { dg-warning {incompatible pointer type} "c" { target c } .-1 } fs8 = su8; // { dg-error {cannot convert} "c++" { target c++ } } // { dg-warning {incompatible pointer type} "c" { target c } .-1 } @@ -150,36 +148,48 @@ g (int c) // { dg-warning {incompatible pointer type} "c" { target c } .-1 } fs8 = ss16; // { dg-error {cannot convert} "c++" { target c++ } } - // { dg-warning {incompatible pointer type} "c" { target c } .-1 } + // { dg-warning {incompatible pointer type} "c" { target c } .-1 } fs8 = fs16; // { dg-error {cannot convert} "c++" { target c++ } } - // { dg-warning {incompatible pointer type} "c" { target c } .-1 } + // { dg-warning {incompatible pointer type} "c" { target c } .-1 } fs8 = gs16; // { dg-error {cannot convert} "c++" { target c++ } } - // { dg-warning {incompatible pointer type} "c" { target c } .-1 } + // { dg-warning {incompatible pointer type} "c" { target c } .-1 } select = c ? ss8 : ss8; - select = c ? ss8 : fs8; // { dg-error {distinct pointer types} "" { xfail c } } - select = c ? ss8 : gs8; // { dg-error {distinct pointer types} "" { xfail c } } + select = c ? ss8 : fs8; // { dg-error {distinct pointer types} "" { target c++ } } + // { dg-warning {pointer type mismatch} "c" { target c } .-1 } + select = c ? ss8 : gs8; // { dg-error {distinct pointer types} "" { target c++ } } + // { dg-warning {pointer type mismatch} "c" { target c } .-1 } - select = c ? fs8 : ss8; // { dg-error {distinct pointer types} "" { xfail c } } + select = c ? fs8 : ss8; // { dg-error {distinct pointer types} "" { target c++ } } + // { dg-warning {pointer type mismatch} "c" { target c } .-1 } select = c ? fs8 : fs8; - select = c ? fs8 : gs8; // { dg-error {distinct pointer types} "" { xfail *-*-* } } + select = c ? fs8 : gs8; // { dg-error {distinct pointer types} "" { target c++ } } + // { dg-warning {pointer type mismatch} "c" { target c } .-1 } - select = c ? gs8 : ss8; // { dg-error {distinct pointer types} "" { xfail c } } - select = c ? gs8 : fs8; // { dg-error {distinct pointer types} "" { xfail *-*-* } } + select = c ? gs8 : ss8; // { dg-error {distinct pointer types} "" { target c++ } } + // { dg-warning {pointer type mismatch} "c" { target c } .-1 } + select = c ? gs8 : fs8; // { dg-error {distinct pointer types} "" { target c++ } } + // { dg-warning {pointer type mismatch} "c" { target c } .-1 } select = c ? gs8 : gs8; diff = sb - sb; // { dg-error {arithmetic on pointer to SVE type 'svbool_t'} } - diff = sb - fb; // { dg-error {arithmetic on pointer to SVE type 'svbool_t'} } + diff = sb - fb; // { dg-error {invalid operands} "" { target c++ } } + // { dg-error {arithmetic on pointer to SVE type 'svbool_t'} "c" { target c } .-1 } - diff = fb - sb; // { dg-error {arithmetic on pointer to SVE type 'svbool_t'} } + diff = fb - sb; // { dg-error {invalid operands} "" { target c++ } } + // { dg-error {arithmetic on pointer to SVE type 'svbool_t'} "c" { target c } .-1 } diff = fb - fb; - sb = fb; - fb = sb; + sb = fb; // { dg-error {invalid conversion} "" { target c++ } } + // { dg-warning {incompatible pointer type} "c" { target c xfail c } .-1 } + fb = sb; // { dg-error {invalid conversion} "" { target c++ } } + // { dg-warning {incompatible pointer type} "c" { target c xfail c } .-1 } select = c ? sb : sb; - select = c ? sb : fb; // { dg-error {type mismatch|different types} "" { xfail *-*-* } } + select = c ? sb : fb; // { dg-error {distinct pointer types} "" { target c++ } } + // { dg-warning {pointer type mismatch} "c" { target c xfail c } .-1 } - select = c ? fb : sb; // { dg-error {type mismatch|different types} "" { xfail *-*-* } } + select = c ? fb : sb; // { dg-error {distinct pointer types} "" { target c++ } } + // { dg-warning {pointer type mismatch} "c" { target c xfail c } .-1 } select = c ? fb : fb; } -- cgit v1.1 From 3dcd1334b4f522352b80814513fdca902fc2a207 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 27 Apr 2021 14:45:45 +0200 Subject: expand: Expand x / y * y as x - x % y if the latter is cheaper [PR96696] The following patch tests both x / y * y and x - x % y expansion for the former GIMPLE code and chooses the cheaper of those sequences. 2021-04-27 Jakub Jelinek PR tree-optimization/96696 * expr.c (expand_expr_divmod): New function. (expand_expr_real_2) : Use it for truncations and divisions. Formatting fixes. : Optimize x / y * y as x - x % y if the latter is cheaper. * gcc.target/i386/pr96696.c: New test. --- gcc/testsuite/gcc.target/i386/pr96696.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr96696.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/i386/pr96696.c b/gcc/testsuite/gcc.target/i386/pr96696.c new file mode 100644 index 0000000..b874e6d --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr96696.c @@ -0,0 +1,30 @@ +/* PR tree-optimization/96696 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -masm=att" } */ +/* { dg-final { scan-assembler-times "\tidivl\t" 2 } } */ +/* { dg-final { scan-assembler-times "\tdivl\t" 2 } } */ +/* { dg-final { scan-assembler-not "\ti?mull\t" } } */ + +int +foo (int x, int y) +{ + return (x / y) * y; +} + +int +bar (int x, int y) +{ + return x - (x % y); +} + +unsigned +baz (unsigned x, unsigned y) +{ + return (x / y) * y; +} + +unsigned +qux (unsigned x, unsigned y) +{ + return x - (x % y); +} -- cgit v1.1 From 75f8900159133ce069ef1d2edf3b67c7bc82e305 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 27 Apr 2021 14:47:54 +0200 Subject: match.pd: Add some __builtin_ctz (x) cmp cst simplifications [PR95527] This patch adds some ctz simplifications (e.g. ctz (x) >= 3 can be done by testing if the low 3 bits are zero, etc.). In addition, I've noticed that in the CLZ case, the #ifdef CLZ_DEFINED_VALUE_AT_ZERO don't really work as intended, they are evaluated during genmatch and the macro is not defined then (but, because of the missing tm.h includes it isn't defined in gimple-match.c or generic-match.c either). And when tm.h is included, defaults.h is included which defines a fallback version of that macro. For GCC 12, I wonder if it wouldn't be better to say in addition to __builtin_c[lt]z* is always UB at zero that it would be undefined for .C[LT]Z ifn too if it has just one operand and use a second operand to be the constant we expect at zero. 2021-04-27 Jakub Jelinek PR tree-optimization/95527 * generic-match-head.c: Include tm.h. * gimple-match-head.c: Include tm.h. * match.pd (CLZ == INTEGER_CST): Don't use #ifdef CLZ_DEFINED_VALUE_AT_ZERO, only test CLZ_DEFINED_VALUE_AT_ZERO if clz == CFN_CLZ. Add missing val declaration. (CTZ cmp CST): New simplifications. * gcc.dg/tree-ssa/pr95527-2.c: New test. --- gcc/testsuite/gcc.dg/tree-ssa/pr95527-2.c | 57 +++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr95527-2.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr95527-2.c b/gcc/testsuite/gcc.dg/tree-ssa/pr95527-2.c new file mode 100644 index 0000000..b4ae2be --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr95527-2.c @@ -0,0 +1,57 @@ +/* PR tree-optimization/95527 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-original" } */ +/* { dg-final { scan-tree-dump "a & 7\\) == 0" "original" } } */ +/* { dg-final { scan-tree-dump "b & 63\\) != 0" "original" } } */ +/* { dg-final { scan-tree-dump-times "return 0;" 2 "original" } } */ +/* { dg-final { scan-tree-dump-times "return 1;" 2 "original" } } */ +/* { dg-final { scan-tree-dump "g & 15\\) == 8" "original" } } */ +/* { dg-final { scan-tree-dump "h & 255\\) != 128" "original" } } */ + +int +f1 (int a) +{ + return __builtin_ctz (a) >= 3; +} + +int +f2 (int b) +{ + return __builtin_ctz (b) < 6; +} + +int +f3 (int c) +{ + return __builtin_ctz (c) < 0; +} + +int +f4 (int d) +{ + return __builtin_ctz (d) >= 0; +} + +int +f5 (int e) +{ + return __builtin_ctz (e) >= __SIZEOF_INT__ * __CHAR_BIT__; +} + +int +f6 (int f) +{ + return __builtin_ctz (f) < __SIZEOF_INT__ * __CHAR_BIT__; +} + +int +f7 (int g) +{ + return __builtin_ctz (g) == 3; +} + +int +f8 (int h) +{ + return __builtin_ctz (h) != 7; +} -- cgit v1.1 From d8e1f1d24179690fd9c0f63c27b12e030010d9ea Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 7 Apr 2021 12:09:44 +0200 Subject: tree-optimization/99912 - schedule DSE before SRA For the testcase in the PR the main SRA pass is unable to do some important scalarizations because dead stores of addresses make the candiate variables disqualified. The following patch adds another DSE pass before SRA forming a DCE/DSE pair and moves the DSE pass that is currently closely after SRA up to after the next DCE pass, forming another DCE/DSE pair now residing after PRE. 2021-04-07 Richard Biener PR tree-optimization/99912 * passes.def (pass_all_optimizations): Add pass_dse before the first pass_dce, move the first pass_dse before the pass_dce following pass_pre. * gcc.dg/tree-ssa/ldist-33.c: Disable PRE and LIM. * gcc.dg/tree-ssa/pr96789.c: Adjust dump file scanned. * gcc.dg/tree-ssa/ssa-dse-28.c: Likewise. * gcc.dg/tree-ssa/ssa-dse-29.c: Likewise. --- gcc/testsuite/gcc.dg/tree-ssa/ldist-33.c | 5 ++++- gcc/testsuite/gcc.dg/tree-ssa/pr96789.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-28.c | 3 ++- gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-29.c | 3 ++- 4 files changed, 9 insertions(+), 4 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ldist-33.c b/gcc/testsuite/gcc.dg/tree-ssa/ldist-33.c index 9e0cedf..67846a5 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ldist-33.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ldist-33.c @@ -1,5 +1,8 @@ /* { dg-do compile { target size32plus } } */ -/* { dg-options "-O2 -ftree-loop-distribution -ftree-loop-distribute-patterns -fdump-tree-ldist-details" } */ +/* The desire is to show we can generate a memset from the outer loop + store. Both store motion and PRE expose a DSE opportunity for this + zeroing - while desirable this defeats the purpose of this testcase. */ +/* { dg-options "-O2 -fno-tree-loop-im -fno-tree-pre -ftree-loop-distribution -ftree-loop-distribute-patterns -fdump-tree-ldist-details" } */ #define N (1024) double a[N][N], b[N][N], c[N][N]; diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr96789.c b/gcc/testsuite/gcc.dg/tree-ssa/pr96789.c index 5704952..4d4d4c8 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr96789.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr96789.c @@ -58,4 +58,4 @@ bar (int16_t res[16], uint8_t *val1, uint8_t *val2) } } -/* { dg-final { scan-tree-dump {Deleted dead store:.*tmp} "dse3" } } */ +/* { dg-final { scan-tree-dump {Deleted dead store:.*tmp} "dse4" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-28.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-28.c index b81cabe..3bf4e76 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-28.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-28.c @@ -17,5 +17,6 @@ int foo (int *p, int b) /* { dg-final { scan-tree-dump-not "Deleted dead store" "dse1"} } */ /* { dg-final { scan-tree-dump-not "Deleted dead store" "dse2"} } */ -/* { dg-final { scan-tree-dump-not "Deleted dead store" "dse4"} } */ +/* { dg-final { scan-tree-dump-not "Deleted dead store" "dse3"} } */ +/* { dg-final { scan-tree-dump-not "Deleted dead store" "dse5"} } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-29.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-29.c index f4ef89c..4990ae0 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-29.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-29.c @@ -22,5 +22,6 @@ foo(int cond, struct z *s) /* { dg-final { scan-tree-dump-times "Deleted dead store" 3 "dse1"} } */ /* { dg-final { scan-tree-dump-not "Deleted dead store" "dse2"} } */ -/* { dg-final { scan-tree-dump-not "Deleted dead store" "dse4"} } */ +/* { dg-final { scan-tree-dump-not "Deleted dead store" "dse3"} } */ +/* { dg-final { scan-tree-dump-not "Deleted dead store" "dse5"} } */ -- cgit v1.1 From e600df51a15b2ec7a72731921a2464ffe59cf5ab Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 27 Apr 2021 15:26:24 +0200 Subject: cfgcleanup: Fix -fcompare-debug issue in outgoing_edges_match [PR100254] The following testcase fails with -fcompare-debug. The problem is that outgoing_edges_match behaves differently between -g0 and -g, if some load/store with REG_EH_REGION is followed by DEBUG_INSNs, the REG_EH_REGION check is not done, while when there are no DEBUG_INSNs, it is done. We already compute last1 and last2 as BB_END (bb{1,2}) with skipped debug insns and notes, so this patch just uses those. 2021-04-27 Jakub Jelinek PR rtl-optimization/100254 * cfgcleanup.c (outgoing_edges_match): Check REG_EH_REGION on last1 and last2 insns rather than BB_END (bb1) and BB_END (bb2) insns. * g++.dg/opt/pr100254.C: New test. --- gcc/testsuite/g++.dg/opt/pr100254.C | 101 ++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 gcc/testsuite/g++.dg/opt/pr100254.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/opt/pr100254.C b/gcc/testsuite/g++.dg/opt/pr100254.C new file mode 100644 index 0000000..dbdac16 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr100254.C @@ -0,0 +1,101 @@ +// PR rtl-optimization/100254 +// { dg-do compile } +// { dg-options "-O2 -fno-guess-branch-probability -fipa-pta -fnon-call-exceptions -fcompare-debug" } +// { dg-additional-options "-mtune=goldmont" { target i?86-*-* x86_64-*-* } } + +struct _Rb_tree_node_base { + typedef _Rb_tree_node_base *_Base_ptr; + typedef _Rb_tree_node_base *_Const_Base_ptr; + _Base_ptr _M_left; +}; +template struct _Rb_tree_key_compare { + _Key_compare _M_key_compare; +}; +struct _Rb_tree_header { + _Rb_tree_node_base _M_header; +}; +struct _Rb_tree_iterator { + _Rb_tree_iterator(_Rb_tree_node_base::_Base_ptr); + friend bool operator==(_Rb_tree_iterator, _Rb_tree_iterator); +}; +template struct _Rb_tree_const_iterator { + typedef _Rb_tree_const_iterator _Self; + _Rb_tree_const_iterator(_Rb_tree_node_base::_Const_Base_ptr) {} + _Tp operator*(); + template + friend bool operator!=(_Rb_tree_const_iterator<_Up>, _Rb_tree_const_iterator<_Up>); +}; +template struct _Rb_tree { + template + struct _Rb_tree_impl : _Rb_tree_key_compare<_Key_compare>, _Rb_tree_header {}; + _Rb_tree_impl<_Compare> _M_impl; + _Key _S_key(); + typedef _Rb_tree_const_iterator<_Val> const_iterator; + const_iterator begin() { return _M_impl._M_header._M_left; } + _Rb_tree_iterator find(const _Key &); +}; +template +_Rb_tree_iterator _Rb_tree<_Key, _Val, _Compare>::find(const _Key &__k) { + _Rb_tree_iterator __j = 0; + return __j == 0 || _M_impl._M_key_compare(__k, _S_key()) ? 0 : __j; +} +template struct set { + typedef _Key key_type; + typedef _Rb_tree _Rep_type; + _Rep_type _M_t; + typedef typename _Rep_type::const_iterator iterator; + iterator begin() { return _M_t.begin(); } + iterator end(); + void find(key_type __x) { _M_t.find(__x); } +}; +struct WindowDesc { + WindowDesc(short); +} _station_view_desc(0); +struct Window { + void IsWidgetLowered(); + virtual void OnClick(int, int, int); +}; +int AllocateWindowDescFront_window_number; +template void AllocateWindowDescFront(WindowDesc *desc, bool) { + Wcls(desc, AllocateWindowDescFront_window_number); +} +class CargoDataEntry; +struct CargoSorter { + bool operator()(const CargoDataEntry *, const CargoDataEntry *) const; +}; +struct CargoDataEntry { + ~CargoDataEntry(); + char Retrieve_cargo; + void Retrieve() { + CargoDataEntry t(Retrieve_cargo); + children->find(&t); + } + CargoDataEntry(char); + set *children; +}; +CargoDataEntry::CargoDataEntry(char) : children() {} +CargoDataEntry::~CargoDataEntry() { + if (children) + for (set::iterator i = children->begin(); + i != children->end();) + delete *i; +} +bool CargoSorter::operator()(const CargoDataEntry *, + const CargoDataEntry *) const { return false; } +struct StationViewWindow : Window { + StationViewWindow(WindowDesc *, int); + CargoDataEntry HandleCargoWaitingClick_filter; + void OnClick(int, int widget, int) { + switch (widget) { + case 0: + HandleCargoWaitingClick_filter.Retrieve(); + HandleCargoWaitingClick_filter.Retrieve(); + case 1: + IsWidgetLowered(); + } + } +}; +void ShowStationViewWindow_station() { + AllocateWindowDescFront(&_station_view_desc, + ShowStationViewWindow_station); +} -- cgit v1.1 From 83d26d0e1b3625ab6c2d83610a13976b52f63e0a Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 27 Apr 2021 15:42:47 +0200 Subject: veclower: Fix up vec_shl matching of VEC_PERM_EXPR [PR100239] The following testcase ICEs at -O0, because lower_vec_perm sees the _1 = { 0, 0, 0, 0, 0, 0, 0, 0 }; _2 = VEC_COND_EXPR <_1, { -1, -1, -1, -1, -1, -1, -1, -1 }, { 0, 0, 0, 0, 0, 0, 0, 0 }>; _3 = { 6, 0, 0, 0, 0, 0, 0, 0 }; _4 = VEC_PERM_EXPR <{ 0, 0, 0, 0, 0, 0, 0, 0 }, _2, _3>; and as the ISA is SSE2, there is no support for the particular permutation nor for variable mask permutation. But, the code to match vec_shl matches it, because the permutation has the first operand a zero vector and the mask picks all elements randomly from that vector. So, in the end that isn't a vec_shl, but the permutation could be in theory optimized into the first argument. As we keep it as is, it will fail during expansion though, because that for vec_shl correctly requires that it actually is a shift: unsigned firstidx = 0; for (unsigned int i = 0; i < nelt; i++) { if (known_eq (sel[i], nelt)) { if (i == 0 || firstidx) return NULL_RTX; firstidx = i; } else if (firstidx ? maybe_ne (sel[i], nelt + i - firstidx) : maybe_ge (sel[i], nelt)) return NULL_RTX; } if (firstidx == 0) return NULL_RTX; first = firstidx; The if (firstidx == 0) return NULL; is what is missing a counterpart on the lower_vec_perm side. As with optimize != 0 we fold it in other spots, I think it is not needed to optimize this cornercase in lower_vec_perm (which would mean we'd need to recurse on the newly created _4 = { 0, 0, 0, 0, 0, 0, 0, 0 }; whether it is supported or not). 2021-04-27 Jakub Jelinek PR tree-optimization/100239 * tree-vect-generic.c (lower_vec_perm): Don't accept constant permutations with all indices from the first zero element as vec_shl. * gcc.dg/pr100239.c: New test. --- gcc/testsuite/gcc.dg/pr100239.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr100239.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/pr100239.c b/gcc/testsuite/gcc.dg/pr100239.c new file mode 100644 index 0000000..1ade810 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr100239.c @@ -0,0 +1,12 @@ +/* PR tree-optimization/100239 */ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +typedef short __attribute__((__vector_size__ (8 * sizeof (short)))) V; +V v, w; + +void +foo (void) +{ + w = __builtin_shuffle (v != v, 0 < (V) {}, (V) {192} >> 5); +} -- cgit v1.1 From 42a10bb884c0d5af2583b8bfe4d239ce95bf9e43 Mon Sep 17 00:00:00 2001 From: Alex Coplan Date: Tue, 27 Apr 2021 14:56:15 +0100 Subject: arm: Fix ICEs with compare-and-swap and -march=armv8-m.base [PR99977] The PR shows two ICEs with __sync_bool_compare_and_swap and -mcpu=cortex-m23 (equivalently, -march=armv8-m.base): one in LRA and one later on, after the CAS insn is split. The LRA ICE occurs because the @atomic_compare_and_swap_1 pattern attempts to tie two output operands together (operands 0 and 1 in the third alternative). LRA can't handle this, since it doesn't make sense for an insn to assign to the same operand twice. The later (post-splitting) ICE occurs because the expansion of the cbranchsi4_scratch insn doesn't quite go according to plan. As it stands, arm_split_compare_and_swap calls gen_cbranchsi4_scratch, attempting to pass a register (neg_bval) to use as a scratch register. However, since the RTL template has a match_scratch here, gen_cbranchsi4_scratch ignores this argument and produces a scratch rtx. Since this is all happening after RA, this is doomed to fail (and we get an ICE about the insn not matching its constraints). It seems that the motivation for the choice of constraints in the atomic_compare_and_swap pattern comes from an attempt to satisfy the constraints of the cbranchsi4_scratch insn. This insn requires the scratch register to be the same as the input register in the case that we use a larger negative immediate (one that satisfies J, but not L). Of course, as noted above, LRA refuses to assign two output operands to the same register, so this was never going to work. The solution I'm proposing here is to collapse the alternatives to the CAS insn (allowing the two output register operands to be matched to different registers) and to ensure that the constraints for cbranchsi4_scratch are met in arm_split_compare_and_swap. We do this by inserting a move to ensure the source and destination registers match if necessary (i.e. in the case of large negative immediates). Another notable change here is that we only do: emit_move_insn (neg_bval, const1_rtx); for non-negative immediates. This is because the ADDS instruction used in the negative case suffices to leave a suitable value in neg_bval: if the operands compare equal, we don't take the branch (so neg_bval will be set by the load exclusive). Otherwise, the ADDS will leave a nonzero value in neg_bval, which will correctly signal that the CAS has failed when it is later negated. gcc/ChangeLog: PR target/99977 * config/arm/arm.c (arm_split_compare_and_swap): Fix up codegen with negative immediates: ensure we expand cbranchsi4_scratch correctly and ensure we satisfy its constraints. * config/arm/sync.md (@atomic_compare_and_swap_1): Don't attempt to tie two output operands together with constraints; collapse two alternatives. (@atomic_compare_and_swap_1): Likewise. * config/arm/thumb1.md (cbranchsi4_neg_late): New. gcc/testsuite/ChangeLog: PR target/99977 * gcc.target/arm/pr99977.c: New test. --- gcc/testsuite/gcc.target/arm/pr99977.c | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 gcc/testsuite/gcc.target/arm/pr99977.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/arm/pr99977.c b/gcc/testsuite/gcc.target/arm/pr99977.c new file mode 100644 index 0000000..7911899 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pr99977.c @@ -0,0 +1,6 @@ +/* { dg-do compile } */ +/* { dg-options "-march=armv8-m.base -mfloat-abi=soft -O2" } */ +_Bool f1(int *p) { return __sync_bool_compare_and_swap (p, -1, 2); } +_Bool f2(int *p) { return __sync_bool_compare_and_swap (p, -8, 2); } +int g1(int *p) { return __sync_val_compare_and_swap (p, -1, 2); } +int g2(int *p) { return __sync_val_compare_and_swap (p, -8, 3); } -- cgit v1.1 From c33db31d9ad96f6414460315c12b4b505fad5dd7 Mon Sep 17 00:00:00 2001 From: Bernd Edlinger Date: Wed, 21 Apr 2021 14:13:04 +0200 Subject: Fix target/100106 ICE in gen_movdi As the test case shows, the outer mode may have a higher alignment requirement than the inner mode here. 2021-04-27 Bernd Edlinger PR target/100106 * simplify-rtx.c (simplify_context::simplify_subreg): Check the memory alignment for the outer mode. * gcc.c-torture/compile/pr100106.c: New testcase. --- gcc/testsuite/gcc.c-torture/compile/pr100106.c | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr100106.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.c-torture/compile/pr100106.c b/gcc/testsuite/gcc.c-torture/compile/pr100106.c new file mode 100644 index 0000000..7f98b4f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr100106.c @@ -0,0 +1,11 @@ +union a { + float _Complex b; + long long c; +}; + +void g(union a); + +void e() { + union a f = {1.0f}; + g(f); +} -- cgit v1.1 From 2ae2a45c287d254c2890feff2cca46ed2ddb06ca Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Tue, 27 Apr 2021 11:00:53 -0600 Subject: Remove malformed dg-warning directives. gcc/testsuite/ChangeLog: PR testsuite/100272 * g++.dg/ext/flexary13.C: Remove malformed directives. --- gcc/testsuite/g++.dg/ext/flexary13.C | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/ext/flexary13.C b/gcc/testsuite/g++.dg/ext/flexary13.C index f0603f9..1acfa2e 100644 --- a/gcc/testsuite/g++.dg/ext/flexary13.C +++ b/gcc/testsuite/g++.dg/ext/flexary13.C @@ -17,44 +17,40 @@ int32_t i = 12345678; int main () { { + // OK. Does not assign any elements to flexible array. Ax s = { 0 }; ASSERT (s.n == 0); } { - static Ax s = - { 0, { } }; // dg-warning "initialization of a flexible array member" } + // OK only for statically allocated objects, otherwise error. + static Ax s = { 0, { } }; ASSERT (s.n == 0); } { - static Ax s = - { 1, { 2 } }; // dg-warning "initialization of a flexible array member" } + static Ax s = { 1, { 2 } }; ASSERT (s.n == 1 && s.a [0] == 2); } { - static Ax s = - { 2, { 3, 4 } }; // dg-warning "initialization of a flexible array member" } + static Ax s = { 2, { 3, 4 } }; ASSERT (s.n = 2 && s.a [0] == 3 && s.a [1] == 4); } { - static Ax s = - { 123, i }; // dg-warning "initialization of a flexible array member" } + static Ax s = { 123, i }; ASSERT (s.n == 123 && s.a [0] == i); } { - static Ax s = - { 456, { i } }; // dg-warning "initialization of a flexible array member" } + static Ax s = { 456, { i } }; ASSERT (s.n == 456 && s.a [0] == i); } { int32_t j = i + 1, k = j + 1; - static Ax s = - { 3, { i, j, k } }; // dg-warning "initialization of a flexible array member" } + static Ax s = { 3, { i, j, k } }; ASSERT (s.n == 3 && s.a [0] == i && s.a [1] == j && s.a [2] == k); } { - AAx s = - { 1, { 2 } }; // dg-warning "initialization of a flexible array member" } + // OK. Does not assign any elements to flexible array. + AAx s = { 1, { 2 } }; ASSERT (s.i == 1 && s.ax.n == 2); } } -- cgit v1.1 From d0a57b030f1c7df33c6bc3c661d16c9cb79e96dd Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Tue, 27 Apr 2021 18:30:36 +0100 Subject: Fix handling of VEC_COND_EXPR trap tests [PR100284] Now that VEC_COND_EXPR has normal unnested operands, operation_could_trap_p can treat it like any other expression. This fixes many testsuite ICEs for SVE, but it turns out that none of the tests in gcc.target/aarch64/sve were affected. Anyone testing on non-SVE aarch64 therefore wouldn't have seen it. gcc/ PR middle-end/100284 * gimple.c (gimple_could_trap_p_1): Remove VEC_COND_EXPR test. * tree-eh.c (operation_could_trap_p): Handle VEC_COND_EXPR rather than asserting on it. gcc/testsuite/ PR middle-end/100284 * gcc.target/aarch64/sve/pr81003.c: New test. --- gcc/testsuite/gcc.target/aarch64/sve/pr81003.c | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/pr81003.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr81003.c b/gcc/testsuite/gcc.target/aarch64/sve/pr81003.c new file mode 100644 index 0000000..661a6f9 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/pr81003.c @@ -0,0 +1,10 @@ +/* { dg-options "-O3" } */ + +unsigned int a, b; + +void +foo (void) +{ + for (b = 0; b < 13; b += 2) + a &= !!b; +} -- cgit v1.1 From 37d2b98100cefcb9d312d379473c12aa6d61fc62 Mon Sep 17 00:00:00 2001 From: Patrick Palka Date: Tue, 27 Apr 2021 14:18:25 -0400 Subject: c++: Fix Bases(args...)... base initialization [PR88580] When substituting into the arguments of a base initializer pack expansion, tsubst_initializer_list uses a dummy EXPR_PACK_EXPANSION in order to expand an initializer such as Bases(args)... into Bases#{0}(args#{0}) and so on. But when an argument inside the base initializer is itself a pack expansion, as in Bases(args...)..., the argument is already an EXPR_PACK_EXPANSION so we don't need to wrap it. It's also independent from the outer expansion of Bases, so we need to "multiplicatively" append the expansion of args... onto the argument list of each expanded base. gcc/cp/ChangeLog: PR c++/88580 * pt.c (tsubst_initializer_list): Correctly handle the case where an argument inside a base initializer pack expansion is itself a pack expansion. gcc/testsuite/ChangeLog: PR c++/88580 * g++.dg/cpp0x/variadic182.C: New test. --- gcc/testsuite/g++.dg/cpp0x/variadic182.C | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic182.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic182.C b/gcc/testsuite/g++.dg/cpp0x/variadic182.C new file mode 100644 index 0000000..078de74 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/variadic182.C @@ -0,0 +1,18 @@ +// PR c++/88580 +// { dg-do compile { target c++11 } } + +template +struct Derived : Bases... { + template + Derived(Ts... args) : Bases(args, args..., args)... { } +}; + +struct A { }; +struct B { }; +struct C { }; + +struct Base1 { Base1(A, A, B, C, A); }; +struct Base2 { Base2(B, A, B, C, B); }; +struct Base3 { Base3(C, A, B, C, C); }; + +Derived d(A{}, B{}, C{}); -- cgit v1.1 From 37846c42f1f5ac4d9ba190d49c4373673c89c8b5 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 23 Apr 2021 16:41:35 -0400 Subject: c++: -Wdeprecated-copy and using operator= [PR92145] For the purpose of [depr.impldec] "if the class has a user-declared copy assignment operator", an operator= brought in from a base class with 'using' may be a copy-assignment operator, but it isn't a copy-assignment operator for the derived class. gcc/cp/ChangeLog: PR c++/92145 * class.c (classtype_has_depr_implicit_copy): Check DECL_CONTEXT of operator=. gcc/testsuite/ChangeLog: PR c++/92145 * g++.dg/cpp0x/depr-copy3.C: New test. --- gcc/testsuite/g++.dg/cpp0x/depr-copy3.C | 35 +++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/depr-copy3.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp0x/depr-copy3.C b/gcc/testsuite/g++.dg/cpp0x/depr-copy3.C new file mode 100644 index 0000000..c303c9d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/depr-copy3.C @@ -0,0 +1,35 @@ +// PR c++/92145 +// { dg-do compile { target c++11 } } +// { dg-additional-options "-Wdeprecated-copy" } + +struct base +{ + base() { } + base(const base&) { } + base(base&&) { } + base& operator=(const base&) { return *this; } + base& operator=(base&&) { return *this; } +}; + +struct foo : base +{ + //using base::base; + using base::operator=; +}; + +struct bar +{ + bar& operator=(foo v) + { + value = v; + return *this; + } + + foo value; +}; + +int main() +{ + foo a; + foo{a}; +} -- cgit v1.1 From 8f54dd61e79842eebf678571b9987bda7502f3aa Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 28 Apr 2021 00:16:36 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 108 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 26c41ac..122dddc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,111 @@ +2021-04-27 Jason Merrill + + PR c++/92145 + * g++.dg/cpp0x/depr-copy3.C: New test. + +2021-04-27 Patrick Palka + + PR c++/88580 + * g++.dg/cpp0x/variadic182.C: New test. + +2021-04-27 Richard Sandiford + + PR middle-end/100284 + * gcc.target/aarch64/sve/pr81003.c: New test. + +2021-04-27 Martin Sebor + + PR testsuite/100272 + * g++.dg/ext/flexary13.C: Remove malformed directives. + +2021-04-27 Bernd Edlinger + + PR target/100106 + * gcc.c-torture/compile/pr100106.c: New testcase. + +2021-04-27 Alex Coplan + + PR target/99977 + * gcc.target/arm/pr99977.c: New test. + +2021-04-27 Jakub Jelinek + + PR tree-optimization/100239 + * gcc.dg/pr100239.c: New test. + +2021-04-27 Jakub Jelinek + + PR rtl-optimization/100254 + * g++.dg/opt/pr100254.C: New test. + +2021-04-27 Richard Biener + + PR tree-optimization/99912 + * gcc.dg/tree-ssa/ldist-33.c: Disable PRE and LIM. + * gcc.dg/tree-ssa/pr96789.c: Adjust dump file scanned. + * gcc.dg/tree-ssa/ssa-dse-28.c: Likewise. + * gcc.dg/tree-ssa/ssa-dse-29.c: Likewise. + +2021-04-27 Jakub Jelinek + + PR tree-optimization/95527 + * gcc.dg/tree-ssa/pr95527-2.c: New test. + +2021-04-27 Jakub Jelinek + + PR tree-optimization/96696 + * gcc.target/i386/pr96696.c: New test. + +2021-04-27 Richard Sandiford + + PR target/100270 + * gcc.target/aarch64/sve/acle/general-c/pr100270_1.c: New test. + * gcc.target/aarch64/sve/acle/general-c/sizeless-2.c: Change + expected error message when subtracting pointers to different + vector types. Expect warnings when mixing them elsewhere. + * gcc.target/aarch64/sve/acle/general/attributes_7.c: Remove + XFAILs. Tweak error messages for some cases. + +2021-04-27 Richard Sandiford + + * gcc.target/aarch64/simd/ssra.c: Use +nosve + * gcc.target/aarch64/simd/usra.c: Likewise. + +2021-04-27 Richard Biener + + PR tree-optimization/100051 + * gcc.dg/tree-ssa/ssa-fre-92.c: New testcase. + +2021-04-27 Richard Biener + + PR testsuite/100272 + * gcc.dg/tree-ssa/predcom-1.c: Re-enable PRE and fix + malformed dg directive. + +2021-04-27 Richard Biener + + PR testsuite/100272 + * g++.dg/diagnostic/ptrtomem1.C: Fix dg directives. + * g++.dg/ipa/pr45572-2.C: Likewise. + * g++.dg/template/spec26.C: Likewise. + * gcc.dg/pr20126.c: Likewise. + * gcc.dg/tree-ssa/pr20739.c: Likewise. + +2021-04-27 Richard Biener + + PR tree-optimization/100278 + * gcc.dg/tree-ssa/pr100278.c: New testcase. + +2021-04-27 Jakub Jelinek + + PR target/99405 + * gcc.target/i386/pr99405.c: New test. + +2021-04-27 Richard Biener + + PR tree-optimization/99776 + * gcc.dg/tree-ssa/ssa-fre-91.c: New testcase. + 2021-04-26 Patrick Palka PR c++/100209 -- cgit v1.1 From 852dd866e2faba95cb407c98d31a48b6aae66677 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Wed, 28 Apr 2021 09:43:02 +0200 Subject: Fix loss of optimization of array iteration due to inlining This helps loop-invariant motion to hoist complicated offset computations. gcc/ada/ * gcc-interface/trans.c (language_function): Add comment. (loop_info_d): Add fndecl and invariants fields. (find_loop_for): Test fndecl instead of the context of var. (find_loop): New function. (Regular_Loop_to_gnu): Fold back into... (Loop_Statement_to_gnu): ...this. Emit invariants on entry, if any. (gnat_to_gnu) : Record nonconstant invariant offset computations in loops when optimization is enabled. * gcc-interface/utils2.c (gnat_invariant_expr): Handle BIT_AND_EXPR. gcc/testsuite/ * gnat.dg/opt93.ads, gnat.dg/opt93.adb: New test. --- gcc/testsuite/gnat.dg/opt93.adb | 20 ++++++++++++++++++++ gcc/testsuite/gnat.dg/opt93.ads | 14 ++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 gcc/testsuite/gnat.dg/opt93.adb create mode 100644 gcc/testsuite/gnat.dg/opt93.ads (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gnat.dg/opt93.adb b/gcc/testsuite/gnat.dg/opt93.adb new file mode 100644 index 0000000..5c82ad2 --- /dev/null +++ b/gcc/testsuite/gnat.dg/opt93.adb @@ -0,0 +1,20 @@ +-- { dg-do compile } +-- { dg-options "-O2 -fdump-tree-optimized" } + +package body Opt93 is + + function Worker (Obj : T) return Boolean is + begin + return (for some J in 1 .. Obj.D2 => Obj.A (J) = 0); + end; + + function Contains_Zero (Obj : T) return Boolean is + begin + return Worker (Obj); + exception + when Others => raise Program_Error; + end; + +end Opt93; + +-- { dg-final { scan-tree-dump "ivtmp.\[0-9_]+ = ivtmp.\[0-9_]+ \\+ 2" "optimized" } } diff --git a/gcc/testsuite/gnat.dg/opt93.ads b/gcc/testsuite/gnat.dg/opt93.ads new file mode 100644 index 0000000..61bc236 --- /dev/null +++ b/gcc/testsuite/gnat.dg/opt93.ads @@ -0,0 +1,14 @@ +package Opt93 is + + type Arr is array (Natural range <>) of Short_Integer; + + type Rec (D1, D2 : Natural) is record + S : String (1 .. D1); + A : Arr (1 .. D2); + end record; + + type T is access Rec; + + function Contains_Zero (Obj : T) return Boolean; + +end Opt93; -- cgit v1.1 From 5b4b66291f2086f56dc3a1d7df494f901cd0b63e Mon Sep 17 00:00:00 2001 From: Richard Wai Date: Mon, 15 Mar 2021 06:24:00 -0400 Subject: [Ada] Hashed container Cursor type predefined equality non-conformance gcc/ada/ * libgnat/a-cohase.ads (Cursor): Synchronize comments for the Cursor type definition to be consistent with identical definitions in other container packages. Add additional comments regarding the importance of maintaining the "Position" component for predefined equality. * libgnat/a-cohama.ads (Cursor): Likewise. * libgnat/a-cihama.ads (Cursor): Likewise. * libgnat/a-cohase.adb (Find, Insert): Ensure that Cursor objects always have their "Position" component set to ensure predefined equality works as required. * libgnat/a-cohama.adb (Find, Insert): Likewise. * libgnat/a-cihama.adb (Find, Insert): Likewise. gcc/testsuite/ * gnat.dg/containers2.adb: New test. --- gcc/testsuite/gnat.dg/containers2.adb | 158 ++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 gcc/testsuite/gnat.dg/containers2.adb (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gnat.dg/containers2.adb b/gcc/testsuite/gnat.dg/containers2.adb new file mode 100644 index 0000000..9c5dc0f --- /dev/null +++ b/gcc/testsuite/gnat.dg/containers2.adb @@ -0,0 +1,158 @@ +-- { dg-do run } +-- { dg-options "-gnata" } + +with Ada.Strings.Hash; +with Ada.Containers.Hashed_Sets; +with Ada.Containers.Hashed_Maps; +with Ada.Containers.Indefinite_Hashed_Sets; +with Ada.Containers.Indefinite_Hashed_Maps; + +procedure Containers2 is + -- Check that Cursors of the hashed containers follow the correct + -- predefined equality rules - that two Cursors to the same element + -- are equal, one one is obtained through, for example, iteration, + -- and the other is obtained through a search + + subtype Definite_Name is String (1 .. 5); + + type Named_Item is + record + Name : Definite_Name; + Item : Integer := 0; + end record; + + + function Equivalent_Item (Left, Right: Named_Item) return Boolean + is (Left.Name = Right.Name); + + function DI_Hash (Item: Named_Item) return Ada.Containers.Hash_Type + is (Ada.Strings.Hash (Item.Name)); + + package HS is new Ada.Containers.Hashed_Sets + (Element_Type => Named_Item, + Hash => DI_Hash, + Equivalent_Elements => Equivalent_Item); + + package IHS is new Ada.Containers.Indefinite_Hashed_Sets + (Element_Type => Named_Item, + Hash => DI_Hash, + Equivalent_Elements => Equivalent_Item); + + package HM is new Ada.Containers.Hashed_Maps + (Key_Type => Definite_Name, + Element_Type => Integer, + Hash => Ada.Strings.Hash, + Equivalent_Keys => "="); + + package IHM is new Ada.Containers.Indefinite_Hashed_Maps + (Key_Type => Definite_Name, + Element_Type => Integer, + Hash => Ada.Strings.Hash, + Equivalent_Keys => "="); + + Item_Data : constant array (1 .. 5) of Named_Item + := ((Name => "ABCDE", others => <>), + (Name => "FGHIJ", others => <>), + (Name => "KLMNO", others => <>), + (Name => "PQRST", others => <>), + (Name => "UVWXY", others => <>)); + + use type HS.Cursor; + use type IHS.Cursor; + use type HM.Cursor; + use type IHM.Cursor; + + type HS_Cursor_Vec is array (Item_Data'Range) of HS.Cursor; + type IHS_Cursor_Vec is array (Item_Data'Range) of IHS.Cursor; + type HM_Cursor_Vec is array (Item_Data'Range) of HM.Cursor; + type IHM_Cursor_Vec is array (Item_Data'Range) of IHM.Cursor; + + HSC : HS.Set; + IHSC : IHS.Set; + HMC : HM.Map; + IHMC : IHM.Map; + + HS_Create_Cursors : HS_Cursor_Vec; + IHS_Create_Cursors : IHS_Cursor_Vec; + HM_Create_Cursors : HM_Cursor_Vec; + IHM_Create_Cursors : IHM_Cursor_Vec; + + HS_Index : HS.Cursor; + IHS_Index : IHS.Cursor; + HM_Index : HM.Cursor; + IHM_Index : IHM.Cursor; + + HS_Find : HS.Cursor; + IHS_Find : IHS.Cursor; + HM_Find : HM.Cursor; + IHM_Find : IHM.Cursor; + + + Inserted : Boolean; + +begin + + for I in Item_Data'Range loop + HSC.Insert (New_Item => Item_Data(I), + Position => HS_Create_Cursors(I), + Inserted => Inserted); + + pragma Assert (Inserted); + + + IHSC.Insert (New_Item => Item_Data(I), + Position => IHS_Create_Cursors(I), + Inserted => Inserted); + + pragma Assert (Inserted); + + HMC.Insert (New_Item => Item_Data(I).Item, + Key => Item_Data(I).Name, + Position => HM_Create_Cursors(I), + Inserted => Inserted); + + pragma Assert (Inserted); + + IHMC.Insert (New_Item => Item_Data(I).Item, + Key => Item_Data(I).Name, + Position => IHM_Create_Cursors(I), + Inserted => Inserted); + + pragma Assert (Inserted); + + end loop; + + HS_Index := HSC.First; + IHS_Index := IHSC.First; + HM_Index := HMC.First; + IHM_Index := IHMC.First; + + for I in Item_Data'Range loop + pragma Assert (HS.Has_Element (HS_Index)); + pragma Assert (IHS.Has_Element (IHS_Index)); + pragma Assert (HM.Has_Element (HM_Index)); + pragma Assert (IHM.Has_Element (IHM_Index)); + + HS_Find := HSC.Find (Item_Data(I)); + pragma Assert (HS_Create_Cursors(I) = HS_Index); + pragma Assert (HS_Find = HS_Index); + + IHS_Find := IHSC.Find (Item_Data(I)); + pragma Assert (IHS_Create_Cursors(I) = IHS_Index); + pragma Assert (IHS_Find = IHS_Index); + + HM_Find := HMC.Find (Item_Data(I).Name); + pragma Assert (HM_Create_Cursors(I) = HM_Index); + pragma Assert (HM_Find = HM_Index); + + IHM_Find := IHMC.Find (Item_Data(I).Name); + pragma Assert (IHM_Create_Cursors(I) = IHM_Index); + pragma Assert (IHM_Find = IHM_Index); + + HS.Next (HS_Index); + IHS.Next (IHS_Index); + HM.Next (HM_Index); + IHM.Next (IHM_Index); + end loop; + +end; -- cgit v1.1 From f7ee6a1e8ac62950dd32874bf75e748a2895d595 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 28 Apr 2021 10:41:41 +0200 Subject: tree-optimization/100292 - avoid invalid GIMPLE from vector lowering We have to avoid folding the condition when building a COND_EXPR since we no longer gimplify the whole thing. The folding done at COND_EXPR build time will deal with possible simplifications. 2021-04-28 Richard Biener PR tree-optimization/100292 * tree-vect-generic.c (expand_vector_condition): Do not fold the comparisons. * gcc.dg/pr100292.c: New testcase. --- gcc/testsuite/gcc.dg/pr100292.c | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr100292.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/pr100292.c b/gcc/testsuite/gcc.dg/pr100292.c new file mode 100644 index 0000000..675a60c --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr100292.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ + +typedef unsigned char __attribute__((__vector_size__ (4))) V; + +extern void bar (V v); + +void +foo (char c) +{ + bar (c <= (V) 127); +} -- cgit v1.1 From b020cee5af4cb40b9971bfb943d7bd2795b2a3eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Rui=20Faustino=20de=20Sousa?= Date: Wed, 28 Apr 2021 11:20:25 +0000 Subject: Fortran: Fix double function call with -fcheck=pointer [PR] gcc/fortran/ChangeLog: PR fortran/82376 * trans-expr.c (gfc_conv_procedure_call): Evaluate function result and then pass a pointer. gcc/testsuite/ChangeLog: PR fortran/82376 * gfortran.dg/PR82376.f90: New test. --- gcc/testsuite/gfortran.dg/PR82376.f90 | 59 +++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/PR82376.f90 (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gfortran.dg/PR82376.f90 b/gcc/testsuite/gfortran.dg/PR82376.f90 new file mode 100644 index 0000000..07143ab --- /dev/null +++ b/gcc/testsuite/gfortran.dg/PR82376.f90 @@ -0,0 +1,59 @@ +! { dg-do compile } +! { dg-options "-fdump-tree-original -fcheck=pointer" } +! +! Test the fix for PR82376. The pointer check was doubling up the call +! to new. The fix reduces the count of 'new' from 5 to 4. +! +! Contributed by José Rui Faustino de Sousa +! +program main_p + + integer, parameter :: n = 10 + + type :: foo_t + integer, pointer :: v =>null() + end type foo_t + + integer, save :: pcnt = 0 + + type(foo_t) :: int + integer :: i + + do i = 1, n + call init(int, i) + if(.not.associated(int%v)) stop 1 + if(int%v/=i) stop 2 + if(pcnt/=i) stop 3 + end do + +contains + + function new(data) result(this) + integer, target, intent(in) :: data + + integer, pointer :: this + + nullify(this) + this => data + pcnt = pcnt + 1 + return + end function new + + subroutine init(this, data) + type(foo_t), intent(out) :: this + integer, intent(in) :: data + + call set(this, new(data)) + return + end subroutine init + + subroutine set(this, that) + type(foo_t), intent(inout) :: this + integer, target, intent(in) :: that + + this%v => that + return + end subroutine set + +end program main_p +! { dg-final { scan-tree-dump-times "new" 4 "original" } } -- cgit v1.1 From 668df9e769e7d89bcefa07f72b68dcae9a8f3970 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Wed, 28 Apr 2021 17:54:52 +0100 Subject: aarch64: Fix address mode for vec_concat pattern [PR100305] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The load_pair_lanes patterns match a vec_concat of two adjacent 64-bit memory locations as a single 128-bit load. The Utq constraint made sure that the address was suitable for a 128-bit vector, but this meant that it allowed some addresses that aren't valid for the 64-bit element mode. Two obvious fixes were: (1) Continue to accept addresses that aren't valid for the element modes. This would mean changing the mode of operands[1] before printing it. It would also mean using a custom predicate instead of the current memory_operand. (2) Restrict addresses to the intersection of those that are valid element and vector addresses. The problem with (1) is that, as well as being more complicated, it doesn't deal with the fact that we still have a memory_operand for the second element. If we encourage the first operand to be outside the range of a normal element memory_operand, we'll have to reload the second operand to make it valid. This reload will often be dead code, but will be kept around because the RTL pattern makes it look as though the second element address is still needed. This patch therefore does (2) instead. As mentioned in the PR notes, I think we have a general problem with the way that the aarch64 port deals with paired addresses. There's nothing to guarantee that the two addresses will be reloaded in a way that keeps them “obviously†adjacent, so the rtx_equal_p conditions could fail if something rechecked them later. For this particular pattern, I think it would be better to teach simplify-rtx.c to fold the vec_concat to a normal vector memory reference, to remove any suggestion that targets should try to match the unsimplified form. That obviously wouldn't be suitable for backports though. gcc/ PR target/100305 * config/aarch64/constraints.md (Utq): Require the address to be valid for both the element mode and for V2DImode. gcc/testsuite/ PR target/100305 * gcc.c-torture/compile/pr100305.c: New test. --- gcc/testsuite/gcc.c-torture/compile/pr100305.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr100305.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.c-torture/compile/pr100305.c b/gcc/testsuite/gcc.c-torture/compile/pr100305.c new file mode 100644 index 0000000..e098b90b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr100305.c @@ -0,0 +1,13 @@ +/* { dg-options "-O" } */ + +typedef double v2df __attribute__((vector_size(16))); + +#define N 4096 +void consume (void *); +v2df +foo (void) +{ + double x[N+2]; + consume (x); + return (v2df) { x[N], x[N + 1] }; +} -- cgit v1.1 From 16683cefc636636ba6fed23fe0de89ed19bc7876 Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Wed, 28 Apr 2021 14:07:41 -0300 Subject: fix asm-not pattern in dwarf2/inline5.c The test is supposed to check that the abstract lexical block of a function that was inlined doesn't have attributes, and that the concrete inlined lexical block does. There are two patterns to verify the absence of attributes in the abstract lexical block, one for the case in which the concrete block appears after the abstract one, and another for the case in which it's before. The former has a problem that is not visible when asm comments start with a single character, but that becomes apparent when they start with "/ ". The pattern starts by matching the abstract DW_TAG_lexical_block DIE header, and checking that the next line has, after any of the comment-starter characters (e.g. '/'), there are one or more blanks ' +', and then a character other than the '(' that would start another DIE. The problem is that '[.../...]+ +[^(].*' matches '/ (DIE...', because '[^(]' may match the second blank, and after that anything goes. So we end up recognizing the pattern, as if it was an abstract lexical block with an attribute. This could be minimally fixed by changing '[^(]' to '[^ (]', but the pattern that matches concrete before abstract checks for an explicit DW_AT after the abstract DIE, so I'm using that in the other pattern as well. For reference, the lines that start the unwanted match are: .uleb128 0xc / (DIE (0xa4) DW_TAG_lexical_block) .uleb128 0xd / (DIE (0xa5) DW_TAG_variable) for gcc/testsuite/ChangeLog * gcc.dg/debug/dwarf2/inline5.c: Adjust pattern to avoid mismatch when asm comments start with "/ ". --- gcc/testsuite/gcc.dg/debug/dwarf2/inline5.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/inline5.c b/gcc/testsuite/gcc.dg/debug/dwarf2/inline5.c index bd34f0d..3b50e9f 100644 --- a/gcc/testsuite/gcc.dg/debug/dwarf2/inline5.c +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/inline5.c @@ -9,7 +9,7 @@ /* We do not know which is output first so look for both invalid abstract origins on the lexical blocks (knowing that the abstract instance has no attribute following the DW_TAG_lexical_block. */ -/* { dg-final { scan-assembler-not "\\(DIE \\(0x(\[0-9a-f\]*)\\) DW_TAG_lexical_block\\)\[^#/!@;\\|\]*\[#/!@;\\|\]+ +\[^(\].*DW_TAG_lexical_block\\)\[^#/!@;\\|x\]*x\\1\[^#/!@;\\|\]*\[#/!@;\\|\] +DW_AT_abstract_origin" { xfail { { *-*-aix* || *-*-solaris2.* } && { ! gas } } } } } */ +/* { dg-final { scan-assembler-not "\\(DIE \\(0x(\[0-9a-f\]*)\\) DW_TAG_lexical_block\\)\[^#/!@;\\|\]*\[#/!@;\\|\]+ +DW_AT.*DW_TAG_lexical_block\\)\[^#/!@;\\|x\]*x\\1\[^#/!@;\\|\]*\[#/!@;\\|\] +DW_AT_abstract_origin" { xfail { { *-*-aix* || *-*-solaris2.* } && { ! gas } } } } } */ /* { dg-final { scan-assembler-not "DW_TAG_lexical_block\\)\[^#/!@;\\|x\]*x(\[0-9a-f\]*)\[^#/!@;\\|\]*\[#/!@;\\|\]+ +DW_AT_abstract_origin.*\\(DIE \\(0x\\1\\) DW_TAG_lexical_block\\)\[^#/!@;\\|\]*\[#/!@;\\|\]+ +DW_AT" } } */ int foo (int i) -- cgit v1.1 From da4a0817beb506bc1c05d85e783ba6ffd079a194 Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Wed, 28 Apr 2021 14:07:43 -0300 Subject: omit frame pointer in pr89676 This i386 test expects only two movl instructions. In configurations that --enable-frame-pointer, -O2 won't implicitly enable -fomit-frame-pointer, so we end up with a third movl to set up the frame pointer. This patch enables -fomit-frame-pointer explicitly, so that the result no longer depends on that configuration option. for gcc/testsuite/ChangeLog * gcc.target/i386/pr89676.c: Add -fomit-frame-pointer. --- gcc/testsuite/gcc.target/i386/pr89676.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/i386/pr89676.c b/gcc/testsuite/gcc.target/i386/pr89676.c index 164a9da..7afa1a1 100644 --- a/gcc/testsuite/gcc.target/i386/pr89676.c +++ b/gcc/testsuite/gcc.target/i386/pr89676.c @@ -1,6 +1,6 @@ /* PR rtl-optimization/89676 */ /* { dg-do compile { target ia32 } } */ -/* { dg-options "-O2 -mno-stv" } */ +/* { dg-options "-O2 -mno-stv -fomit-frame-pointer" } */ unsigned long long foo (unsigned long long i) -- cgit v1.1 From 54f0224d55a1b56dde092460ddf76913670e6efc Mon Sep 17 00:00:00 2001 From: Patrick McGehearty Date: Wed, 28 Apr 2021 19:14:48 +0000 Subject: Practical improvement to libgcc complex divide Correctness and performance test programs used during development of this project may be found in the attachment to: https://www.mail-archive.com/gcc-patches@gcc.gnu.org/msg254210.html Summary of Purpose This patch to libgcc/libgcc2.c __divdc3 provides an opportunity to gain important improvements to the quality of answers for the default complex divide routine (half, float, double, extended, long double precisions) when dealing with very large or very small exponents. The current code correctly implements Smith's method (1962) [2] further modified by c99's requirements for dealing with NaN (not a number) results. When working with input values where the exponents are greater than *_MAX_EXP/2 or less than -(*_MAX_EXP)/2, results are substantially different from the answers provided by quad precision more than 1% of the time. This error rate may be unacceptable for many applications that cannot a priori restrict their computations to the safe range. The proposed method reduces the frequency of "substantially different" answers by more than 99% for double precision at a modest cost of performance. Differences between current gcc methods and the new method will be described. Then accuracy and performance differences will be discussed. Background This project started with an investigation related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59714. Study of Beebe[1] provided an overview of past and recent practice for computing complex divide. The current glibc implementation is based on Robert Smith's algorithm [2] from 1962. A google search found the paper by Baudin and Smith [3] (same Robert Smith) published in 2012. Elen Kalda's proposed patch [4] is based on that paper. I developed two sets of test data by randomly distributing values over a restricted range and the full range of input values. The current complex divide handled the restricted range well enough, but failed on the full range more than 1% of the time. Baudin and Smith's primary test for "ratio" equals zero reduced the cases with 16 or more error bits by a factor of 5, but still left too many flawed answers. Adding debug print out to cases with substantial errors allowed me to see the intermediate calculations for test values that failed. I noted that for many of the failures, "ratio" was a subnormal. Changing the "ratio" test from check for zero to check for subnormal reduced the 16 bit error rate by another factor of 12. This single modified test provides the greatest benefit for the least cost, but the percentage of cases with greater than 16 bit errors (double precision data) is still greater than 0.027% (2.7 in 10,000). Continued examination of remaining errors and their intermediate computations led to the various tests of input value tests and scaling to avoid under/overflow. The current patch does not handle some of the rare and most extreme combinations of input values, but the random test data is only showing 1 case in 10 million that has an error of greater than 12 bits. That case has 18 bits of error and is due to subtraction cancellation. These results are significantly better than the results reported by Baudin and Smith. Support for half, float, double, extended, and long double precision is included as all are handled with suitable preprocessor symbols in a single source routine. Since half precision is computed with float precision as per current libgcc practice, the enhanced algorithm provides no benefit for half precision and would cost performance. Further investigation showed changing the half precision algorithm to use the simple formula (real=a*c+b*d imag=b*c-a*d) caused no loss of precision and modest improvement in performance. The existing constants for each precision: float: FLT_MAX, FLT_MIN; double: DBL_MAX, DBL_MIN; extended and/or long double: LDBL_MAX, LDBL_MIN are used for avoiding the more common overflow/underflow cases. This use is made generic by defining appropriate __LIBGCC2_* macros in c-cppbuiltin.c. Tests are added for when both parts of the denominator have exponents small enough to allow shifting any subnormal values to normal values all input values could be scaled up without risking overflow. That gained a clear improvement in accuracy. Similarly, when either numerator was subnormal and the other numerator and both denominator values were not too large, scaling could be used to reduce risk of computing with subnormals. The test and scaling values used all fit within the allowed exponent range for each precision required by the C standard. Float precision has more difficulty with getting correct answers than double precision. When hardware for double precision floating point operations is available, float precision is now handled in double precision intermediate calculations with the simple algorithm the same as the half-precision method of using float precision for intermediate calculations. Using the higher precision yields exact results for all tested input values (64-bit double, 32-bit float) with the only performance cost being the requirement to convert the four input values from float to double. If double precision hardware is not available, then float complex divide will use the same improved algorithm as the other precisions with similar change in performance. Further Improvement The most common remaining substantial errors are due to accuracy loss when subtracting nearly equal values. This patch makes no attempt to improve that situation. NOTATION For all of the following, the notation is: Input complex values: a+bi (a= real part, b= imaginary part) c+di Output complex value: e+fi = (a+bi)/(c+di) For the result tables: current = current method (SMITH) b1div = method proposed by Elen Kalda b2div = alternate method considered by Elen Kalda new = new method proposed by this patch DESCRIPTIONS of different complex divide methods: NAIVE COMPUTATION (-fcx-limited-range): e = (a*c + b*d)/(c*c + d*d) f = (b*c - a*d)/(c*c + d*d) Note that c*c and d*d will overflow or underflow if either c or d is outside the range 2^-538 to 2^512. This method is available in gcc when the switch -fcx-limited-range is used. That switch is also enabled by -ffast-math. Only one who has a clear understanding of the maximum range of all intermediate values generated by an application should consider using this switch. SMITH's METHOD (current libgcc): if(fabs(c) RBIG) || (FABS (a) > RBIG) || (FABS (b) > RBIG) ) { a = a * 0.5; b = b * 0.5; c = c * 0.5; d = d * 0.5; } /* minimize overflow/underflow issues when c and d are small */ else if (FABS (d) < RMIN2) { a = a * RMINSCAL; b = b * RMINSCAL; c = c * RMINSCAL; d = d * RMINSCAL; } else { if(((FABS (a) < RMIN) && (FABS (b) < RMAX2) && (FABS (d) < RMAX2)) || ((FABS (b) < RMIN) && (FABS (a) < RMAX2) && (FABS (d) < RMAX2))) { a = a * RMINSCAL; b = b * RMINSCAL; c = c * RMINSCAL; d = d * RMINSCAL; } } r = c/d; denom = (c*r) + d; if( r > RMIN ) { e = (a*r + b) / denom ; f = (b*r - a) / denom } else { e = (c * (a/d) + b) / denom; f = (c * (b/d) - a) / denom; } } [ only presenting the fabs(c) < fabs(d) case here, full code in patch. ] Before any computation of the answer, the code checks for any input values near maximum to allow down scaling to avoid overflow. These scalings almost never harm the accuracy since they are by 2. Values that are over RBIG are relatively rare but it is easy to test for them and allow aviodance of overflows. Testing for RMIN2 reveals when both c and d are less than [FLT|DBL]_EPSILON. By scaling all values by 1/EPSILON, the code converts subnormals to normals, avoids loss of accuracy and underflows in intermediate computations that otherwise might occur. If scaling a and b by 1/EPSILON causes either to overflow, then the computation will overflow whatever method is used. Finally, we test for either a or b being subnormal (RMIN) and if so, for the other three values being small enough to allow scaling. We only need to test a single denominator value since we have already determined which of c and d is larger. Next, r (the ratio of c to d) is checked for being near zero. Baudin and Smith checked r for zero. This code improves that approach by checking for values less than DBL_MIN (subnormal) covers roughly 12 times as many cases and substantially improves overall accuracy. If r is too small, then when it is used in a multiplication, there is a high chance that the result will underflow to zero, losing significant accuracy. That underflow is avoided by reordering the computation. When r is subnormal, the code replaces a*r (= a*(c/d)) with ((a/d)*c) which is mathematically the same but avoids the unnecessary underflow. TEST Data Two sets of data are presented to test these methods. Both sets contain 10 million pairs of complex values. The exponents and mantissas are generated using multiple calls to random() and then combining the results. Only values which give results to complex divide that are representable in the appropriate precision after being computed in quad precision are used. The first data set is labeled "moderate exponents". The exponent range is limited to -DBL_MAX_EXP/2 to DBL_MAX_EXP/2 for Double Precision (use FLT_MAX_EXP or LDBL_MAX_EXP for the appropriate precisions. The second data set is labeled "full exponents". The exponent range for these cases is the full exponent range including subnormals for a given precision. ACCURACY Test results: Note: The following accuracy tests are based on IEEE-754 arithmetic. Note: All results reporteed are based on use of fused multiply-add. If fused multiply-add is not used, the error rate increases, giving more 1 and 2 bit errors for both current and new complex divide. Differences between using fused multiply and not using it that are greater than 2 bits are less than 1 in a million. The complex divide methods are evaluated by determining the percentage of values that exceed differences in low order bits. If a "2 bit" test results show 1%, that would mean that 1% of 10,000,000 values (100,000) have either a real or imaginary part that differs from the quad precision result by more than the last 2 bits. Results are reported for differences greater than or equal to 1 bit, 2 bits, 8 bits, 16 bits, 24 bits, and 52 bits for double precision. Even when the patch avoids overflows and underflows, some input values are expected to have errors due to the potential for catastrophic roundoff from floating point subtraction. For example, when b*c and a*d are nearly equal, the result of subtraction may lose several places of accuracy. This patch does not attempt to detect or minimize this type of error, but neither does it increase them. I only show the results for Elen Kalda's method (with both 1 and 2 divides) and the new method for only 1 divide in the double precision table. In the following charts, lower values are better. current - current complex divide in libgcc b1div - Elen Kalda's method from Baudin & Smith with one divide b2div - Elen Kalda's method from Baudin & Smith with two divides new - This patch which uses 2 divides =================================================== Errors Moderate Dataset gtr eq current b1div b2div new ====== ======== ======== ======== ======== 1 bit 0.24707% 0.92986% 0.24707% 0.24707% 2 bits 0.01762% 0.01770% 0.01762% 0.01762% 8 bits 0.00026% 0.00026% 0.00026% 0.00026% 16 bits 0.00000% 0.00000% 0.00000% 0.00000% 24 bits 0% 0% 0% 0% 52 bits 0% 0% 0% 0% =================================================== Table 1: Errors with Moderate Dataset (Double Precision) Note in Table 1 that both the old and new methods give identical error rates for data with moderate exponents. Errors exceeding 16 bits are exceedingly rare. There are substantial increases in the 1 bit error rates for b1div (the 1 divide/2 multiplys method) as compared to b2div (the 2 divides method). These differences are minimal for 2 bits and larger error measurements. =================================================== Errors Full Dataset gtr eq current b1div b2div new ====== ======== ======== ======== ======== 1 bit 2.05% 1.23842% 0.67130% 0.16664% 2 bits 1.88% 0.51615% 0.50354% 0.00900% 8 bits 1.77% 0.42856% 0.42168% 0.00011% 16 bits 1.63% 0.33840% 0.32879% 0.00001% 24 bits 1.51% 0.25583% 0.24405% 0.00000% 52 bits 1.13% 0.01886% 0.00350% 0.00000% =================================================== Table 2: Errors with Full Dataset (Double Precision) Table 2 shows significant differences in error rates. First, the difference between b1div and b2div show a significantly higher error rate for the b1div method both for single bit errros and well beyond. Even for 52 bits, we see the b1div method gets completely wrong answers more than 5 times as often as b2div. To retain comparable accuracy with current complex divide results for small exponents and due to the increase in errors for large exponents, I choose to use the more accurate method of two divides. The current method has more 1.6% of cases where it is getting results where the low 24 bits of the mantissa differ from the correct answer. More than 1.1% of cases where the answer is completely wrong. The new method shows less than one case in 10,000 with greater than two bits of error and only one case in 10 million with greater than 16 bits of errors. The new patch reduces 8 bit errors by a factor of 16,000 and virtually eliminates completely wrong answers. As noted above, for architectures with double precision hardware, the new method uses that hardware for the intermediate calculations before returning the result in float precision. Testing of the new patch has shown zero errors found as seen in Tables 3 and 4. Correctness for float ============================= Errors Moderate Dataset gtr eq current new ====== ======== ======== 1 bit 28.68070% 0% 2 bits 0.64386% 0% 8 bits 0.00401% 0% 16 bits 0.00001% 0% 24 bits 0% 0% ============================= Table 3: Errors with Moderate Dataset (float) ============================= Errors Full Dataset gtr eq current new ====== ======== ======== 1 bit 19.98% 0% 2 bits 3.20% 0% 8 bits 1.97% 0% 16 bits 1.08% 0% 24 bits 0.55% 0% ============================= Table 4: Errors with Full Dataset (float) As before, the current method shows an troubling rate of extreme errors. There very minor changes in accuracy for half-precision since the code changes from Smith's method to the simple method. 5 out of 1 million test cases show correct answers instead of 1 or 2 bit errors. libgcc computes half-precision functions in float precision allowing the existing methods to avoid overflow/underflow issues for the allowed range of exponents for half-precision. Extended precision (using x87 80-bit format on x86) and Long double (using IEEE-754 128-bit on x86 and aarch64) both have 15-bit exponents as compared to 11-bit exponents in double precision. We note that the C standard also allows Long Double to be implemented in the equivalent range of Double. The RMIN2 and RMINSCAL constants are selected to work within the Double range as well as with extended and 128-bit ranges. We will limit our performance and accurancy discussions to the 80-bit and 128-bit formats as seen on x86 here. The extended and long double precision investigations were more limited. Aarch64 does not support extended precision but does support the software implementation of 128-bit long double precision. For x86, long double defaults to the 80-bit precision but using the -mlong-double-128 flag switches to using the software implementation of 128-bit precision. Both 80-bit and 128-bit precisions have the same exponent range, with the 128-bit precision has extended mantissas. Since this change is only aimed at avoiding underflow/overflow for extreme exponents, I studied the extended precision results on x86 for 100,000 values. The limited exponent dataset showed no differences. For the dataset with full exponent range, the current and new values showed major differences (greater than 32 bits) in 567 cases out of 100,000 (0.56%). In every one of these cases, the ratio of c/d or d/c (as appropriate) was zero or subnormal, indicating the advantage of the new method and its continued correctness where needed. PERFORMANCE Test results In order for a library change to be practical, it is necessary to show the slowdown is tolerable. The slowdowns observed are much less than would be seen by (for example) switching from hardware double precison to a software quad precision, which on the tested machines causes a slowdown of around 100x). The actual slowdown depends on the machine architecture. It also depends on the nature of the input data. If underflow/overflow is rare, then implementations that have strong branch prediction will only slowdown by a few cycles. If underflow/overflow is common, then the branch predictors will be less accurate and the cost will be higher. Results from two machines are presented as examples of the overhead for the new method. The one labeled x86 is a 5 year old Intel x86 processor and the one labeled aarch64 is a 3 year old arm64 processor. In the following chart, the times are averaged over a one million value data set. All values are scaled to set the time of the current method to be 1.0. Lower values are better. A value of less than 1.0 would be faster than the current method and a value greater than 1.0 would be slower than the current method. ================================================ Moderate set full set x86 aarch64 x86 aarch64 ======== =============== =============== float 0.59 0.79 0.45 0.81 double 1.04 1.24 1.38 1.56 long double 1.13 1.24 1.29 1.25 ================================================ Table 5: Performance Comparisons (ratio new/current) The above tables omit the timing for the 1 divide and 2 multiply comparison with the 2 divide approach. The float results show clear performance improvement due to using the simple method with double precision for intermediate calculations. The double results with the newer method show less overhead for the moderate dataset than for the full dataset. That's because the moderate dataset does not ever take the new branches which protect from under/overflow. The better the branch predictor, the lower the cost for these untaken branches. Both platforms are somewhat dated, with the x86 having a better branch predictor which reduces the cost of the additional branches in the new code. Of course, the relative slowdown may be greater for some architectures, especially those with limited branch prediction combined with a high cost of misprediction. The long double results are fairly consistent in showing the moderate additional cost of the extra branches and calculations for all cases. The observed cost for all precisions is claimed to be tolerable on the grounds that: (a) the cost is worthwhile considering the accuracy improvement shown. (b) most applications will only spend a small fraction of their time calculating complex divide. (c) it is much less than the cost of extended precision (d) users are not forced to use it (as described below) Those users who find this degree of slowdown unsatisfactory may use the gcc switch -fcx-fortran-rules which does not use the library routine, instead inlining Smith's method without the C99 requirement for dealing with NaN results. The proposed patch for libgcc complex divide does not affect the code generated by -fcx-fortran-rules. SUMMARY When input data to complex divide has exponents whose absolute value is less than half of *_MAX_EXP, this patch makes no changes in accuracy and has only a modest effect on performance. When input data contains values outside those ranges, the patch eliminates more than 99.9% of major errors with a tolerable cost in performance. In comparison to Elen Kalda's method, this patch introduces more performance overhead but reduces major errors by a factor of greater than 4000. REFERENCES [1] Nelson H.F. Beebe, "The Mathematical-Function Computation Handbook. Springer International Publishing AG, 2017. [2] Robert L. Smith. Algorithm 116: Complex division. Commun. ACM, 5(8):435, 1962. [3] Michael Baudin and Robert L. Smith. "A robust complex division in Scilab," October 2012, available at http://arxiv.org/abs/1210.4539. [4] Elen Kalda: Complex division improvements in libgcc https://gcc.gnu.org/legacy-ml/gcc-patches/2019-08/msg01629.html 2020-12-08 Patrick McGehearty gcc/c-family/ * c-cppbuiltin.c (c_cpp_builtins): Add supporting macros for new complex divide libgcc/ * libgcc2.c (XMTYPE, XCTYPE, RBIG, RMIN, RMIN2, RMINSCAL, RMAX2): Define. (__divsc3, __divdc3, __divxc3, __divtc3): Improve complex divide. * config/rs6000/_divkc3.c (RBIG, RMIN, RMIN2, RMINSCAL, RMAX2): Define. (__divkc3): Improve complex divide. gcc/testsuite/ * gcc.c-torture/execute/ieee/cdivchkd.c: New test. * gcc.c-torture/execute/ieee/cdivchkf.c: Likewise. * gcc.c-torture/execute/ieee/cdivchkld.c: Likewise. --- .../gcc.c-torture/execute/ieee/cdivchkd.c | 126 ++++++++++++++++ .../gcc.c-torture/execute/ieee/cdivchkf.c | 125 +++++++++++++++ .../gcc.c-torture/execute/ieee/cdivchkld.c | 168 +++++++++++++++++++++ 3 files changed, 419 insertions(+) create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/cdivchkd.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/cdivchkf.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/cdivchkld.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/cdivchkd.c b/gcc/testsuite/gcc.c-torture/execute/ieee/cdivchkd.c new file mode 100644 index 0000000..3ef5fad --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/cdivchkd.c @@ -0,0 +1,126 @@ +/* + Program to test complex divide for correct results on selected values. + Checking known failure points. +*/ + +#include + +extern void abort (void); +extern void exit (int); + +extern int ilogb (double); +int match (double _Complex, double _Complex); + +#define SMALL DBL_MIN +#define MAXBIT DBL_MANT_DIG +#define ERRLIM 6 + +/* + Compare c (computed value) with z (expected value). + Return 0 if within allowed range. Return 1 if not. +*/ +int match (double _Complex c, double _Complex z) +{ + double rz, iz, rc, ic; + double rerr, ierr, rmax; + int biterr; + rz = __real__ z; + iz = __imag__ z; + rc = __real__ c; + ic = __imag__ c; + + if (__builtin_fabs (rz) > SMALL) + { + rerr = __builtin_fabs (rz - rc) / __builtin_fabs (rz); + } + else if (__builtin_fabs (rz) == 0.0) + { + rerr = __builtin_fabs (rc); + } + else + { + rerr = __builtin_fabs (rz - rc) / SMALL; + } + + if (__builtin_fabs (iz) > SMALL) + { + ierr = __builtin_fabs (iz - ic) / __builtin_fabs (iz); + } + else if (__builtin_fabs (iz) == 0.0) + { + ierr = __builtin_fabs (ic); + } + else + { + ierr = __builtin_fabs (iz - ic) / SMALL; + } + rmax = __builtin_fmax(rerr, ierr); + biterr = 0; + if ( rmax != 0.0) + { + biterr = ilogb (rmax) + MAXBIT + 1; + } + + if (biterr >= ERRLIM) + return 0; + else + return 1; +} + + +int main (int argc, char** argv) +{ + double _Complex a,b,c,z; + double xr[4], xi[4], yr[4], yi[4], zr[4], zi[4]; + double cr, ci; + int i; + int ok = 1; + xr[0] = -0x1.16e7fad79e45ep+651; + xi[0] = -0x1.f7f75b94c6c6ap-860; + yr[0] = -0x1.2f40d8ff7e55ep+245; + yi[0] = -0x0.0000000004ebcp-1022; + zr[0] = 0x1.d6e4b0e282869p+405; + zi[0] = -0x1.e9095e311e706p-900; + + xr[1] = -0x1.21ff587f953d3p-310; + xi[1] = -0x1.5a526dcc59960p+837; + yr[1] = 0x1.b88b8b552eaadp+735; + yi[1] = -0x1.873e2d6544d92p-327; + zr[1] = 0x1.65734a88b2de0p-961; + zi[1] = -0x1.927e85b8b5770p+101; + + xr[2] = 0x1.4612e41aa8080p-846; + xi[2] = -0x0.0000000613e07p-1022; + yr[2] = 0x1.df9cd0d58caafp-820; + yi[2] = -0x1.e47051a9036dbp-584; + zr[2] = 0x1.9b194f3fffa32p-469; + zi[2] = 0x1.58a00ab740a6bp-263; + + xr[3] = 0x1.cb27eece7c585p-355; + xi[3] = 0x0.000000223b8a8p-1022; + yr[3] = -0x1.74e7ed2b9189fp-22; + yi[3] = 0x1.3d80439e9a119p-731; + zr[3] = -0x1.3b35ed806ae5ap-333; + zi[3] = -0x0.05e01bcbfd9f6p-1022; + + + for (i = 0; i < 4; i++) + { + __real__ a = xr[i]; + __imag__ a = xi[i]; + __real__ b = yr[i]; + __imag__ b = yi[i]; + __real__ z = zr[i]; + __imag__ z = zi[i]; + c = a / b; + cr = __real__ c; + ci = __imag__ c; + + if (!match (c,z)){ + ok = 0; + } + } + if (!ok) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/cdivchkf.c b/gcc/testsuite/gcc.c-torture/execute/ieee/cdivchkf.c new file mode 100644 index 0000000..adf1ed9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/cdivchkf.c @@ -0,0 +1,125 @@ +/* + Program to test complex divide for correct results on selected values. + Checking known failure points. +*/ + +#include + +extern void abort (void); +extern void exit (int); + +extern int ilogbf (float); +int match (float _Complex, float _Complex); + +#define SMALL FLT_MIN +#define MAXBIT FLT_MANT_DIG +#define ERRLIM 6 + +/* + Compare c (computed value) with z (expected value). + Return 0 if within allowed range. Return 1 if not. +*/ +int match (float _Complex c, float _Complex z) +{ + float rz, iz, rc, ic; + float rerr, ierr, rmax; + int biterr; + rz = __real__ z; + iz = __imag__ z; + rc = __real__ c; + ic = __imag__ c; + + if (__builtin_fabsf (rz) > SMALL) + { + rerr = __builtin_fabsf (rz - rc) / __builtin_fabsf (rz); + } + else if (__builtin_fabsf (rz) == 0.0) + { + rerr = __builtin_fabsf (rc); + } + else + { + rerr = __builtin_fabsf (rz - rc) / SMALL; + } + + if (__builtin_fabsf (iz) > SMALL) + { + ierr = __builtin_fabsf (iz - ic) / __builtin_fabsf (iz); + } + else if (__builtin_fabsf (iz) == 0.0) + { + ierr = __builtin_fabsf (ic); + } + else + { + ierr = __builtin_fabsf (iz - ic) / SMALL; + } + rmax = __builtin_fmaxf(rerr, ierr); + biterr = 0; + if ( rmax != 0.0) + { + biterr = ilogbf (rmax) + MAXBIT + 1; + } + + if (biterr >= ERRLIM) + return 0; + else + return 1; +} + + +int main(int argc, char** argv) +{ + float _Complex a,b,c,z; + float xr[4], xi[4], yr[4], yi[4], zr[4], zi[4]; + float cr, ci; + int i; + int ok = 1; + xr[0] = 0x1.0b1600p-133; + xi[0] = 0x1.5e1c28p+54; + yr[0] = -0x1.cdec8cp-119; + yi[0] = 0x1.1e72ccp+32; + zr[0] = 0x1.38e502p+22; + zi[0] = -0x1.f89220p-129; + + xr[1] = -0x1.b1bee2p+121; + xi[1] = -0x1.cb403ep-59; + yr[1] = 0x1.480000p-144; + yi[1] = -0x1.c66fc4p+5; + zr[1] = -0x1.60b8cap-34; + zi[1] = -0x1.e8b02ap+115; + + xr[2] = -0x1.3f6e00p-97; + xi[2] = -0x1.c00000p-146; + yr[2] = 0x1.000000p-148; + yi[2] = -0x1.0c4e70p-91; + zr[2] = 0x1.aa50d0p-55; + zi[2] = -0x1.30c746p-6; + + xr[3] = 0x1.000000p-148; + xi[3] = 0x1.f4bc04p-84; + yr[3] = 0x1.00ad74p-20; + yi[3] = 0x1.2ad02ep-85; + zr[3] = 0x1.1102ccp-127; + zi[3] = 0x1.f369a4p-64; + + for (i = 0; i < 4; i++) + { + __real__ a = xr[i]; + __imag__ a = xi[i]; + __real__ b = yr[i]; + __imag__ b = yi[i]; + __real__ z = zr[i]; + __imag__ z = zi[i]; + c = a / b; + cr = __real__ c; + ci = __imag__ c; + + if (!match (c,z)){ + ok = 0; + } + } + if (!ok) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/cdivchkld.c b/gcc/testsuite/gcc.c-torture/execute/ieee/cdivchkld.c new file mode 100644 index 0000000..ffe9c34 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/cdivchkld.c @@ -0,0 +1,168 @@ +/* + Program to test complex divide for correct results on selected values. + Checking known failure points. +*/ + +#include + +extern void abort (void); +extern void exit (int); + +extern int ilogbl (long double); +int match (long double _Complex,long double _Complex); + +#define SMALL LDBL_MIN +#define MAXBIT LDBL_MANT_DIG +#define ERRLIM 6 + +/* + Compare c (computed value) with z (expected value). + Return 0 if within allowed range. Return 1 if not. +*/ +int match (long double _Complex c,long double _Complex z) +{ + long double rz, iz, rc, ic; + long double rerr, ierr, rmax; + int biterr; + rz = __real__ z; + iz = __imag__ z; + rc = __real__ c; + ic = __imag__ c; + + if (__builtin_fabsl (rz) > SMALL) + { + rerr = __builtin_fabsl (rz - rc) / __builtin_fabsl(rz); + } + else if (__builtin_fabsl (rz) == 0.0) + { + rerr = __builtin_fabsl (rc); + } + else + { + rerr = __builtin_fabsl (rz - rc) / SMALL; + } + + if (__builtin_fabsl (iz) > SMALL) + { + ierr = __builtin_fabsl (iz - ic) / __builtin_fabsl(iz); + } + else if (__builtin_fabsl (iz) == 0.0) + { + ierr = __builtin_fabsl (ic); + } + else + { + ierr = __builtin_fabsl (iz - ic) / SMALL; + } + rmax = __builtin_fmaxl (rerr, ierr); + biterr = 0; + if ( rmax != 0.0) + { + biterr = ilogbl (rmax) + MAXBIT + 1; + } + + if (biterr >= ERRLIM) + return 0; + else + return 1; +} + + +int main (int argc, char** argv) +{ + long double _Complex a,b,c,z; + long double xr[4], xi[4], yr[4], yi[4], zr[4], zi[4]; + long double cr, ci; + int i; + int ok = 1; + +#if (LDBL_MAX_EXP < 2048) + /* + Test values when mantissa is 11 or fewer bits. Either LDBL is + using DBL on this platform or we are using IBM extended double + precision. Test values will be automatically truncated when + the available precision is smaller than the explicit precision. + */ + xr[0] = -0x1.16e7fad79e45ep+651; + xi[0] = -0x1.f7f75b94c6c6ap-860; + yr[0] = -0x1.2f40d8ff7e55ep+245; + yi[0] = -0x0.0000000004ebcp-968; + zr[0] = 0x1.d6e4b0e2828694570ba839070beep+405L; + zi[0] = -0x1.e9095e311e70498db810196259b7p-846L; + + xr[1] = -0x1.21ff587f953d3p-310; + xi[1] = -0x1.5a526dcc59960p+837; + yr[1] = 0x1.b88b8b552eaadp+735; + yi[1] = -0x1.873e2d6544d92p-327; + zr[1] = 0x1.65734a88b2ddff699c482ee8eef6p-961L; + zi[1] = -0x1.927e85b8b576f94a797a1bcb733dp+101L; + + xr[2] = 0x1.4612e41aa8080p-846; + xi[2] = -0x0.0000000613e07p-968; + yr[2] = 0x1.df9cd0d58caafp-820; + yi[2] = -0x1.e47051a9036dbp-584; + zr[2] = 0x1.9b194f3aaadea545174c5372d8p-415L; + zi[2] = 0x1.58a00ab740a6ad3249002f2b79p-263L; + + xr[3] = 0x1.cb27eece7c585p-355; + xi[3] = 0x0.000000223b8a8p-968; + yr[3] = -0x1.74e7ed2b9189fp-22; + yi[3] = 0x1.3d80439e9a119p-731; + zr[3] = -0x1.3b35ed806ae5a2a8cc1c9a96931dp-333L; + zi[3] = -0x1.7802c17c774895bd541adeb200p-974L; +#else + /* + Test values intended for either IEEE128 or Intel80 formats. In + either case, 15 bits of exponent are available. Test values will + be automatically truncated when the available precision is smaller + than the explicit precision. + */ + xr[0] = -0x9.c793985b7d029d90p-8480L; + xi[0] = 0x8.018745ffa61a8fe0p+16329L; + yr[0] = -0xe.d5bee9c523a35ad0p-15599L; + yi[0] = -0xa.8c93c5a4f94128f0p+869L; + zr[0] = -0x1.849178451c035b95d16311d0efdap+15459L; + zi[0] = -0x1.11375ed2c1f58b9d047ab64aed97p-1008L; + + xr[1] = 0xb.68e44bc6d0b91a30p+16026L; + xi[1] = 0xb.ab10f5453e972f30p-14239L; + yr[1] = 0x8.8cbd470705428ff0p-16350L; + yi[1] = -0xa.0c1cbeae4e4b69f0p+347L; + zr[1] = 0x1.eec40848785e500d9f0945ab58d3p-1019L; + zi[1] = 0x1.22b6b579927a3f238b772bb6dc95p+15679L; + + xr[2] = -0x9.e8c093a43b546a90p+15983L; + xi[2] = 0xc.95b18274208311e0p-2840L; + yr[2] = -0x8.dedb729b5c1b2ec0p+8L; + yi[2] = 0xa.a49fb81b24738370p-16385L; + zr[2] = 0x1.1df99ee89bb118f3201369e06576p+15975L; + zi[2] = 0x1.571e7ef904d6b6eee7acb0dcf098p-418L; + + xr[3] = 0xc.4687f251c0f48bd0p-3940L; + xi[3] = -0xe.a3f2138992d85fa0p+15598L; + yr[3] = 0xe.4b0c25c3d5ebb830p-16344L; + yi[3] = -0xa.6cbf1ba80f7b97a0p+78L; + zr[3] = 0x1.6785ba23bfb744cee97b4142348bp+15520L; + zi[3] = -0x1.ecee7b8c7bdd36237eb538324289p-902L; +#endif + + for (i = 0; i < 4; i++) + { + __real__ a = xr[i]; + __imag__ a = xi[i]; + __real__ b = yr[i]; + __imag__ b = yi[i]; + __real__ z = zr[i]; + __imag__ z = zi[i]; + c = a / b; + cr = __real__ c; + ci = __imag__ c; + + if (!match (c,z)){ + ok = 0; + } + } + if (!ok) + abort (); + exit (0); +} -- cgit v1.1 From e4aefface2a0e34d84b85844b11652eb28f2cf0c Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Wed, 28 Apr 2021 22:35:06 +0200 Subject: Fortran/OpenMP: Fix var-list expr parsing with array/dt gcc/fortran/ChangeLog: * openmp.c (gfc_match_omp_variable_list): Gobble whitespace before checking whether a '%' or parenthesis-open follows as next character. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/map-5.f90: New test. --- gcc/testsuite/gfortran.dg/gomp/map-5.f90 | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/gomp/map-5.f90 (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gfortran.dg/gomp/map-5.f90 b/gcc/testsuite/gfortran.dg/gomp/map-5.f90 new file mode 100644 index 0000000..2b4b341 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/map-5.f90 @@ -0,0 +1,13 @@ +implicit none +type t + integer :: b(5) +end type t +integer :: a(5), x, y(5) +type(t) :: b +!$omp target enter data map( to: a (:) ) +!$omp target enter data map( to: b % b ) +!$omp target enter data map( to: a(:) ) +!$omp target depend(out: y (2)) nowait +!$omp end target + +end -- cgit v1.1 From e4ff4ffb43d3d8520f1c106e04421f2e6a021c39 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 29 Apr 2021 00:17:01 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 122dddc..69f8f0a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,45 @@ +2021-04-28 Tobias Burnus + + * gfortran.dg/gomp/map-5.f90: New test. + +2021-04-28 Patrick McGehearty + + * gcc.c-torture/execute/ieee/cdivchkd.c: New test. + * gcc.c-torture/execute/ieee/cdivchkf.c: Likewise. + * gcc.c-torture/execute/ieee/cdivchkld.c: Likewise. + +2021-04-28 Alexandre Oliva + + * gcc.target/i386/pr89676.c: Add -fomit-frame-pointer. + +2021-04-28 Alexandre Oliva + + * gcc.dg/debug/dwarf2/inline5.c: Adjust pattern to avoid + mismatch when asm comments start with "/ ". + +2021-04-28 Richard Sandiford + + PR target/100305 + * gcc.c-torture/compile/pr100305.c: New test. + +2021-04-28 José Rui Faustino de Sousa + + PR fortran/82376 + * gfortran.dg/PR82376.f90: New test. + +2021-04-28 Richard Biener + + PR tree-optimization/100292 + * gcc.dg/pr100292.c: New testcase. + +2021-04-28 Richard Wai + + * gnat.dg/containers2.adb: New test. + +2021-04-28 Eric Botcazou + + * gnat.dg/opt93.ads, gnat.dg/opt93.adb: New test. + 2021-04-27 Jason Merrill PR c++/92145 -- cgit v1.1 From cc806126215c3f4dc187eff3bf923458d8cc6b4f Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Thu, 29 Apr 2021 00:50:35 +0000 Subject: c: C2x changes to function type compatibility WG14 N2432, the C2x removal of old-style function definitions, also changed the function type compatibility rules so that an unprototyped declaration can be compatible with a non-variadic prototyped declaration even if some function arguments are changed by the default argument promotions. I missed that change in the initial implementation for GCC of the rest of the N2432 changes, but discussion on the WG14 reflector in February suggests that this is indeed an intended change. Implement this in the C front end. Note that while this may be of use in some cases for use of pointers to unprototyped function types as a kind of generic function pointer, it's *not* possible to call such a function without a prototype visible, without getting runtime undefined behavior from the (promoted) type used in the call being incompatible with the (unpromoted) type in the prototype. Note also that GCC has a longstanding extension to allow compatibility of such a prototype with an old-style definition specifying the same type as in the prototype (which is not valid in ISO C, before old-style definitions were removed in C2x). Bootstrapped with no regressions for x86_64-pc-linux-gnu. gcc/c/ * c-typeck.c (function_types_compatible_p): For C2X, treat unprototyped function as compatible with non-variadic prototyped function even if some argument types are changed by the default argument promotions. gcc/testsuite/ * gcc.dg/c11-unproto-1.c, gcc.dg/c11-unproto-2.c, gcc.dg/c2x-unproto-1.c, gcc.dg/c2x-unproto-2.c: New tests. --- gcc/testsuite/gcc.dg/c11-unproto-1.c | 24 ++++++++++++++++++++++++ gcc/testsuite/gcc.dg/c11-unproto-2.c | 21 +++++++++++++++++++++ gcc/testsuite/gcc.dg/c2x-unproto-1.c | 20 ++++++++++++++++++++ gcc/testsuite/gcc.dg/c2x-unproto-2.c | 21 +++++++++++++++++++++ 4 files changed, 86 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/c11-unproto-1.c create mode 100644 gcc/testsuite/gcc.dg/c11-unproto-2.c create mode 100644 gcc/testsuite/gcc.dg/c2x-unproto-1.c create mode 100644 gcc/testsuite/gcc.dg/c2x-unproto-2.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/c11-unproto-1.c b/gcc/testsuite/gcc.dg/c11-unproto-1.c new file mode 100644 index 0000000..ea9e807 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c11-unproto-1.c @@ -0,0 +1,24 @@ +/* Test compatibility of unprototyped and prototyped function types (C2x makes + the case of types affected by default argument promotions compatible). Test + valid-in-C2x usages are not accepted for C11. */ +/* { dg-do compile } */ +/* { dg-options "-std=c11 -pedantic-errors" } */ + +void f1 (); /* { dg-message "previous declaration" } */ +void f1 (float); /* { dg-error "conflicting types" } */ +/* { dg-message "default promotion" "" { target *-*-* } .-1 } */ + +void f2 (float); /* { dg-message "previous declaration" } */ +void f2 (); /* { dg-error "conflicting types" } */ +/* { dg-message "default promotion" "" { target *-*-* } .-1 } */ + +void f3 (); /* { dg-message "previous declaration" } */ +void f3 (char); /* { dg-error "conflicting types" } */ +/* { dg-message "default promotion" "" { target *-*-* } .-1 } */ + +void f4 (char); /* { dg-message "previous declaration" } */ +void f4 (); /* { dg-error "conflicting types" } */ +/* { dg-message "default promotion" "" { target *-*-* } .-1 } */ + +/* Built-in function case. */ +float sqrtf (); /* { dg-warning "conflicting types for built-in function" } */ diff --git a/gcc/testsuite/gcc.dg/c11-unproto-2.c b/gcc/testsuite/gcc.dg/c11-unproto-2.c new file mode 100644 index 0000000..0557ae3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c11-unproto-2.c @@ -0,0 +1,21 @@ +/* Test compatibility of unprototyped and prototyped function types (C2x makes + the case of types affected by default argument promotions compatible). Test + invalid-in-C2x usages, in C11 mode. */ +/* { dg-do compile } */ +/* { dg-options "-std=c11 -pedantic-errors" } */ + +void f1 (); /* { dg-message "previous declaration" } */ +void f1 (int, ...); /* { dg-error "conflicting types" } */ +/* { dg-message "ellipsis" "" { target *-*-* } .-1 } */ + +void f2 (int, ...); /* { dg-message "previous declaration" } */ +void f2 (); /* { dg-error "conflicting types" } */ +/* { dg-message "ellipsis" "" { target *-*-* } .-1 } */ + +void f3 (); /* { dg-message "previous declaration" } */ +void f3 (char, ...); /* { dg-error "conflicting types" } */ +/* { dg-message "ellipsis" "" { target *-*-* } .-1 } */ + +void f4 (char, ...); /* { dg-message "previous declaration" } */ +void f4 (); /* { dg-error "conflicting types" } */ +/* { dg-message "ellipsis" "" { target *-*-* } .-1 } */ diff --git a/gcc/testsuite/gcc.dg/c2x-unproto-1.c b/gcc/testsuite/gcc.dg/c2x-unproto-1.c new file mode 100644 index 0000000..45d68f2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c2x-unproto-1.c @@ -0,0 +1,20 @@ +/* Test compatibility of unprototyped and prototyped function types (C2x makes + the case of types affected by default argument promotions compatible). Test + valid-in-C2x usages. */ +/* { dg-do compile } */ +/* { dg-options "-std=c2x -pedantic-errors" } */ + +void f1 (); +void f1 (float); + +void f2 (float); +void f2 (); + +void f3 (); +void f3 (char); + +void f4 (char); +void f4 (); + +/* Built-in function case. */ +float sqrtf (); diff --git a/gcc/testsuite/gcc.dg/c2x-unproto-2.c b/gcc/testsuite/gcc.dg/c2x-unproto-2.c new file mode 100644 index 0000000..f826b7c --- /dev/null +++ b/gcc/testsuite/gcc.dg/c2x-unproto-2.c @@ -0,0 +1,21 @@ +/* Test compatibility of unprototyped and prototyped function types (C2x makes + the case of types affected by default argument promotions compatible). Test + invalid-in-C2x usages. */ +/* { dg-do compile } */ +/* { dg-options "-std=c2x -pedantic-errors" } */ + +void f1 (); /* { dg-message "previous declaration" } */ +void f1 (int, ...); /* { dg-error "conflicting types" } */ +/* { dg-message "ellipsis" "" { target *-*-* } .-1 } */ + +void f2 (int, ...); /* { dg-message "previous declaration" } */ +void f2 (); /* { dg-error "conflicting types" } */ +/* { dg-message "ellipsis" "" { target *-*-* } .-1 } */ + +void f3 (); /* { dg-message "previous declaration" } */ +void f3 (char, ...); /* { dg-error "conflicting types" } */ +/* { dg-message "ellipsis" "" { target *-*-* } .-1 } */ + +void f4 (char, ...); /* { dg-message "previous declaration" } */ +void f4 (); /* { dg-error "conflicting types" } */ +/* { dg-message "ellipsis" "" { target *-*-* } .-1 } */ -- cgit v1.1 From 2c8bffa184dffba7976ba807ef0a1bbb6f66aa2d Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Wed, 28 Apr 2021 19:11:34 -0600 Subject: PR middle-end/100250 - ICE related to -Wmaybe-uninitialized gcc/ChangeLog: PR middle-end/100250 * attribs.c (attr_access::array_as_string): Avoid dereferencing a pointer when it's null. gcc/testsuite/ChangeLog: PR middle-end/100250 * gcc.dg/uninit-pr100250.c: New test. --- gcc/testsuite/gcc.dg/uninit-pr100250.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/uninit-pr100250.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/uninit-pr100250.c b/gcc/testsuite/gcc.dg/uninit-pr100250.c new file mode 100644 index 0000000..8e7a787 --- /dev/null +++ b/gcc/testsuite/gcc.dg/uninit-pr100250.c @@ -0,0 +1,29 @@ +/* PR middle-end/100250 - ICE related to -Wmaybe-uninitialized + { dg-do compile } + { dg-options "-O2 -Wall" } */ + +extern void f (int D, const int[D], const int[D]); + +void g (int D, const int a[D], const int b[D], const int c[D], const int d[D]) +{ + int c2[D]; + + for (int i = 0; i < D; i++) { + + if (a[i] >= D) __builtin_abort (); + if (b[i] != d[a[i]]) __builtin_abort (); + + c2[a[i]] = c[i]; + } + + f (D, d, c2); +} + +void h (int D, const int d[D]) +{ + int a[D]; + int b[D]; + int c[D]; + + g (D, a, b, c, d); // { dg-warning "-Wmaybe-uninitialized" } +} -- cgit v1.1 From b58dc0b803057c0e6032e0d9bd92cd834f72c75c Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 27 Apr 2021 14:32:27 +0200 Subject: tree-optimization/99912 - delete trivially dead stmts during DSE DSE performs a backwards walk over stmts removing stores but it leaves removing resulting dead SSA defs to later passes. This eats into its own alias walking budget if the removed stores kept loads live. The following patch adds removal of trivially dead SSA defs which helps in this situation and reduces the amount of garbage followup passes need to deal with. 2021-04-28 Richard Biener PR tree-optimization/99912 * tree-ssa-dse.c (dse_dom_walker::m_need_cfg_cleanup): New. (dse_dom_walker::todo): Likewise. (dse_dom_walker::dse_optimize_stmt): Move VDEF check to the caller. (dse_dom_walker::before_dom_children): Remove trivially dead SSA defs and schedule CFG cleanup if we removed all PHIs in a block. (pass_dse::execute): Get TODO as computed by the DOM walker and return it. Wipe dominator info earlier. * gcc.dg/pr95580.c: Disable DSE. * gcc.dg/Wrestrict-8.c: Place a use after each memcpy. * c-c++-common/ubsan/overflow-negate-3.c: Make asms volatile to prevent them from being removed. * c-c++-common/ubsan/overflow-sub-4.c: Likewise. --- gcc/testsuite/c-c++-common/ubsan/overflow-negate-3.c | 6 +++--- gcc/testsuite/c-c++-common/ubsan/overflow-sub-4.c | 6 +++--- gcc/testsuite/gcc.dg/Wrestrict-8.c | 4 +++- gcc/testsuite/gcc.dg/pr95580.c | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/c-c++-common/ubsan/overflow-negate-3.c b/gcc/testsuite/c-c++-common/ubsan/overflow-negate-3.c index 85acce8..6b612fa 100644 --- a/gcc/testsuite/c-c++-common/ubsan/overflow-negate-3.c +++ b/gcc/testsuite/c-c++-common/ubsan/overflow-negate-3.c @@ -8,11 +8,11 @@ main () { int x = INT_MIN; int y; - asm ("" : "+g" (x)); + __asm__ volatile ("" : "+g" (x)); y = -(-x); - asm ("" : "+g" (y)); + __asm__ volatile ("" : "+g" (y)); y = -(-INT_MIN); - asm ("" : "+g" (y)); + __asm__ volatile ("" : "+g" (y)); } /* { dg-output "negation of -2147483648 cannot be represented in type 'int'\[^\n\r]*; cast to an unsigned type to negate this value to itself\[^\n\r]*(\n|\r\n|\r)" } */ diff --git a/gcc/testsuite/c-c++-common/ubsan/overflow-sub-4.c b/gcc/testsuite/c-c++-common/ubsan/overflow-sub-4.c index d3fb9ba..14ed5fb 100644 --- a/gcc/testsuite/c-c++-common/ubsan/overflow-sub-4.c +++ b/gcc/testsuite/c-c++-common/ubsan/overflow-sub-4.c @@ -9,10 +9,10 @@ main () int x = INT_MIN; int y = 0; int z; - asm ("" : "+g" (y)); - asm ("" : "+g" (x)); + __asm__ volatile ("" : "+g" (y)); + __asm__ volatile ("" : "+g" (x)); z = y - (-x); - asm ("" : "+g" (z)); + __asm__ volatile ("" : "+g" (z)); } /* { dg-output "negation of -2147483648 cannot be represented in type 'int'\[^\n\r]*; cast to an unsigned type to negate this value to itself\[^\n\r]*(\n|\r\n|\r)" } */ diff --git a/gcc/testsuite/gcc.dg/Wrestrict-8.c b/gcc/testsuite/gcc.dg/Wrestrict-8.c index 24946b0..62e8bbc 100644 --- a/gcc/testsuite/gcc.dg/Wrestrict-8.c +++ b/gcc/testsuite/gcc.dg/Wrestrict-8.c @@ -7,7 +7,9 @@ typedef __SIZE_TYPE__ size_t; extern void* memcpy (void* restrict, const void* restrict, size_t); -#define T(d, s, n) memcpy (d, s, n) +void foo (void *); + +#define T(d, s, n) do { memcpy (d, s, n); foo (d); } while (0) struct S1 { char c; } a8_1[8]; diff --git a/gcc/testsuite/gcc.dg/pr95580.c b/gcc/testsuite/gcc.dg/pr95580.c index 330a313..77d8150 100644 --- a/gcc/testsuite/gcc.dg/pr95580.c +++ b/gcc/testsuite/gcc.dg/pr95580.c @@ -1,6 +1,6 @@ /* PR c/95580 */ /* { dg-do compile } */ -/* { dg-options "-O1 -W -fno-tree-dce" } */ +/* { dg-options "-O1 -W -fno-tree-dce -fno-tree-dse" } */ void bar (void); -- cgit v1.1 From 1b462deabf70e0f4bebb1f85118827d9c2eeffb5 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 29 Apr 2021 11:11:37 +0200 Subject: c++: Fix up detach clause vs. data-sharing clause checking [PR100319] The standard says that "The event-handle will be considered as if it was specified on a firstprivate clause." which means that it can't be explicitly specified in some other data-sharing clause. The checking is implemented correctly for C, but for C++ when detach_seen is true (i.e. the construct had detach clause) we were comparing OMP_CLAUSE_DECL (c) with t, which was previously initialized to OMP_CLAUSE_DECL (c), which means it complained about any explicit data-sharing clause on the same construct with a detach clause. Fixed by remembering the detach clause in detach_seen (instead of a boolean flag) and comparing against its OMP_CLAUSE_DECL. 2021-04-29 Jakub Jelinek PR c++/100319 * semantics.c (finish_omp_clauses): Fix up check that variable mentioned in detach clause doesn't appear in data-sharing clauses. * c-c++-common/gomp/task-detach-3.c: New test. --- gcc/testsuite/c-c++-common/gomp/task-detach-3.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 gcc/testsuite/c-c++-common/gomp/task-detach-3.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/c-c++-common/gomp/task-detach-3.c b/gcc/testsuite/c-c++-common/gomp/task-detach-3.c new file mode 100644 index 0000000..97e622d --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/task-detach-3.c @@ -0,0 +1,19 @@ +/* PR c++/100319 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp" } */ + +typedef enum omp_event_handle_t +{ + __omp_event_handle_t_max__ = __UINTPTR_MAX__ +} omp_event_handle_t; + +extern void omp_fulfill_event (omp_event_handle_t); + +void f (omp_event_handle_t x, omp_event_handle_t y, int z) +{ + #pragma omp task detach (x) firstprivate (y, z) /* { dg-bogus "the event handle of a 'detach' clause should not be in a data-sharing clause" } */ + ; + + #pragma omp task detach (x) shared (y) /* { dg-bogus "the event handle of a 'detach' clause should not be in a data-sharing clause" } */ + ; +} -- cgit v1.1 From 1bb3e2c0ce6ed363c72caf814a6ba6d7b17c3e0a Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 29 Apr 2021 11:34:50 +0200 Subject: aarch64: Fix ICE in aarch64_add_offset_1_temporaries [PR100302] In PR94121 I've changed aarch64_add_offset_1 to use absu_hwi instead of abs_hwi because offset can be HOST_WIDE_INT_MIN. As can be seen with the testcase below, aarch64_add_offset_1_temporaries suffers from the same problem and should be in sync with aarch64_add_offset_1, i.e. for HOST_WIDE_INT_MIN it needs a temporary. 2021-04-29 Jakub Jelinek PR target/100302 * config/aarch64/aarch64.c (aarch64_add_offset_1_temporaries): Use absu_hwi instead of abs_hwi. * gcc.target/aarch64/sve/pr100302.c: New test. --- gcc/testsuite/gcc.target/aarch64/sve/pr100302.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/pr100302.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr100302.c b/gcc/testsuite/gcc.target/aarch64/sve/pr100302.c new file mode 100644 index 0000000..de6e8f2 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/pr100302.c @@ -0,0 +1,12 @@ +/* PR target/100302 */ +/* { dg-do compile } */ +/* { dg-options "-march=armv8.2-a+sve -O1 -ftree-loop-vectorize -fno-tree-scev-cprop --param vect-partial-vector-usage=0 -fvect-cost-model=unlimited" } */ + +long int x; + +void +foo (void) +{ + for (x = 0; x >= 0; ++x) + ; +} -- cgit v1.1 From 62a44a9797edce11b1f7051ea0016ee975d41233 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 29 Apr 2021 11:42:08 +0200 Subject: testsuite: Remove dg-options from pr100305.c [PR100305] The test FAILs on i?86-linux (due to -Wpsabi warnings). But, on closer inspection it seems there is another problem, the dg-options in the testcase means that the test is compiled with -O0 -O, -O1 -O, -O2 -O, -O3 -O, -Os -O etc. options, so effectively is tested multiple times with the same options. Fixed by dropping the dg-options line, then we have -w by default and iterate over all the optimization levels (including the -O). 2021-04-29 Jakub Jelinek PR target/100305 * gcc.c-torture/compile/pr100305.c: Remove dg-options. Add PR line. --- gcc/testsuite/gcc.c-torture/compile/pr100305.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.c-torture/compile/pr100305.c b/gcc/testsuite/gcc.c-torture/compile/pr100305.c index e098b90b..43d78bf 100644 --- a/gcc/testsuite/gcc.c-torture/compile/pr100305.c +++ b/gcc/testsuite/gcc.c-torture/compile/pr100305.c @@ -1,4 +1,4 @@ -/* { dg-options "-O" } */ +/* PR target/100305 */ typedef double v2df __attribute__((vector_size(16))); -- cgit v1.1 From af4ccaa7515b8e72449448c509916575831e6292 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Thu, 29 Apr 2021 11:52:08 +0200 Subject: tree-optimization/100253 - fix bogus aligned vectorized loads/stores At some point DR_MISALIGNMENT was supposed to be -1 when the access was not element aligned. That's obviously not true at this point so this adjusts both store and load vectorizing to no longer assume this which in turn allows simplifying the code. 2021-04-29 Richard Biener PR tree-optimization/100253 * tree-vect-stmts.c (vectorizable_load): Do not assume element alignment when DR_MISALIGNMENT is -1. (vectorizable_store): Likewise. * g++.dg/pr100253.C: New testcase. --- gcc/testsuite/g++.dg/pr100253.C | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 gcc/testsuite/g++.dg/pr100253.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/pr100253.C b/gcc/testsuite/g++.dg/pr100253.C new file mode 100644 index 0000000..0102caa --- /dev/null +++ b/gcc/testsuite/g++.dg/pr100253.C @@ -0,0 +1,33 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -fno-tree-bit-ccp -ftree-slp-vectorize" } */ + +#include + +struct T +{ +}; + +struct S +{ + std::vector < std::vector < T > > v; + char x; + char y[16]; + char z[16]; +}; + +S s, g[1]; + +void +foo (char *buf) +{ + s = g[*buf]; +} + +char c; + +int +main () +{ + foo (&c); + return 0; +} -- cgit v1.1 From 985b3a6837dee7001e6b618f073ed74f0edf5787 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Mon, 10 Jun 2019 09:57:15 -0700 Subject: Generate offset adjusted operation for op_by_pieces operations Add an overlap_op_by_pieces_p target hook for op_by_pieces operations between two areas of memory to generate one offset adjusted operation in the smallest integer mode for the remaining bytes on the last piece operation of a memory region to avoid doing more than one smaller operations. Pass the RTL information from the previous iteration to m_constfn in op_by_pieces operation so that builtin_memset_[read|gen]_str can generate the new RTL from the previous RTL. Tested on Linux/x86-64. gcc/ PR middle-end/90773 * builtins.c (builtin_memcpy_read_str): Add a dummy argument. (builtin_strncpy_read_str): Likewise. (builtin_memset_read_str): Add an argument for the previous RTL information and generate the new RTL from the previous RTL info. (builtin_memset_gen_str): Likewise. * builtins.h (builtin_strncpy_read_str): Update the prototype. (builtin_memset_read_str): Likewise. * expr.c (by_pieces_ninsns): If targetm.overlap_op_by_pieces_p() returns true, round up size and alignment to the widest integer mode for maximum size. (pieces_addr::adjust): Add a pointer to by_pieces_prev argument and pass it to m_constfn. (op_by_pieces_d): Add m_push and m_overlap_op_by_pieces. (op_by_pieces_d::op_by_pieces_d): Add a bool argument to initialize m_push. Initialize m_overlap_op_by_pieces with targetm.overlap_op_by_pieces_p (). (op_by_pieces_d::run): Pass the previous RTL information to pieces_addr::adjust and generate overlapping operations if m_overlap_op_by_pieces is true. (PUSHG_P): New. (move_by_pieces_d::move_by_pieces_d): Updated for op_by_pieces_d change. (store_by_pieces_d::store_by_pieces_d): Updated for op_by_pieces_d change. (can_store_by_pieces): Use by_pieces_constfn on constfun. (store_by_pieces): Use by_pieces_constfn on constfun. Updated for op_by_pieces_d change. (clear_by_pieces_1): Add a dummy argument. (clear_by_pieces): Updated for op_by_pieces_d change. (compare_by_pieces_d::compare_by_pieces_d): Likewise. (string_cst_read_str): Add a dummy argument. * expr.h (by_pieces_constfn): Add a dummy argument. (by_pieces_prev): New. * target.def (overlap_op_by_pieces_p): New target hook. * config/i386/i386.c (TARGET_OVERLAP_OP_BY_PIECES_P): New. * doc/tm.texi.in: Add TARGET_OVERLAP_OP_BY_PIECES_P. * doc/tm.texi: Regenerated. gcc/testsuite/ PR middle-end/90773 * g++.dg/pr90773-1.h: New test. * g++.dg/pr90773-1a.C: Likewise. * g++.dg/pr90773-1b.C: Likewise. * g++.dg/pr90773-1c.C: Likewise. * g++.dg/pr90773-1d.C: Likewise. * gcc.target/i386/pr90773-1.c: Likewise. * gcc.target/i386/pr90773-2.c: Likewise. * gcc.target/i386/pr90773-3.c: Likewise. * gcc.target/i386/pr90773-4.c: Likewise. * gcc.target/i386/pr90773-5.c: Likewise. * gcc.target/i386/pr90773-6.c: Likewise. * gcc.target/i386/pr90773-7.c: Likewise. * gcc.target/i386/pr90773-8.c: Likewise. * gcc.target/i386/pr90773-9.c: Likewise. * gcc.target/i386/pr90773-10.c: Likewise. * gcc.target/i386/pr90773-11.c: Likewise. * gcc.target/i386/pr90773-12.c: Likewise. * gcc.target/i386/pr90773-13.c: Likewise. * gcc.target/i386/pr90773-14.c: Likewise. --- gcc/testsuite/g++.dg/pr90773-1.h | 14 ++++++++++++++ gcc/testsuite/g++.dg/pr90773-1a.C | 13 +++++++++++++ gcc/testsuite/g++.dg/pr90773-1b.C | 5 +++++ gcc/testsuite/g++.dg/pr90773-1c.C | 5 +++++ gcc/testsuite/g++.dg/pr90773-1d.C | 19 +++++++++++++++++++ gcc/testsuite/gcc.target/i386/pr90773-1.c | 17 +++++++++++++++++ gcc/testsuite/gcc.target/i386/pr90773-10.c | 13 +++++++++++++ gcc/testsuite/gcc.target/i386/pr90773-11.c | 13 +++++++++++++ gcc/testsuite/gcc.target/i386/pr90773-12.c | 11 +++++++++++ gcc/testsuite/gcc.target/i386/pr90773-13.c | 11 +++++++++++ gcc/testsuite/gcc.target/i386/pr90773-14.c | 13 +++++++++++++ gcc/testsuite/gcc.target/i386/pr90773-2.c | 20 ++++++++++++++++++++ gcc/testsuite/gcc.target/i386/pr90773-3.c | 23 +++++++++++++++++++++++ gcc/testsuite/gcc.target/i386/pr90773-4.c | 13 +++++++++++++ gcc/testsuite/gcc.target/i386/pr90773-5.c | 13 +++++++++++++ gcc/testsuite/gcc.target/i386/pr90773-6.c | 11 +++++++++++ gcc/testsuite/gcc.target/i386/pr90773-7.c | 11 +++++++++++ gcc/testsuite/gcc.target/i386/pr90773-8.c | 13 +++++++++++++ gcc/testsuite/gcc.target/i386/pr90773-9.c | 13 +++++++++++++ 19 files changed, 251 insertions(+) create mode 100644 gcc/testsuite/g++.dg/pr90773-1.h create mode 100644 gcc/testsuite/g++.dg/pr90773-1a.C create mode 100644 gcc/testsuite/g++.dg/pr90773-1b.C create mode 100644 gcc/testsuite/g++.dg/pr90773-1c.C create mode 100644 gcc/testsuite/g++.dg/pr90773-1d.C create mode 100644 gcc/testsuite/gcc.target/i386/pr90773-1.c create mode 100644 gcc/testsuite/gcc.target/i386/pr90773-10.c create mode 100644 gcc/testsuite/gcc.target/i386/pr90773-11.c create mode 100644 gcc/testsuite/gcc.target/i386/pr90773-12.c create mode 100644 gcc/testsuite/gcc.target/i386/pr90773-13.c create mode 100644 gcc/testsuite/gcc.target/i386/pr90773-14.c create mode 100644 gcc/testsuite/gcc.target/i386/pr90773-2.c create mode 100644 gcc/testsuite/gcc.target/i386/pr90773-3.c create mode 100644 gcc/testsuite/gcc.target/i386/pr90773-4.c create mode 100644 gcc/testsuite/gcc.target/i386/pr90773-5.c create mode 100644 gcc/testsuite/gcc.target/i386/pr90773-6.c create mode 100644 gcc/testsuite/gcc.target/i386/pr90773-7.c create mode 100644 gcc/testsuite/gcc.target/i386/pr90773-8.c create mode 100644 gcc/testsuite/gcc.target/i386/pr90773-9.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/pr90773-1.h b/gcc/testsuite/g++.dg/pr90773-1.h new file mode 100644 index 0000000..abdb78b --- /dev/null +++ b/gcc/testsuite/g++.dg/pr90773-1.h @@ -0,0 +1,14 @@ +class fixed_wide_int_storage { +public: + long val[10]; + int len; + fixed_wide_int_storage () + { + len = sizeof (val) / sizeof (val[0]); + for (int i = 0; i < len; i++) + val[i] = i; + } +}; + +extern void foo (fixed_wide_int_storage); +extern int record_increment(void); diff --git a/gcc/testsuite/g++.dg/pr90773-1a.C b/gcc/testsuite/g++.dg/pr90773-1a.C new file mode 100644 index 0000000..3ab8d92 --- /dev/null +++ b/gcc/testsuite/g++.dg/pr90773-1a.C @@ -0,0 +1,13 @@ +// { dg-do compile } +// { dg-options "-O2" } +// { dg-additional-options "-mno-avx -msse2 -mtune=skylake" { target { i?86-*-* x86_64-*-* } } } + +#include "pr90773-1.h" + +int +record_increment(void) +{ + fixed_wide_int_storage x; + foo (x); + return 0; +} diff --git a/gcc/testsuite/g++.dg/pr90773-1b.C b/gcc/testsuite/g++.dg/pr90773-1b.C new file mode 100644 index 0000000..9713b2d --- /dev/null +++ b/gcc/testsuite/g++.dg/pr90773-1b.C @@ -0,0 +1,5 @@ +// { dg-do compile } +// { dg-options "-O2" } +// { dg-additional-options "-mno-avx512f -march=skylake" { target { i?86-*-* x86_64-*-* } } } + +#include "pr90773-1a.C" diff --git a/gcc/testsuite/g++.dg/pr90773-1c.C b/gcc/testsuite/g++.dg/pr90773-1c.C new file mode 100644 index 0000000..699357a --- /dev/null +++ b/gcc/testsuite/g++.dg/pr90773-1c.C @@ -0,0 +1,5 @@ +// { dg-do compile } +// { dg-options "-O2" } +// { dg-additional-options "-march=skylake-avx512" { target { i?86-*-* x86_64-*-* } } } + +#include "pr90773-1a.C" diff --git a/gcc/testsuite/g++.dg/pr90773-1d.C b/gcc/testsuite/g++.dg/pr90773-1d.C new file mode 100644 index 0000000..bf9d854 --- /dev/null +++ b/gcc/testsuite/g++.dg/pr90773-1d.C @@ -0,0 +1,19 @@ +// { dg-do run } +// { dg-options "-O2" } +// { dg-additional-options "-march=native" { target { i?86-*-* x86_64-*-* } } } +// { dg-additional-sources "pr90773-1a.C" } + +#include "pr90773-1.h" + +void +foo (fixed_wide_int_storage x) +{ + for (int i = 0; i < x.len; i++) + if (x.val[i] != i) + __builtin_abort (); +} + +int main () +{ + return record_increment (); +} diff --git a/gcc/testsuite/gcc.target/i386/pr90773-1.c b/gcc/testsuite/gcc.target/i386/pr90773-1.c new file mode 100644 index 0000000..1d9f282 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr90773-1.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mtune=generic" } */ + +extern char *dst, *src; + +void +foo (void) +{ + __builtin_memcpy (dst, src, 15); +} + +/* { dg-final { scan-assembler-times "movq\[\\t \]+\\(%\[\^,\]+\\)," 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "movq\[\\t \]+7\\(%\[\^,\]+\\)," 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "movl\[\\t \]+\\(%\[\^,\]+\\)," 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "movl\[\\t \]+4\\(%\[\^,\]+\\)," 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "movl\[\\t \]+8\\(%\[\^,\]+\\)," 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "movl\[\\t \]+11\\(%\[\^,\]+\\)," 1 { target ia32 } } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr90773-10.c b/gcc/testsuite/gcc.target/i386/pr90773-10.c new file mode 100644 index 0000000..9ad725e --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr90773-10.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mtune=generic" } */ + +extern char *dst; + +void +foo (int c) +{ + __builtin_memset (dst, c, 5); +} + +/* { dg-final { scan-assembler-times "movl\[\\t \]+.+, \\(%\[\^,\]+\\)" 1 } } */ +/* { dg-final { scan-assembler-times "movb\[\\t \]+.+, 4\\(%\[\^,\]+\\)" 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr90773-11.c b/gcc/testsuite/gcc.target/i386/pr90773-11.c new file mode 100644 index 0000000..1734c03 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr90773-11.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mtune=generic" } */ + +extern char *dst; + +void +foo (int c) +{ + __builtin_memset (dst, c, 6); +} + +/* { dg-final { scan-assembler-times "movl\[\\t \]+.+, \\(%\[\^,\]+\\)" 1 } } */ +/* { dg-final { scan-assembler-times "movw\[\\t \]+.+, 4\\(%\[\^,\]+\\)" 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr90773-12.c b/gcc/testsuite/gcc.target/i386/pr90773-12.c new file mode 100644 index 0000000..e45840a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr90773-12.c @@ -0,0 +1,11 @@ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-O2 -mno-avx -msse2 -mtune=skylake" } */ + +void +foo (char *dst, char *src) +{ + __builtin_memcpy (dst, src, 255); +} + +/* { dg-final { scan-assembler-times "movdqu\[\\t \]+\[0-9\]*\\(%\[\^,\]+\\)," 16 } } */ +/* { dg-final { scan-assembler-not "mov\[bwlq\]" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr90773-13.c b/gcc/testsuite/gcc.target/i386/pr90773-13.c new file mode 100644 index 0000000..4d5ae8d --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr90773-13.c @@ -0,0 +1,11 @@ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-O2 -mno-avx -msse2 -mtune=skylake" } */ + +void +foo (char *dst) +{ + __builtin_memset (dst, 0, 255); +} + +/* { dg-final { scan-assembler-times "movups\[\\t \]+%xmm\[0-9\]+, \[0-9\]*\\(%\[\^,\]+\\)" 16 } } */ +/* { dg-final { scan-assembler-not "mov\[bwlq\]" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr90773-14.c b/gcc/testsuite/gcc.target/i386/pr90773-14.c new file mode 100644 index 0000000..6364916 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr90773-14.c @@ -0,0 +1,13 @@ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-O2 -mno-avx -msse2 -mtune=generic" } */ + +extern char *dst; + +void +foo (void) +{ + __builtin_memset (dst, 1, 20); +} + +/* { dg-final { scan-assembler-times "movups\[\\t \]+%xmm\[0-9\]+, \\(%\[\^,\]+\\)" 1 } } */ +/* { dg-final { scan-assembler-times "movl\[\\t \]+\\\$16843009, 16\\(%\[\^,\]+\\)" 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr90773-2.c b/gcc/testsuite/gcc.target/i386/pr90773-2.c new file mode 100644 index 0000000..6449575 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr90773-2.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mtune=generic" } */ +/* { dg-additional-options "-mno-avx -msse2" { target { ! ia32 } } } */ +/* { dg-additional-options "-mno-sse" { target ia32 } } */ + +extern char *dst, *src; + +void +foo (void) +{ + __builtin_memcpy (dst, src, 19); +} + +/* { dg-final { scan-assembler-times "movdqu\[\\t \]+\\(%\[\^,\]+\\)," 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "movl\[\\t \]+15\\(%\[\^,\]+\\)," 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "movl\[\\t \]+\\(%\[\^,\]+\\)," 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "movl\[\\t \]+4\\(%\[\^,\]+\\)," 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "movl\[\\t \]+8\\(%\[\^,\]+\\)," 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "movl\[\\t \]+12\\(%\[\^,\]+\\)," 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "movl\[\\t \]+15\\(%\[\^,\]+\\)," 1 { target ia32 } } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr90773-3.c b/gcc/testsuite/gcc.target/i386/pr90773-3.c new file mode 100644 index 0000000..84747c9 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr90773-3.c @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mtune=generic" } */ +/* { dg-additional-options "-mno-avx -msse2" { target { ! ia32 } } } */ +/* { dg-additional-options "-mno-sse" { target ia32 } } */ + +extern char *dst, *src; + +void +foo (void) +{ + __builtin_memcpy (dst, src, 31); +} + +/* { dg-final { scan-assembler-times "movdqu\[\\t \]+\\(%\[\^,\]+\\)," 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "movdqu\[\\t \]+15\\(%\[\^,\]+\\)," 1 { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-times "movl\[\\t \]+\\(%\[\^,\]+\\)," 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "movl\[\\t \]+4\\(%\[\^,\]+\\)," 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "movl\[\\t \]+8\\(%\[\^,\]+\\)," 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "movl\[\\t \]+12\\(%\[\^,\]+\\)," 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "movl\[\\t \]+16\\(%\[\^,\]+\\)," 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "movl\[\\t \]+20\\(%\[\^,\]+\\)," 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "movl\[\\t \]+24\\(%\[\^,\]+\\)," 1 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "movl\[\\t \]+27\\(%\[\^,\]+\\)," 1 { target ia32 } } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr90773-4.c b/gcc/testsuite/gcc.target/i386/pr90773-4.c new file mode 100644 index 0000000..ec0bc01 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr90773-4.c @@ -0,0 +1,13 @@ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-O2 -mno-avx -msse2 -mtune=generic" } */ + +extern char *dst; + +void +foo (void) +{ + __builtin_memset (dst, 0, 31); +} + +/* { dg-final { scan-assembler-times "movups\[\\t \]+%xmm\[0-9\]+, \\(%\[\^,\]+\\)" 1 } } */ +/* { dg-final { scan-assembler-times "movups\[\\t \]+%xmm\[0-9\]+, 15\\(%\[\^,\]+\\)" 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr90773-5.c b/gcc/testsuite/gcc.target/i386/pr90773-5.c new file mode 100644 index 0000000..49d03ef --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr90773-5.c @@ -0,0 +1,13 @@ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-O2 -mno-avx -msse2 -mtune=generic" } */ + +extern char *dst; + +void +foo (void) +{ + __builtin_memset (dst, 0, 21); +} + +/* { dg-final { scan-assembler-times "movups\[\\t \]+%xmm\[0-9\]+, \\(%\[\^,\]+\\)" 1 } } */ +/* { dg-final { scan-assembler-times "movq\[\\t \]+\\\$0+, 13\\(%\[\^,\]+\\)" 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr90773-6.c b/gcc/testsuite/gcc.target/i386/pr90773-6.c new file mode 100644 index 0000000..46498f6 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr90773-6.c @@ -0,0 +1,11 @@ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-O2 -mno-avx -msse2 -mtune=generic" } */ + +void +foo (char *dst, char *src) +{ + __builtin_memcpy (dst, src, 255); +} + +/* { dg-final { scan-assembler-times "movdqu\[\\t \]+\[0-9\]*\\(%\[\^,\]+\\)," 16 } } */ +/* { dg-final { scan-assembler-not "mov\[bwlq\]" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr90773-7.c b/gcc/testsuite/gcc.target/i386/pr90773-7.c new file mode 100644 index 0000000..4d5ae8d --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr90773-7.c @@ -0,0 +1,11 @@ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-O2 -mno-avx -msse2 -mtune=skylake" } */ + +void +foo (char *dst) +{ + __builtin_memset (dst, 0, 255); +} + +/* { dg-final { scan-assembler-times "movups\[\\t \]+%xmm\[0-9\]+, \[0-9\]*\\(%\[\^,\]+\\)" 16 } } */ +/* { dg-final { scan-assembler-not "mov\[bwlq\]" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr90773-8.c b/gcc/testsuite/gcc.target/i386/pr90773-8.c new file mode 100644 index 0000000..0d47845 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr90773-8.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mtune=generic" } */ + +extern char *dst; + +void +foo (void) +{ + __builtin_memset (dst, 0, 5); +} + +/* { dg-final { scan-assembler-times "movl\[\\t \]+.+, \\(%\[\^,\]+\\)" 1 } } */ +/* { dg-final { scan-assembler-times "movb\[\\t \]+.+, 4\\(%\[\^,\]+\\)" 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr90773-9.c b/gcc/testsuite/gcc.target/i386/pr90773-9.c new file mode 100644 index 0000000..ab5ea45 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr90773-9.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mtune=generic" } */ + +extern char *dst; + +void +foo (void) +{ + __builtin_memset (dst, 0, 6); +} + +/* { dg-final { scan-assembler-times "movl\[\\t \]+.+, \\(%\[\^,\]+\\)" 1 } } */ +/* { dg-final { scan-assembler-times "movw\[\\t \]+.+, 4\\(%\[\^,\]+\\)" 1 } } */ -- cgit v1.1 From c97351c0cf4872cc0e99e73ed17fb16659fd38b3 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Thu, 29 Apr 2021 17:24:57 +0100 Subject: rtl-ssa: Fix -fcompare-debug failure [PR100303] This patch fixes an oversight in the handling of debug instructions in rtl-ssa. At the moment (and whether this is a good idea or not remains to be seen), we maintain a linear RPO sequence of definitions and non-debug uses. If a register is defined more than once, we use a degenerate phi to reestablish a previous definition where necessary. However, debug instructions shouldn't of course affect codegen, so we can't create a new definition just for them. In those situations we instead hang the debug use off the real definition (meaning that debug uses do not follow a linear order wrt definitions). Again, it remains to be seen whether that's a good idea. The problem in the PR was that we weren't taking this into account when increasing (or potentially increasing) the live range of an existing definition. We'd create the phi even if it would only be used by debug instructions. The patch goes for the simple but inelegant approach of passing a bool to say whether the use is a debug use or not. I imagine this area will need some tweaking based on experience in future. gcc/ PR rtl-optimization/100303 * rtl-ssa/accesses.cc (function_info::make_use_available): Take a boolean that indicates whether the use will only be used in debug instructions. Treat it in the same way that existing cross-EBB debug references would be handled if so. (function_info::make_uses_available): Likewise. * rtl-ssa/functions.h (function_info::make_uses_available): Update prototype accordingly. (function_info::make_uses_available): Likewise. * fwprop.c (try_fwprop_subst): Update call accordingly. --- gcc/testsuite/g++.dg/torture/pr100303.C | 112 ++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 gcc/testsuite/g++.dg/torture/pr100303.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/torture/pr100303.C b/gcc/testsuite/g++.dg/torture/pr100303.C new file mode 100644 index 0000000..5af9412 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr100303.C @@ -0,0 +1,112 @@ +/* { dg-additional-options "-w -fcompare-debug -fno-dce -ftracer" } */ + +template < typename _T1 > struct pair +{ + _T1 first; + int second; +}; +struct __aligned_membuf +{ + void _M_ptr (); +}; +struct _Rb_tree_node_base +{ + typedef _Rb_tree_node_base *_Base_ptr; +}; +struct _Rb_tree_node:_Rb_tree_node_base +{ + __aligned_membuf _M_storage; + void _M_valptr () + { + _M_storage._M_ptr (); + } +}; +struct _Rb_tree_iterator +{ + typedef _Rb_tree_node_base::_Base_ptr _Base_ptr; + _Rb_tree_iterator (_Base_ptr __x):_M_node (__x) + { + } + void operator* () + { + static_cast < _Rb_tree_node * >(_M_node)->_M_valptr (); + } + friend bool operator== (_Rb_tree_iterator __x, _Rb_tree_iterator) + { + return __x._M_node; + } + _Base_ptr _M_node; +}; + +template < typename, typename, typename, typename, typename = + int >class _Rb_tree +{ + typedef _Rb_tree_node_base *_Base_ptr; +public: + pair < _Base_ptr > _M_get_insert_hint_unique_pos (int); + void _M_insert_node (_Base_ptr, int); + template < typename ... _Args > + _Rb_tree_iterator _M_emplace_hint_unique (_Args && ...); + _Rb_tree_iterator lower_bound () + { + _Rb_tree_node_base __trans_tmp_2; + return &__trans_tmp_2; + } +}; +template < typename _Key, typename _Val, typename _KeyOfValue, + typename _Compare, + typename _Alloc > template < typename ... _Args > + _Rb_tree_iterator _Rb_tree < _Key, _Val, _KeyOfValue, _Compare, + _Alloc >::_M_emplace_hint_unique (_Args && ...) +{ + int __z; + try + { + auto __res = _M_get_insert_hint_unique_pos (0); + _Rb_tree_node_base *__res_1; + if (__res_1) + _M_insert_node (__res.first, __z); + return __res.first; + } + catch ( ...) + { + } +} + +class map +{ + _Rb_tree < int, int, int, int >_M_t; +public: + _Rb_tree_iterator end (); + void operator[] (int) + { + _Rb_tree_iterator __i = lower_bound (); + if (__i == end ()) + __i = _M_t._M_emplace_hint_unique (__i); + *__i; + } + _Rb_tree_iterator lower_bound () + { + return _M_t.lower_bound (); + } +}; + +class FlowStat +{ +public: + int FlowStat_flow; + FlowStat () + { + shares[FlowStat_flow]; + } + map shares; +}; + +class LinkGraphJob +{ + ~LinkGraphJob (); +}; +LinkGraphJob::~LinkGraphJob () +{ + FlowStat (); +} -- cgit v1.1 From f24702258fc78ac37b3e8154d76239cccd30c422 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Thu, 29 Apr 2021 13:30:39 -0400 Subject: c++: Add testcase for already fixed PR [PR94102] We correctly accept this testcase since r11-1571. gcc/testsuite/ChangeLog: PR c++/94102 * g++.dg/cpp1z/class-deduction87.C: New test. --- gcc/testsuite/g++.dg/cpp1z/class-deduction87.C | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1z/class-deduction87.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction87.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction87.C new file mode 100644 index 0000000..37296a4 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction87.C @@ -0,0 +1,15 @@ +// PR c++/94102 +// { dg-do compile { target c++17 } } + +namespace std { + template using decay_t = _Tp; +} +template struct Merged : B... { + template Merged(T... t) : B(t)... {} +}; +template Merged(T...) -> Merged...>; +int main() { + auto l1 = [] {}; + auto l2 = [](int i) { return i; }; + Merged(l1, l2); +} -- cgit v1.1 From efeca0ac4155b76ce713155f190422aac20537c5 Mon Sep 17 00:00:00 2001 From: Patrick Palka Date: Thu, 29 Apr 2021 13:43:00 -0400 Subject: c++: Overeager use of deleted function before ADL [PR68942] Here, at template definition time, ordinary name lookup for 'foo(t)' finds only the deleted function, and so we form a CALL_EXPR thereof. Later at instantiation time, when initially substituting into this CALL_EXPR with T=N::A, we end up calling mark_used on this deleted function (since it's the only function in the overload set), triggering a bogus "use of deleted function error", before we get to augment the overload set via ADL. This patch fixes this issue by using the tf_conv flag to disable mark_used during the initial substitution into the callee of a CALL_EXPR when KOENIG_P, since at this point we're still figuring out which functions are candidates. gcc/cp/ChangeLog: PR c++/68942 * pt.c (tsubst_copy_and_build) : When KOENIG_P, set tf_conv during the initial substitution into the function. gcc/testsuite/ChangeLog: PR c++/68942 * g++.dg/template/koenig12.C: New test. --- gcc/testsuite/g++.dg/template/koenig12.C | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 gcc/testsuite/g++.dg/template/koenig12.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/template/koenig12.C b/gcc/testsuite/g++.dg/template/koenig12.C new file mode 100644 index 0000000..fd05ef5 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/koenig12.C @@ -0,0 +1,15 @@ +// PR c++/68942 +// { dg-do compile { target c++11 } } + +void foo(...) = delete; + +template void lookup(T t) { foo(t); } + +namespace N { + struct A { }; + int foo(A); +} + +int main() { + lookup(N::A{}); +} -- cgit v1.1 From 58a92b789a77cdade1f41800efebf6e0686f9982 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Sat, 10 Apr 2021 14:00:15 -0400 Subject: c++: ICE with anonymous union [PR97974] While working on the GCC 11 patch, it occurred to me that we could move the errors about invalid members from finish_struct_anon_r to here, so we properly get a diagnostic in g++.law/union4.C. gcc/cp/ChangeLog: PR c++/97974 * class.c (finish_struct_anon_r): Drop complain parm. Remove non-field diagnostic. (finish_struct_anon): Adjust. * decl.c (fixup_anonymous_aggr): Move non-field diagnostic here. gcc/testsuite/ChangeLog: PR c++/97974 * g++.old-deja/g++.law/union4.C: Add expected diagnostic. --- gcc/testsuite/g++.old-deja/g++.law/union4.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.old-deja/g++.law/union4.C b/gcc/testsuite/g++.old-deja/g++.law/union4.C index 958ff0a..ec30d1e 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/union4.C +++ b/gcc/testsuite/g++.old-deja/g++.law/union4.C @@ -7,7 +7,7 @@ // Message-ID: static union { - struct SS { + struct SS { // { dg-error "anonymous union" } int ss; }; };// { dg-error "no members" } -- cgit v1.1 From f03973251db33ad8d08c03ac570cd378e46d3a20 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 30 Dec 2020 13:07:57 -0500 Subject: c++: Add using-declaration testcase gcc/testsuite/ChangeLog: * g++.dg/lookup/using-decl1.C: New test. --- gcc/testsuite/g++.dg/lookup/using-decl1.C | 38 +++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 gcc/testsuite/g++.dg/lookup/using-decl1.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/lookup/using-decl1.C b/gcc/testsuite/g++.dg/lookup/using-decl1.C new file mode 100644 index 0000000..7ccb4fc --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/using-decl1.C @@ -0,0 +1,38 @@ +// Testcase from [namespace.udecl] updated by P1787 + +namespace A { + int x; + int f(int); + int g; + void h(); +} + +namespace B { + int i; + struct g { }; + struct x { }; + void f(int); + void f(double); + void g(char); // OK: hides struct g +} + +void func() { + int i; + using B::i; // { dg-error "" } i conflicts + void f(char); + using B::f; // OK: each f is a function + using A::f; // OK, but interferes with B::f(int) + f(1); // { dg-error "" } ambiguous + static_cast(f)(1); // OK: calls A::f + f(3.5); // calls B::f(double) + using B::g; + g('a'); // calls B::g(char) + struct g g1; // g1 has class type B::g + using A::g; // { dg-error "" } conflicts with B::g + void h(); + using A::h; // { dg-error "" } conflicts + using B::x; + using A::x; // OK: hides struct B::x + x = 99; // assigns to A::x + struct x x1; // x1 has class type B::x +} -- cgit v1.1 From b24d8acbfffe30f40e280f11f23adac81b1e7f0c Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Thu, 29 Apr 2021 19:50:47 +0000 Subject: preprocessor: Handle digit separators in #line [PR82359] As reported in bug 82359, the preprocessor does not allow C++ digit separators in the line number in a #line directive, despite the standard syntax for that directive using digit-sequence which allows digit separators. There is some confusion in that bug about whether C++ is meant to allow digit separators there or not, but the last comment there suggests they are meant to be allowed, and the version of digit separators accepted for C2X at the March meeting explicitly mentions digit separators in the #line specification to avoid any ambiguity there. This patch thus adds code to handle digit separators in the line number in #line, as part of the preparation for enabling digit separators in C2X mode. The code changed does not contain any conditionals for whether digit separators are supported in the chosen language version, because that was handled earlier in pp-number lexing and if they aren't supported they won't appear in the string passed to that function. It does however make sure not to allow adjacent digit separators because those are only handled at a later stage of lexing at present. (Problems with how certain source character sequences involving digit separators that don't actually match the pp-number syntax get lexed as a pp-number and only diagnosed later, if at all, are bugs 83873 and 97604, to be addressed separately.) Making the change in this location will have the effect of allowing digit separators in the "# " form of directive as well as #line; I don't think that's a problem. Bootstrapped with no regressions for x86_64-pc-linux-gnu. libcpp/ PR preprocessor/82359 * directives.c (strtolinenum): Handle digit separators. gcc/testsuite/ PR preprocessor/82359 * g++.dg/cpp1y/digit-sep-line.C, g++.dg/cpp1y/digit-sep-line-neg.C: New tests. --- gcc/testsuite/g++.dg/cpp1y/digit-sep-line-neg.C | 4 ++++ gcc/testsuite/g++.dg/cpp1y/digit-sep-line.C | 8 ++++++++ 2 files changed, 12 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1y/digit-sep-line-neg.C create mode 100644 gcc/testsuite/g++.dg/cpp1y/digit-sep-line.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp1y/digit-sep-line-neg.C b/gcc/testsuite/g++.dg/cpp1y/digit-sep-line-neg.C new file mode 100644 index 0000000..fa3b135 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/digit-sep-line-neg.C @@ -0,0 +1,4 @@ +// Test digit separators in #line (bug 82359). Test invalid usage. +// { dg-do preprocess { target c++14 } } + +#line 0''123 // { dg-error "is not a positive integer" } diff --git a/gcc/testsuite/g++.dg/cpp1y/digit-sep-line.C b/gcc/testsuite/g++.dg/cpp1y/digit-sep-line.C new file mode 100644 index 0000000..48846e4 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/digit-sep-line.C @@ -0,0 +1,8 @@ +// Test digit separators in #line (bug 82359). +// { dg-do compile { target c++14 } } + +#line 0'123 +static_assert (__LINE__ == 123, "#line with digit separator"); + +#line 4'56'7'8'9 +static_assert (__LINE__ == 456789, "#line with digit separator"); -- cgit v1.1 From 3c8e539dcfd955b24af44b95a1a900dc0a5dc4c9 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 30 Apr 2021 00:16:37 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 92 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 69f8f0a..e9c943b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,95 @@ +2021-04-29 Joseph Myers + + PR preprocessor/82359 + * g++.dg/cpp1y/digit-sep-line.C, + g++.dg/cpp1y/digit-sep-line-neg.C: New tests. + +2021-04-29 Jason Merrill + + * g++.dg/lookup/using-decl1.C: New test. + +2021-04-29 Jason Merrill + + PR c++/97974 + * g++.old-deja/g++.law/union4.C: Add expected diagnostic. + +2021-04-29 Patrick Palka + + PR c++/68942 + * g++.dg/template/koenig12.C: New test. + +2021-04-29 Marek Polacek + + PR c++/94102 + * g++.dg/cpp1z/class-deduction87.C: New test. + +2021-04-29 Richard Sandiford + + PR rtl-optimization/100303 + * g++.dg/torture/pr100303.C: New file. + +2021-04-29 H.J. Lu + + PR middle-end/90773 + * g++.dg/pr90773-1.h: New test. + * g++.dg/pr90773-1a.C: Likewise. + * g++.dg/pr90773-1b.C: Likewise. + * g++.dg/pr90773-1c.C: Likewise. + * g++.dg/pr90773-1d.C: Likewise. + * gcc.target/i386/pr90773-1.c: Likewise. + * gcc.target/i386/pr90773-2.c: Likewise. + * gcc.target/i386/pr90773-3.c: Likewise. + * gcc.target/i386/pr90773-4.c: Likewise. + * gcc.target/i386/pr90773-5.c: Likewise. + * gcc.target/i386/pr90773-6.c: Likewise. + * gcc.target/i386/pr90773-7.c: Likewise. + * gcc.target/i386/pr90773-8.c: Likewise. + * gcc.target/i386/pr90773-9.c: Likewise. + * gcc.target/i386/pr90773-10.c: Likewise. + * gcc.target/i386/pr90773-11.c: Likewise. + * gcc.target/i386/pr90773-12.c: Likewise. + * gcc.target/i386/pr90773-13.c: Likewise. + * gcc.target/i386/pr90773-14.c: Likewise. + +2021-04-29 Richard Biener + + PR tree-optimization/100253 + * g++.dg/pr100253.C: New testcase. + +2021-04-29 Jakub Jelinek + + PR target/100305 + * gcc.c-torture/compile/pr100305.c: Remove dg-options. Add PR line. + +2021-04-29 Jakub Jelinek + + PR target/100302 + * gcc.target/aarch64/sve/pr100302.c: New test. + +2021-04-29 Jakub Jelinek + + PR c++/100319 + * c-c++-common/gomp/task-detach-3.c: New test. + +2021-04-29 Richard Biener + + PR tree-optimization/99912 + * gcc.dg/pr95580.c: Disable DSE. + * gcc.dg/Wrestrict-8.c: Place a use after each memcpy. + * c-c++-common/ubsan/overflow-negate-3.c: Make asms volatile + to prevent them from being removed. + * c-c++-common/ubsan/overflow-sub-4.c: Likewise. + +2021-04-29 Martin Sebor + + PR middle-end/100250 + * gcc.dg/uninit-pr100250.c: New test. + +2021-04-29 Joseph Myers + + * gcc.dg/c11-unproto-1.c, gcc.dg/c11-unproto-2.c, + gcc.dg/c2x-unproto-1.c, gcc.dg/c2x-unproto-2.c: New tests. + 2021-04-28 Tobias Burnus * gfortran.dg/gomp/map-5.f90: New test. -- cgit v1.1 From 4cf3b10f27b1994cf4a9eb12079d85412ebc7cad Mon Sep 17 00:00:00 2001 From: Roman Zhuykov Date: Fri, 30 Apr 2021 11:08:03 +0300 Subject: modulo-sched: skip loops with strange register defs [PR100225] PR84878 fix adds an assertion which can fail, e.g. when stack pointer is adjusted inside the loop. We have to prevent it and search earlier for any 'strange' instruction. The solution is to skip the whole loop if using 'note_stores' we found that one of hard registers is in 'df->regular_block_artificial_uses' set. Also patch properly prohibit not single-set instruction in loop body. gcc/ChangeLog: PR rtl-optimization/100225 PR rtl-optimization/84878 * modulo-sched.c (sms_schedule): Use note_stores to skip loops where we have an instruction which touches (writes) any hard register from df->regular_block_artificial_uses set. Allow not-single-set instruction only right before basic block tail. gcc/testsuite/ChangeLog: PR rtl-optimization/100225 PR rtl-optimization/84878 * gcc.dg/pr100225.c: New test. libgomp/ChangeLog: * testsuite/libgomp.oacc-c-c++-common/atomic_capture-3.c: New test. --- gcc/testsuite/gcc.dg/pr100225.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr100225.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/pr100225.c b/gcc/testsuite/gcc.dg/pr100225.c new file mode 100644 index 0000000..b321634 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr100225.c @@ -0,0 +1,15 @@ +/* PR rtl-optimization/100225 */ +/* { dg-do compile } */ +/* { dg-options "-O1 -fmodulo-sched" } */ + +void +vorbis_synthesis_lapout (void); + +void +ov_info (int **lappcm, int ov_info_i) +{ + while (ov_info_i < 1) + lappcm[ov_info_i++] = __builtin_alloca (1); + + vorbis_synthesis_lapout (); +} -- cgit v1.1 From c111f6066043d3b7bc4141ca0411eae9294aa6c5 Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Fri, 30 Apr 2021 10:15:26 +0200 Subject: i386: Introduce reversed ADC and SBB patterns [PR98060] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The compiler is able to merge LTU comparisons with PLUS or MINUS pattern to form addition with carry (ADC) and subtraction with borrow (SBB) instructions: op = op + carry [ADC $0, op] op = op - carry [SBB $0, op] The patch introduces reversed ADC and SBB insn patterns: op = op + !carry [SBB $-1, op] op = op - !carry [ADC $-1, op] allowing the compiler to also merge GEU comparisons. 2021-04-30 UroÅ¡ Bizjak gcc/ PR target/98060 * config/i386/i386.md (*add3_carry_0r): New insn pattern. (*addsi3_carry_zext_0r): Ditto. (*sub3_carry_0): Ditto. (*subsi3_carry_zext_0r): Ditto. * config/i386/predicates.md (ix86_carry_flag_unset_operator): New predicate. * config/i386/i386.c (ix86_rtx_costs) : Also consider ix86_carry_flag_unset_operator to calculate the cost of adc/sbb insn. gcc/testsuite/ PR target/98060 * gcc.target/i386/pr98060.c: New test. --- gcc/testsuite/gcc.target/i386/pr98060.c | 47 +++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr98060.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/i386/pr98060.c b/gcc/testsuite/gcc.target/i386/pr98060.c new file mode 100644 index 0000000..f82620c --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr98060.c @@ -0,0 +1,47 @@ +/* PR target/98060 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +/* { dg-final { scan-assembler-not "set" } } */ +/* { dg-final { scan-assembler-times "adc" 4 } } */ +/* { dg-final { scan-assembler-times "sbb" 4 } } */ + +int r1 (unsigned v0, unsigned v1, int v2) +{ + return v2 + (v0 >= v1); +} + +int r2 (unsigned v0, unsigned v1, int v2) +{ + return v2 + (v0 <= v1); +} + +int r3 (unsigned v0, unsigned v1, int v2) +{ + return v2 + (v0 > v1); +} + +int r4 (unsigned v0, unsigned v1, int v2) +{ + return v2 + (v0 < v1); +} + +int r5 (unsigned v0, unsigned v1, int v2) +{ + return v2 - (v0 >= v1); +} + +int r6 (unsigned v0, unsigned v1, int v2) +{ + return v2 - (v0 <= v1); +} + +int r7 (unsigned v0, unsigned v1, int v2) +{ + return v2 - (v0 > v1); +} + +int r8 (unsigned v0, unsigned v1, int v2) +{ + return v2 - (v0 < v1); +} -- cgit v1.1 From b9bc4467cc78201f362b5390d53640b0feaa8d40 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Fri, 30 Apr 2021 11:13:42 +0200 Subject: tree-optimization/96513 - add testcase for fixed bug This adds a testcase for a bug that was fixed with the hybrid SLP detection rewrite. 2021-04-30 Richard Biener PR tree-optimization/96513 * gcc.dg/torture/pr96513.c: New testcase. --- gcc/testsuite/gcc.dg/torture/pr96513.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/torture/pr96513.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/torture/pr96513.c b/gcc/testsuite/gcc.dg/torture/pr96513.c new file mode 100644 index 0000000..5ee040e --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr96513.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ + +typedef struct { + short a; + short b; +} c; +c *d; +int e, f, i, j, k, l, m, n, o, p; +c g, h; +void q() { + do { + if (o) { + (*d).a = (*d).b = d[e].a = d[e].a * 3 + 1 >> 15; + d[e].b = d[e].b * 3 + 1 >> 15; + } + n = -(d[e].b * g.b) >> 5; + m = d[e].b * g.a + 1 >> 5; + l = d[f].a * -d[f].b * h.b + 1 >> 5; + k = d[f].a * h.b + d[f].b * h.a + 1 >> 5; + j = n + l; + i = m - k; + (*d).a += j; + d[e].a -= i; + ++d; + } while (--p); +} -- cgit v1.1 From dfc70841eb0ca42637826177f329cf6c98ee00ad Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Fri, 30 Apr 2021 14:14:48 +0200 Subject: c++/98032 - add testcase This adds another testcase for PR95719. 2021-04-30 Richard Biener PR c++/98032 * g++.dg/pr98032.C: New testcase. --- gcc/testsuite/g++.dg/pr98032.C | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 gcc/testsuite/g++.dg/pr98032.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/pr98032.C b/gcc/testsuite/g++.dg/pr98032.C new file mode 100644 index 0000000..d7eef27 --- /dev/null +++ b/gcc/testsuite/g++.dg/pr98032.C @@ -0,0 +1,20 @@ +// { dg-do compile } + +namespace osl { +class Thread { +public: + virtual ~Thread(); + virtual void join(); +}; +} // namespace osl +class SimpleReferenceObject { +protected: + virtual ~SimpleReferenceObject(); +}; +class Thread : SimpleReferenceObject, osl::Thread { +public: + using osl::Thread::join; +}; +class RenderThread : Thread { + RenderThread() { join(); } +}; -- cgit v1.1 From d8d291f3367230fdfdacc9868b0aa01de1dabb13 Mon Sep 17 00:00:00 2001 From: Jonathan Wright Date: Mon, 15 Feb 2021 23:52:47 +0000 Subject: testsuite: aarch64: Add fusion tests for FP vml[as] intrinsics Add compilation tests to make sure that the output of vmla/vmls floating-point Neon intrinsics (fmul, fadd/fsub) is not fused into fmla/fmls instructions. gcc/testsuite/ChangeLog: 2021-02-16 Jonathan Wright * gcc.target/aarch64/advsimd-intrinsics/vmla_float_not_fused.c: New test. * gcc.target/aarch64/advsimd-intrinsics/vmls_float_not_fused.c: New test. --- .../advsimd-intrinsics/vmla_float_not_fused.c | 67 ++++++++++++++++++++++ .../advsimd-intrinsics/vmls_float_not_fused.c | 67 ++++++++++++++++++++++ 2 files changed, 134 insertions(+) create mode 100644 gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vmla_float_not_fused.c create mode 100644 gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vmls_float_not_fused.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vmla_float_not_fused.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vmla_float_not_fused.c new file mode 100644 index 0000000..b14b259 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vmla_float_not_fused.c @@ -0,0 +1,67 @@ +/* { dg-skip-if "" { arm*-*-* } } */ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + + +#include + +float32x2_t foo_f32 (float32x2_t a, float32x2_t b, float32x2_t c) +{ + return vmla_f32 (a, b, c); +} + +float32x4_t fooq_f32 (float32x4_t a, float32x4_t b, float32x4_t c) +{ + return vmlaq_f32 (a, b, c); +} + +float32x2_t foo_n_f32 (float32x2_t a, float32x2_t b, float32_t c) +{ + return vmla_n_f32 (a, b, c); +} + +float32x4_t fooq_n_f32 (float32x4_t a, float32x4_t b, float32_t c) +{ + return vmlaq_n_f32 (a, b, c); +} + +float32x2_t foo_lane_f32 (float32x2_t a, + float32x2_t b, + float32x2_t v) +{ + return vmla_lane_f32 (a, b, v, 0); +} + +float32x4_t fooq_lane_f32 (float32x4_t a, + float32x4_t b, + float32x2_t v) +{ + return vmlaq_lane_f32 (a, b, v, 0); +} + +float32x2_t foo_laneq_f32 (float32x2_t a, + float32x2_t b, + float32x4_t v) +{ + return vmla_laneq_f32 (a, b, v, 0); +} + +float32x4_t fooq_laneq_f32 (float32x4_t a, + float32x4_t b, + float32x4_t v) +{ + return vmlaq_laneq_f32 (a, b, v, 0); +} + +float64x1_t foo_f64 (float64x1_t a, float64x1_t b, float64x1_t c) +{ + return vmla_f64 (a, b, c); +} + +float64x2_t fooq_f64 (float64x2_t a, float64x2_t b, float64x2_t c) +{ + return vmlaq_f64 (a, b, c); +} + +/* { dg-final { scan-assembler-times {\tfmul\t} 10} } */ +/* { dg-final { scan-assembler-times {\tfadd\t} 10} } */ diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vmls_float_not_fused.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vmls_float_not_fused.c new file mode 100644 index 0000000..c6f62c5 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vmls_float_not_fused.c @@ -0,0 +1,67 @@ +/* { dg-skip-if "" { arm*-*-* } } */ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + + +#include + +float32x2_t foo_f32 (float32x2_t a, float32x2_t b, float32x2_t c) +{ + return vmls_f32 (a, b, c); +} + +float32x4_t fooq_f32 (float32x4_t a, float32x4_t b, float32x4_t c) +{ + return vmlsq_f32 (a, b, c); +} + +float32x2_t foo_n_f32 (float32x2_t a, float32x2_t b, float32_t c) +{ + return vmls_n_f32 (a, b, c); +} + +float32x4_t fooq_n_f32 (float32x4_t a, float32x4_t b, float32_t c) +{ + return vmlsq_n_f32 (a, b, c); +} + +float32x2_t foo_lane_f32 (float32x2_t a, + float32x2_t b, + float32x2_t v) +{ + return vmls_lane_f32 (a, b, v, 0); +} + +float32x4_t fooq_lane_f32 (float32x4_t a, + float32x4_t b, + float32x2_t v) +{ + return vmlsq_lane_f32 (a, b, v, 0); +} + +float32x2_t foo_laneq_f32 (float32x2_t a, + float32x2_t b, + float32x4_t v) +{ + return vmls_laneq_f32 (a, b, v, 0); +} + +float32x4_t fooq_laneq_f32 (float32x4_t a, + float32x4_t b, + float32x4_t v) +{ + return vmlsq_laneq_f32 (a, b, v, 0); +} + +float64x1_t foo_f64 (float64x1_t a, float64x1_t b, float64x1_t c) +{ + return vmls_f64 (a, b, c); +} + +float64x2_t fooq_f64 (float64x2_t a, float64x2_t b, float64x2_t c) +{ + return vmlsq_f64 (a, b, c); +} + +/* { dg-final { scan-assembler-times {\tfmul\t} 10} } */ +/* { dg-final { scan-assembler-times {\tfsub\t} 10} } */ -- cgit v1.1 From 9326049e1abd28b468dbb02f8c0c2477111a1e41 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 1 May 2021 00:16:28 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e9c943b..b26c655 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,31 @@ +2021-04-30 Jonathan Wright + + * gcc.target/aarch64/advsimd-intrinsics/vmla_float_not_fused.c: + New test. + * gcc.target/aarch64/advsimd-intrinsics/vmls_float_not_fused.c: + New test. + +2021-04-30 Richard Biener + + PR c++/98032 + * g++.dg/pr98032.C: New testcase. + +2021-04-30 Richard Biener + + PR tree-optimization/96513 + * gcc.dg/torture/pr96513.c: New testcase. + +2021-04-30 UroÅ¡ Bizjak + + PR target/98060 + * gcc.target/i386/pr98060.c: New test. + +2021-04-30 Roman Zhuykov + + PR rtl-optimization/100225 + PR rtl-optimization/84878 + * gcc.dg/pr100225.c: New test. + 2021-04-29 Joseph Myers PR preprocessor/82359 -- cgit v1.1 From 92f59e47f5a468b96b12b15233a6729904b1a1ee Mon Sep 17 00:00:00 2001 From: David Edelsohn Date: Tue, 6 Apr 2021 11:41:49 -0400 Subject: aix: Redesign section encoding and selection AIX symbol references can refer to either the symbol (a label) or a symbol with a qualifier (the storage mapping class). The storage mapping class provide information about the underlying COFF section into which the symbol will be placed, e.g. [RO] for read-only in the text section, [RW] for read-writer in the data section, or [BS] for the BSS section. A label is distinct from a qualname in the assembler language, e.g., foo and foo[RW] are different, but the symbol table of an object file strips the storage mapping class from the name, so that it no longer is relevant when referring to symbols across object files and libraries. .csect .data[RW] i: is a label "i" in the .data CSECT, which has storage mapping class [RW] so that it is placed in the read-write COFF section. .csect i[RW] is a CSECT "i[RW]". BSS does not allow interior labels. The AIX port of GCC had been emitting the storage mapping class where appropriate but not consistently using the storage mapping class on the DECL or SYM name. This patch updates the section encoding to properly place storage mapping class on symbol names and remove the decorations placed when emitting the symbol. The mapping classes correspond to sections and the encoding choices must exactly match the section choices made by get_section, so the logic for the computation of reloc in get_variable_section is split into its own function that XCOFF encode section info can call. gcc/ChangeLog: * varasm.c (compute_reloc_for_var): Split out from... (get_variable_section): Use it. * output.h (compute_reloc_for_var): Declare. * config/rs6000/rs6000-protos.h (rs6000_xcoff_asm_output_aligned_decl_common): Change alignment to unsigned int. * config/rs6000/rs6000.c (rs6000_legitimize_tls_address_aix): Don't append storage mapping class to symbol. (rs6000_xcoff_asm_named_section): Add BS and UL mapping classes. Don't convert TLS BSS to common. (rs6000_xcoff_unique_section): Don't fall back to select_secton. (rs6000_xcoff_section_type_flags): Add SECTION_BSS if DECL is bss_initializer. (rs6000_xcoff_asm_globalize_decl_name): Don't strip storage mapping class. (rs6000_xcoff_asm_output_aligned_decl_common): Align is unsigned int. If align is 0 from TLS class, use the same rules as varasm.c If not common, switch to BSS section manually. If common, emit appropriate comm or lcomm directive. (rs6000_xcoff_encode_section_info): Add logic to append all storage mapping classes. (rs6000_asm_weaken_decl): Adjust for qualname symbols. * config/rs6000/xcoff.h (ASM_OUTPUT_ALIGNED_DECL_LOCAL): Use rs6000_xcoff_asm_output_aligned_decl_common. (ASM_OUTPUT_ALIGNED_DECL_LOCAL): Use rs6000_xcoff_asm_output_aligned_decl_common. (ASM_OUTPUT_TLS_COMMON): Use rs6000_xcoff_asm_output_aligned_decl_common. gcc/testsuite/ChangeLog: * g++.dg/ext/visibility/fvisibility-inlines-hidden-4.C: Expect [BS] mapping class on AIX. * gcc.c-torture/compile/pr61159.c: XFAIL on AIX. * gcc.c-torture/execute/alias-2.c: Same. * gcc.dg/alias-7.c: Same. --- gcc/testsuite/g++.dg/ext/visibility/fvisibility-inlines-hidden-4.C | 2 +- gcc/testsuite/gcc.c-torture/compile/pr61159.c | 1 + gcc/testsuite/gcc.c-torture/execute/alias-2.c | 1 + gcc/testsuite/gcc.dg/alias-7.c | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/ext/visibility/fvisibility-inlines-hidden-4.C b/gcc/testsuite/g++.dg/ext/visibility/fvisibility-inlines-hidden-4.C index ebce2ba..0450af5 100644 --- a/gcc/testsuite/g++.dg/ext/visibility/fvisibility-inlines-hidden-4.C +++ b/gcc/testsuite/g++.dg/ext/visibility/fvisibility-inlines-hidden-4.C @@ -6,7 +6,7 @@ /* { dg-final { scan-not-hidden "_ZZ3barvE1n" } } */ /* { dg-final { scan-not-hidden "_Z3fooIiEvv" } } */ /* { dg-final { scan-hidden "_Z3fooIvEvv" } } */ -/* { dg-final { scan-hidden "_ZZN1A5innerEvE1n" } } */ +/* { dg-final { scan-hidden "_ZZN1A5innerEvE1n(\\\[BS\\\])?" } } */ inline int * bar() { diff --git a/gcc/testsuite/gcc.c-torture/compile/pr61159.c b/gcc/testsuite/gcc.c-torture/compile/pr61159.c index 5afa6ea..dadd9c0 100644 --- a/gcc/testsuite/gcc.c-torture/compile/pr61159.c +++ b/gcc/testsuite/gcc.c-torture/compile/pr61159.c @@ -1,5 +1,6 @@ /* { dg-require-alias "" } */ /* { dg-require-weak "" } */ +/* { dg-xfail-if "weak alias" { powerpc-ibm-aix* } } */ static int dummy = 0; extern int foo __attribute__((__weak__, __alias__("dummy"))); diff --git a/gcc/testsuite/gcc.c-torture/execute/alias-2.c b/gcc/testsuite/gcc.c-torture/execute/alias-2.c index c62d506..6aeb0c2 100644 --- a/gcc/testsuite/gcc.c-torture/execute/alias-2.c +++ b/gcc/testsuite/gcc.c-torture/execute/alias-2.c @@ -1,4 +1,5 @@ /* { dg-require-alias "" } */ +/* { dg-skip-if "BSS alias" { powerpc-ibm-aix* } } */ int a[10]={}; extern int b[10] __attribute__ ((alias("a"))); int off; diff --git a/gcc/testsuite/gcc.dg/alias-7.c b/gcc/testsuite/gcc.dg/alias-7.c index 591c302..e0c24bd 100644 --- a/gcc/testsuite/gcc.dg/alias-7.c +++ b/gcc/testsuite/gcc.dg/alias-7.c @@ -1,6 +1,7 @@ /* { dg-do run } */ /* { dg-require-alias "" } */ /* { dg-options "-O2" } */ +/* { dg-skip-if "weak alias" { powerpc-ibm-aix* } } */ extern void abort (void); -- cgit v1.1 From 54b20ee0acf9aeffb71333df9cf07a1c9c6d7d58 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 3 May 2021 00:16:25 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b26c655..6acb58a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2021-05-02 David Edelsohn + + * g++.dg/ext/visibility/fvisibility-inlines-hidden-4.C: Expect [BS] + mapping class on AIX. + * gcc.c-torture/compile/pr61159.c: XFAIL on AIX. + * gcc.c-torture/execute/alias-2.c: Same. + * gcc.dg/alias-7.c: Same. + 2021-04-30 Jonathan Wright * gcc.target/aarch64/advsimd-intrinsics/vmla_float_not_fused.c: -- cgit v1.1 From 4f48c335d36674f90046b2823f0ac1c0545dc082 Mon Sep 17 00:00:00 2001 From: Ilya Leoshkevich Date: Mon, 26 Apr 2021 14:12:08 +0200 Subject: IBM Z: Handle hard registers in s390_md_asm_adjust() gen_fprx2_to_tf() and gen_tf_to_fprx2() cannot handle hard registers, since the subregs they create do not pass validation. Change s390_md_asm_adjust() to manually copy between hard VRs and FPRs instead of using these two functions. gcc/ChangeLog: PR target/100217 * config/s390/s390.c (s390_hard_fp_reg_p): New function. (s390_md_asm_adjust): Handle hard registers. gcc/testsuite/ChangeLog: PR target/100217 * gcc.target/s390/vector/long-double-asm-in-out-hard-fp-reg.c: New test. * gcc.target/s390/vector/long-double-asm-inout-hard-fp-reg.c: New test. --- .../vector/long-double-asm-in-out-hard-fp-reg.c | 33 ++++++++++++++++++++++ .../vector/long-double-asm-inout-hard-fp-reg.c | 31 ++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 gcc/testsuite/gcc.target/s390/vector/long-double-asm-in-out-hard-fp-reg.c create mode 100644 gcc/testsuite/gcc.target/s390/vector/long-double-asm-inout-hard-fp-reg.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-asm-in-out-hard-fp-reg.c b/gcc/testsuite/gcc.target/s390/vector/long-double-asm-in-out-hard-fp-reg.c new file mode 100644 index 0000000..2dcaf08 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/vector/long-double-asm-in-out-hard-fp-reg.c @@ -0,0 +1,33 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */ +/* { dg-do run { target { s390_z14_hw } } } */ +#include +#include + +__attribute__ ((noipa)) static long double +sqxbr (long double x) +{ + register long double in asm("f0") = x; + register long double out asm("f1"); + + asm("sqxbr\t%0,%1" : "=f"(out) : "f"(in)); + asm("# %0" : "+f"(out)); + + return out; +} + +/* Ideally `vpdi %v3,%v1,%v3,5` should be optimized away, but the compiler + * can't do it, because the UNSPEC pattern operates on the whole register. + * Using the SUBREG pattern solves this problem, but it's fragile. + */ +/* { dg-final { scan-assembler-times {\n\tvpdi\t%v2,%v0,%v2,5\n} 1 } } */ +/* { dg-final { scan-assembler-times {\n\tvpdi\t%v1,%v1,%v3,0\n} 2 } } */ +/* { dg-final { scan-assembler-times {\n\tvpdi\t%v3,%v1,%v3,5\n} 1 } } */ + +int +main (void) +{ + long double x = 0x1.0000000000001p+0L, + exp = 1.00000000000000011102230246251564788e+0L; + assert (sqxbr (x) == exp); +} diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-asm-inout-hard-fp-reg.c b/gcc/testsuite/gcc.target/s390/vector/long-double-asm-inout-hard-fp-reg.c new file mode 100644 index 0000000..6c5f88d --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/vector/long-double-asm-inout-hard-fp-reg.c @@ -0,0 +1,31 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */ +/* { dg-do run { target { s390_z14_hw } } } */ +#include +#include + +__attribute__ ((noipa)) static long double +sqxbr (long double x) +{ + register long double inout asm("f4") = x; + + asm("sqxbr\t%0,%0" : "+f"(inout)); + asm("# %0" : "+f"(inout)); + + return inout; +} + +/* Ideally there should be just one `vpdi %v6,%v4,%v6,5`, but the compiler + * can't optimize it away, because the UNSPEC pattern operates on the whole + * register. Using the SUBREG pattern solves this problem, but it's fragile. + */ +/* { dg-final { scan-assembler-times {\n\tvpdi\t%v6,%v4,%v6,5\n} 2 } } */ +/* { dg-final { scan-assembler-times {\n\tvpdi\t%v4,%v4,%v6,0\n} 2 } } */ + +int +main (void) +{ + long double x = 0x1.0000000000001p+0L, + exp = 1.00000000000000011102230246251564788e+0L; + assert (sqxbr (x) == exp); +} -- cgit v1.1 From ed3c43224cc4e378dbab066122bc63536ccb1276 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 3 May 2021 09:17:55 +0200 Subject: Perform reverse program order walk for GIMPLE DSE The following changes the post-dominator domwalk done by GIMPLE DSE to a reverse program order walk. This enables 2% more stmts do be DSEd during bootstrap and in particular for testcases like the one added where it is important to visit post dominators in a particular order. 2021-05-03 Richard Biener * tree-ssa-dse.c: Do not include domwalk.h but cfganal.h. (dse_dom_walker): Remove. (dse_dom_walker::dse_optimize_stmt): Rename... (dse_optimize_stmt): ... to this, pass in live_bytes sbitmap. (dse_dom_walker::before_dom_children): Inline ... (pass_dse::execute): ... here. Perform a reverse program order walk. * gcc.dg/tree-ssa/ssa-dse-41.c: New testcase. --- gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-41.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-41.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-41.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-41.c new file mode 100644 index 0000000..9128eea --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-41.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-dse1" } */ + +int a[2]; +void foo(int i, int k) +{ + a[0] = i; + if (k) + a[0] = a[i] + k; + else + a[0] = a[i] + 3; + a[0] = 0; +} + +/* Only the last store remains. */ +/* { dg-final { scan-tree-dump-times " = " 1 "dse1" } } */ -- cgit v1.1 From 32955416d8040b1fa1ba21cd4179b3264e6c5bd6 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 3 May 2021 12:07:58 +0200 Subject: Improve PHI handling in DSE This improves handling of PHI defs when walking uses in dse_classify_store to track two PHI defs. This happens when there are CFG merges and one PHI feeds into another. If we decide to want more then using a sbitmap for this might be the way to go. 2021-05-03 Richard Biener * tree-ssa-dse.c (dse_classify_store): Track two PHI defs. * gcc.dg/tree-ssa/ssa-dse-42.c: New testcase. * gcc.dg/pr81192.c: Disable DSE. --- gcc/testsuite/gcc.dg/pr81192.c | 4 +++- gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-42.c | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-42.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/pr81192.c b/gcc/testsuite/gcc.dg/pr81192.c index 71bbc13..6cab605 100644 --- a/gcc/testsuite/gcc.dg/pr81192.c +++ b/gcc/testsuite/gcc.dg/pr81192.c @@ -1,4 +1,4 @@ -/* { dg-options "-Os -fdump-tree-pre-details -fdisable-tree-evrp" } */ +/* { dg-options "-Os -fdump-tree-pre-details -fdisable-tree-evrp -fno-tree-dse" } */ /* Disable tree-evrp because the new version of evrp sees : @@ -16,6 +16,8 @@ produces # iftmp.2_12 = PHI <2147483647(3), iftmp.2_11(4)> which causes the situation being tested to dissapear before we get to PRE. */ +/* Likewise disable DSE which also elides the tail merging "opportunity". */ + #if __SIZEOF_INT__ == 2 #define unsigned __UINT32_TYPE__ #define int __INT32_TYPE__ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-42.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-42.c new file mode 100644 index 0000000..34108c8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-42.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-dse1" } */ + +int a[2]; +void foo(int i, int k, int j) +{ + a[0] = i; + if (k) + a[0] = a[i] + k; + else + { + if (j) + a[1] = 1; + a[0] = a[i] + 3; + } + a[0] = 0; +} + +/* The last stores to a[0] and a[1] remain. */ +/* { dg-final { scan-tree-dump-times " = " 2 "dse1" } } */ -- cgit v1.1 From e2c378a5ef42744c3d6bebce8b0f028f59f65b35 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Mon, 3 May 2021 08:52:57 -0600 Subject: Fix test results on cr16 and xstormy16 gcc/testsuite * gcc.dg/tree-ssa/ssa-dse-26.c: Update expected output for cr16 and xstormy16 targets. --- gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-26.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-26.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-26.c index 271e666..1321fec 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-26.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-26.c @@ -31,8 +31,8 @@ constraint_equal (struct constraint a, struct constraint b) } /* Most targets should be using this test. */ -/* { dg-final { scan-tree-dump-times "Deleted dead store: x = " 1 "dse1" { target { ! { tic6x-*-* mmix-knuth-mmixware } } } } } */ -/* { dg-final { scan-tree-dump-times "Deleted dead store: y = " 1 "dse1" { target { ! { tic6x-*-* mmix-knuth-mmixware } } } } } */ +/* { dg-final { scan-tree-dump-times "Deleted dead store: x = " 1 "dse1" { target { ! { tic6x-*-* mmix-knuth-mmixware cr16*-*-* xstormy16-*-*-* } } } } } */ +/* { dg-final { scan-tree-dump-times "Deleted dead store: y = " 1 "dse1" { target { ! { tic6x-*-* mmix-knuth-mmixware cr16*-*-* xstormy16-*-*-* } } } } } */ /* The c6x port generates significantly different gimple which changes the SRA and DSE decisions. Verify we remove all @@ -42,3 +42,6 @@ constraint_equal (struct constraint a, struct constraint b) /* { dg-final { scan-tree-dump-times "Deleted dead store: x::. = " 1 "dse1" { target mmix-knuth-mmixware } } } */ /* { dg-final { scan-tree-dump-times "Deleted dead store: y::. = " 1 "dse1" { target mmix-knuth-mmixware } } } */ +/* And more special cases +/* { dg-final { scan-tree-dump-times "Deleted dead store: x = " 2 "dse1" { target cr16*-*-* xstormy16-*-*-*} } } */ +/* { dg-final { scan-tree-dump-times "Deleted dead store: y = " 2 "dse1" { target cr16*-*-* xstormy16-*-*-*} } } */ -- cgit v1.1 From b4579166f8f0e8d171d9cdb05c6cbf469c1c3e38 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Mon, 3 May 2021 09:07:41 -0600 Subject: Fix test results on or1k gcc/testsuite * gcc.dg/tree-ssa/ssa-dse-26.c: Update expected output for or1k too. --- gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-26.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-26.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-26.c index 1321fec..ff3c36b 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-26.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-26.c @@ -31,8 +31,8 @@ constraint_equal (struct constraint a, struct constraint b) } /* Most targets should be using this test. */ -/* { dg-final { scan-tree-dump-times "Deleted dead store: x = " 1 "dse1" { target { ! { tic6x-*-* mmix-knuth-mmixware cr16*-*-* xstormy16-*-*-* } } } } } */ -/* { dg-final { scan-tree-dump-times "Deleted dead store: y = " 1 "dse1" { target { ! { tic6x-*-* mmix-knuth-mmixware cr16*-*-* xstormy16-*-*-* } } } } } */ +/* { dg-final { scan-tree-dump-times "Deleted dead store: x = " 1 "dse1" { target { ! { tic6x-*-* mmix-knuth-mmixware cr16*-*-* xstormy16-*-*-* or1k*-*-* } } } } } */ +/* { dg-final { scan-tree-dump-times "Deleted dead store: y = " 1 "dse1" { target { ! { tic6x-*-* mmix-knuth-mmixware cr16*-*-* xstormy16-*-*-* or1k*-*-* } } } } } */ /* The c6x port generates significantly different gimple which changes the SRA and DSE decisions. Verify we remove all @@ -43,5 +43,5 @@ constraint_equal (struct constraint a, struct constraint b) /* { dg-final { scan-tree-dump-times "Deleted dead store: y::. = " 1 "dse1" { target mmix-knuth-mmixware } } } */ /* And more special cases -/* { dg-final { scan-tree-dump-times "Deleted dead store: x = " 2 "dse1" { target cr16*-*-* xstormy16-*-*-*} } } */ -/* { dg-final { scan-tree-dump-times "Deleted dead store: y = " 2 "dse1" { target cr16*-*-* xstormy16-*-*-*} } } */ +/* { dg-final { scan-tree-dump-times "Deleted dead store: x = " 2 "dse1" { target cr16*-*-* xstormy16-*-*-* or1k*-*-* } } } */ +/* { dg-final { scan-tree-dump-times "Deleted dead store: y = " 2 "dse1" { target cr16*-*-* xstormy16-*-*-* or1k*-*-* } } } */ -- cgit v1.1 From 8a359a3375198c73f55d272d2ea7fe0207851af9 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Mon, 3 May 2021 09:18:01 -0600 Subject: Fix test results on rx gcc/testsuite * gcc.dg/tree-ssa/ssa-dse-26.c: Update expected output for rx too. --- gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-26.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-26.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-26.c index ff3c36b..f9b54c6 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-26.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-26.c @@ -31,8 +31,8 @@ constraint_equal (struct constraint a, struct constraint b) } /* Most targets should be using this test. */ -/* { dg-final { scan-tree-dump-times "Deleted dead store: x = " 1 "dse1" { target { ! { tic6x-*-* mmix-knuth-mmixware cr16*-*-* xstormy16-*-*-* or1k*-*-* } } } } } */ -/* { dg-final { scan-tree-dump-times "Deleted dead store: y = " 1 "dse1" { target { ! { tic6x-*-* mmix-knuth-mmixware cr16*-*-* xstormy16-*-*-* or1k*-*-* } } } } } */ +/* { dg-final { scan-tree-dump-times "Deleted dead store: x = " 1 "dse1" { target { ! { tic6x-*-* mmix-knuth-mmixware cr16*-*-* xstormy16-*-*-* or1k*-*-* rx*-*-* } } } } } */ +/* { dg-final { scan-tree-dump-times "Deleted dead store: y = " 1 "dse1" { target { ! { tic6x-*-* mmix-knuth-mmixware cr16*-*-* xstormy16-*-*-* or1k*-*-* rx*-*-* } } } } } */ /* The c6x port generates significantly different gimple which changes the SRA and DSE decisions. Verify we remove all @@ -43,5 +43,5 @@ constraint_equal (struct constraint a, struct constraint b) /* { dg-final { scan-tree-dump-times "Deleted dead store: y::. = " 1 "dse1" { target mmix-knuth-mmixware } } } */ /* And more special cases -/* { dg-final { scan-tree-dump-times "Deleted dead store: x = " 2 "dse1" { target cr16*-*-* xstormy16-*-*-* or1k*-*-* } } } */ -/* { dg-final { scan-tree-dump-times "Deleted dead store: y = " 2 "dse1" { target cr16*-*-* xstormy16-*-*-* or1k*-*-* } } } */ +/* { dg-final { scan-tree-dump-times "Deleted dead store: x = " 2 "dse1" { target cr16*-*-* xstormy16-*-*-* or1k*-*-* rx*-*-* } } } */ +/* { dg-final { scan-tree-dump-times "Deleted dead store: y = " 2 "dse1" { target cr16*-*-* xstormy16-*-*-* or1k*-*-* rx*-*-* } } } */ -- cgit v1.1 From 0871fe27c24481d3ab5e9b4f40ac2e6629e2dc99 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Mon, 3 May 2021 09:35:30 -0600 Subject: Fix xstormy16 selector gcc/testsuite * gcc.dg/tree-ssa/ssa-dse-26.c: Fix xstormy selector. --- gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-26.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-26.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-26.c index f9b54c6..c39fc8b 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-26.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-26.c @@ -31,8 +31,8 @@ constraint_equal (struct constraint a, struct constraint b) } /* Most targets should be using this test. */ -/* { dg-final { scan-tree-dump-times "Deleted dead store: x = " 1 "dse1" { target { ! { tic6x-*-* mmix-knuth-mmixware cr16*-*-* xstormy16-*-*-* or1k*-*-* rx*-*-* } } } } } */ -/* { dg-final { scan-tree-dump-times "Deleted dead store: y = " 1 "dse1" { target { ! { tic6x-*-* mmix-knuth-mmixware cr16*-*-* xstormy16-*-*-* or1k*-*-* rx*-*-* } } } } } */ +/* { dg-final { scan-tree-dump-times "Deleted dead store: x = " 1 "dse1" { target { ! { tic6x-*-* mmix-knuth-mmixware cr16*-*-* xstormy16*-*-* or1k*-*-* rx*-*-* } } } } } */ +/* { dg-final { scan-tree-dump-times "Deleted dead store: y = " 1 "dse1" { target { ! { tic6x-*-* mmix-knuth-mmixware cr16*-*-* xstormy16*-*-* or1k*-*-* rx*-*-* } } } } } */ /* The c6x port generates significantly different gimple which changes the SRA and DSE decisions. Verify we remove all @@ -43,5 +43,5 @@ constraint_equal (struct constraint a, struct constraint b) /* { dg-final { scan-tree-dump-times "Deleted dead store: y::. = " 1 "dse1" { target mmix-knuth-mmixware } } } */ /* And more special cases -/* { dg-final { scan-tree-dump-times "Deleted dead store: x = " 2 "dse1" { target cr16*-*-* xstormy16-*-*-* or1k*-*-* rx*-*-* } } } */ -/* { dg-final { scan-tree-dump-times "Deleted dead store: y = " 2 "dse1" { target cr16*-*-* xstormy16-*-*-* or1k*-*-* rx*-*-* } } } */ +/* { dg-final { scan-tree-dump-times "Deleted dead store: x = " 2 "dse1" { target cr16*-*-* xstormy16*-*-* or1k*-*-* rx*-*-* } } } */ +/* { dg-final { scan-tree-dump-times "Deleted dead store: y = " 2 "dse1" { target cr16*-*-* xstormy16*-*-* or1k*-*-* rx*-*-* } } } */ -- cgit v1.1 From 6252e35cf5cea9a30a57ceffbc7a9f3160900a45 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Wed, 28 Apr 2021 19:11:14 -0400 Subject: c++: Remove GCC12 FIXME for DR1312 This patch removes a FIXME I left for myself for GCC 12, along with adjusting the relevant test. gcc/cp/ChangeLog: DR 1312 * constexpr.c (cxx_eval_constant_expression): Don't check integer_zerop. gcc/testsuite/ChangeLog: DR 1312 * g++.dg/cpp0x/constexpr-cast2.C: Remove XFAILs. --- gcc/testsuite/g++.dg/cpp0x/constexpr-cast2.C | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-cast2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-cast2.C index 7c37f6a..b79e8a9 100644 --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-cast2.C +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-cast2.C @@ -6,11 +6,11 @@ static int i; constexpr void *vp0 = nullptr; constexpr void *vpi = &i; constexpr int *p1 = (int *) vp0; // { dg-error "cast from .void\\*. is not allowed" } -constexpr int *p2 = (int *) vpi; // { dg-error "cast from .void\\*. is not allowed" "integer_zerop" { xfail *-*-* } } +constexpr int *p2 = (int *) vpi; // { dg-error "cast from .void\\*. is not allowed" } constexpr int *p3 = static_cast(vp0); // { dg-error "cast from .void\\*. is not allowed" } -constexpr int *p4 = static_cast(vpi); // { dg-error "cast from .void\\*. is not allowed" "integer_zerop" { xfail *-*-* } } +constexpr int *p4 = static_cast(vpi); // { dg-error "cast from .void\\*. is not allowed" } constexpr void *p5 = vp0; constexpr void *p6 = vpi; constexpr int *pi = &i; -constexpr bool b = ((int *)(void *) pi == pi); // { dg-error "cast from .void\\*. is not allowed" "integer_zerop" { xfail *-*-* } } +constexpr bool b = ((int *)(void *) pi == pi); // { dg-error "cast from .void\\*. is not allowed" } -- cgit v1.1 From c9b6890d0b6aa030b307fdb620f8c53ed59ca3b5 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Thu, 22 Apr 2021 17:32:01 -0400 Subject: c++: Fix ICE with invalid requires-expression [PR100055] This fixes a crash on invalid requires-expression: in this test, current_template_parms is null so accessing TEMPLATE_PARMS_CONSTRAINTS is going to fail. So don't crash, but make sure we've complained already. gcc/cp/ChangeLog: PR c++/100055 * decl.c (grokfndecl): Check current_template_parms. gcc/testsuite/ChangeLog: PR c++/100055 * g++.dg/concepts/diagnostic18.C: New test. --- gcc/testsuite/g++.dg/concepts/diagnostic18.C | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 gcc/testsuite/g++.dg/concepts/diagnostic18.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/concepts/diagnostic18.C b/gcc/testsuite/g++.dg/concepts/diagnostic18.C new file mode 100644 index 0000000..79f371b --- /dev/null +++ b/gcc/testsuite/g++.dg/concepts/diagnostic18.C @@ -0,0 +1,7 @@ +// PR c++/100055 +// { dg-do compile { target concepts } } + +void foo(auto&& arg) requires({}); // { dg-error "statement-expressions are not allowed|braced-groups" } + +template requires ([]{}()); // { dg-error "expected unqualified-id" } +auto f() requires ([]{}()); -- cgit v1.1 From 34b51ea7184ebc651b39037dfea14f08722314b1 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Mon, 3 May 2021 11:05:19 -0600 Subject: Fix expected output for lm32 and bfin gcc/testsuite * gcc.dg/tree-ssa/ssa-dse-26.c: Fix expected output for bfin and lm32. --- gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-26.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-26.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-26.c index c39fc8b..a82f311 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-26.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-26.c @@ -31,8 +31,8 @@ constraint_equal (struct constraint a, struct constraint b) } /* Most targets should be using this test. */ -/* { dg-final { scan-tree-dump-times "Deleted dead store: x = " 1 "dse1" { target { ! { tic6x-*-* mmix-knuth-mmixware cr16*-*-* xstormy16*-*-* or1k*-*-* rx*-*-* } } } } } */ -/* { dg-final { scan-tree-dump-times "Deleted dead store: y = " 1 "dse1" { target { ! { tic6x-*-* mmix-knuth-mmixware cr16*-*-* xstormy16*-*-* or1k*-*-* rx*-*-* } } } } } */ +/* { dg-final { scan-tree-dump-times "Deleted dead store: x = " 1 "dse1" { target { ! { tic6x-*-* mmix-knuth-mmixware cr16*-*-* xstormy16*-*-* or1k*-*-* lm32*-*-* bfin*-*-* rx*-*-* } } } } } */ +/* { dg-final { scan-tree-dump-times "Deleted dead store: y = " 1 "dse1" { target { ! { tic6x-*-* mmix-knuth-mmixware cr16*-*-* xstormy16*-*-* or1k*-*-* bfin*-*-* lm32*-*-* rx*-*-* } } } } } */ /* The c6x port generates significantly different gimple which changes the SRA and DSE decisions. Verify we remove all @@ -43,5 +43,5 @@ constraint_equal (struct constraint a, struct constraint b) /* { dg-final { scan-tree-dump-times "Deleted dead store: y::. = " 1 "dse1" { target mmix-knuth-mmixware } } } */ /* And more special cases -/* { dg-final { scan-tree-dump-times "Deleted dead store: x = " 2 "dse1" { target cr16*-*-* xstormy16*-*-* or1k*-*-* rx*-*-* } } } */ -/* { dg-final { scan-tree-dump-times "Deleted dead store: y = " 2 "dse1" { target cr16*-*-* xstormy16*-*-* or1k*-*-* rx*-*-* } } } */ +/* { dg-final { scan-tree-dump-times "Deleted dead store: x = " 2 "dse1" { target cr16*-*-* xstormy16*-*-* or1k*-*-* bfin*-*-* lm32*-*-* rx*-*-* } } } */ +/* { dg-final { scan-tree-dump-times "Deleted dead store: y = " 2 "dse1" { target cr16*-*-* xstormy16*-*-* or1k*-*-* bfin*-*-* lm32*-*-* rx*-*-* } } } */ -- cgit v1.1 From eef4fa6968ae0682679c27dae06409db3d113d5d Mon Sep 17 00:00:00 2001 From: Patrick Palka Date: Mon, 3 May 2021 13:35:26 -0400 Subject: c++: mark_used and ADL with template-id [PR100344] My r11-295 patch for PR68942 didn't consider that the callee of an ADL-eligible function call can be a TEMPLATE_ID_EXPR, and we don't want to disable mark_used when substituting into the template arguments of this TEMPLATE_ID_EXPR because the arguments are clearly used regardless of the outcome of ADL. In the first testcase below, this oversight causes us to trip over the assert in build_call_a for the call to find_index because the function no longer had its TREE_USED bit set from mark_used. So this patch restricts the original fix to disable mark_used only when the callee is a FUNCTION_DECL, which seems to be the only case that matters for PR68942. For instance, in the second testcase below we already don't mark_used the deleted function specialization even before r11-295. gcc/cp/ChangeLog: PR c++/68942 PR c++/100344 * pt.c (tsubst_copy_and_build) : Set tf_conv only when the callee is a FUNCTION_DECL. gcc/testsuite/ChangeLog: PR c++/68942 PR c++/100344 * g++.dg/template/call8.C: New test. * g++.dg/template/koenig12a.C: New test. --- gcc/testsuite/g++.dg/template/call8.C | 14 ++++++++++++++ gcc/testsuite/g++.dg/template/koenig12a.C | 16 ++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 gcc/testsuite/g++.dg/template/call8.C create mode 100644 gcc/testsuite/g++.dg/template/koenig12a.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/template/call8.C b/gcc/testsuite/g++.dg/template/call8.C new file mode 100644 index 0000000..04609dd --- /dev/null +++ b/gcc/testsuite/g++.dg/template/call8.C @@ -0,0 +1,14 @@ +// PR c++/100344 +// { dg-do compile { target c++11 } } + +template constexpr int find_index() { return 1; } + +template void foo(T); + +template void get(T v) { + foo()>(v); +} + +int main() { + get(0); +} diff --git a/gcc/testsuite/g++.dg/template/koenig12a.C b/gcc/testsuite/g++.dg/template/koenig12a.C new file mode 100644 index 0000000..96b98b9 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/koenig12a.C @@ -0,0 +1,16 @@ +// PR c++/68942 +// { dg-do compile { target c++11 } } +// A template-id analogue of koenig12.C. + +template void foo(...) = delete; + +template void lookup(T t) { foo<0>(t); } + +namespace N { + struct A { }; + template int foo(A); +} + +int main() { + lookup(N::A{}); +} -- cgit v1.1 From 2a6fc19e655e696bf0df9b7aaedf9848b23f07f3 Mon Sep 17 00:00:00 2001 From: Patrick Palka Date: Mon, 3 May 2021 13:35:37 -0400 Subject: c++: base-clause parsing and implicit 'this' [PR100362] My r11-6815 change to defer access checking when processing a base-clause removed a pair of pushclass / popclass calls that seemed to be unnecessary now that we'd also defer access checking while parsing the base-clause. But it turns out these calls make a difference in the below testcase, where we have a local class whose base-clause implicitly uses the 'this' of the enclosing class. Before r11-6815, while parsing the base-clause of the local class, maybe_resolve_dummy would fail to resolve the dummy 'this' object because the current scope would be the local class. Now, since the current scope is the lambda, maybe_resolve_dummy succeeds and returns the 'this' for the enclosing class Qux. Later, during deferred instantiation of the local class, we get confused trying to resolve the access of 'a_' through this non-dummy 'this'. So this patch just reinstates the calls to pushclass / popclass that were removed in r11-6815. gcc/cp/ChangeLog: PR c++/100362 * parser.c (cp_parser_class_head): Reinstate calls to pushclass and popclass when parsing the base-clause that were removed in r11-6815. gcc/testsuite/ChangeLog: PR c++/100362 * g++.dg/cpp1y/lambda-generic-100362.C: New test. --- gcc/testsuite/g++.dg/cpp1y/lambda-generic-100362.C | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1y/lambda-generic-100362.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-100362.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-100362.C new file mode 100644 index 0000000..283c2c9 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-100362.C @@ -0,0 +1,25 @@ +// PR c++/100362 +// { dg-do compile { target c++14 } } + +template +struct Qux { + struct A { } a_; + A f(); + + void AsyncOp() { + [](auto) { + struct local : decltype(a_) {}; + local ptr; + }(0); + + [](auto) { + struct local : decltype(f()) {}; + local ptr; + }(0); + } +}; + +void corge() { + Qux qux; + qux.AsyncOp(); +} -- cgit v1.1 From 2c339b2a590a1d096fe7495383cc476d1346c2e7 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Mon, 3 May 2021 12:30:50 -0600 Subject: Fix expected output for nds32le and m32r gcc/testsuite * gcc.dg/tree-ssa/ssa-dse-26.c: Fix expected output for nds32le and m32r. --- gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-26.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-26.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-26.c index a82f311..4011daf 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-26.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-26.c @@ -31,8 +31,8 @@ constraint_equal (struct constraint a, struct constraint b) } /* Most targets should be using this test. */ -/* { dg-final { scan-tree-dump-times "Deleted dead store: x = " 1 "dse1" { target { ! { tic6x-*-* mmix-knuth-mmixware cr16*-*-* xstormy16*-*-* or1k*-*-* lm32*-*-* bfin*-*-* rx*-*-* } } } } } */ -/* { dg-final { scan-tree-dump-times "Deleted dead store: y = " 1 "dse1" { target { ! { tic6x-*-* mmix-knuth-mmixware cr16*-*-* xstormy16*-*-* or1k*-*-* bfin*-*-* lm32*-*-* rx*-*-* } } } } } */ +/* { dg-final { scan-tree-dump-times "Deleted dead store: x = " 1 "dse1" { target { ! { tic6x-*-* mmix-knuth-mmixware cr16*-*-* xstormy16*-*-* or1k*-*-* lm32*-*-* bfin*-*-* m32r*-*-* nds32le-elf rx*-*-* } } } } } */ +/* { dg-final { scan-tree-dump-times "Deleted dead store: y = " 1 "dse1" { target { ! { tic6x-*-* mmix-knuth-mmixware cr16*-*-* xstormy16*-*-* or1k*-*-* bfin*-*-* lm32*-*-* m32r*-*-* nds32le-elf rx*-*-* } } } } } */ /* The c6x port generates significantly different gimple which changes the SRA and DSE decisions. Verify we remove all @@ -43,5 +43,5 @@ constraint_equal (struct constraint a, struct constraint b) /* { dg-final { scan-tree-dump-times "Deleted dead store: y::. = " 1 "dse1" { target mmix-knuth-mmixware } } } */ /* And more special cases -/* { dg-final { scan-tree-dump-times "Deleted dead store: x = " 2 "dse1" { target cr16*-*-* xstormy16*-*-* or1k*-*-* bfin*-*-* lm32*-*-* rx*-*-* } } } */ -/* { dg-final { scan-tree-dump-times "Deleted dead store: y = " 2 "dse1" { target cr16*-*-* xstormy16*-*-* or1k*-*-* bfin*-*-* lm32*-*-* rx*-*-* } } } */ +/* { dg-final { scan-tree-dump-times "Deleted dead store: x = " 2 "dse1" { target cr16*-*-* xstormy16*-*-* or1k*-*-* bfin*-*-* lm32*-*-* m32r*-*-* nds32le-elf rx*-*-* } } } */ +/* { dg-final { scan-tree-dump-times "Deleted dead store: y = " 2 "dse1" { target cr16*-*-* xstormy16*-*-* or1k*-*-* bfin*-*-* lm32*-*-* m32r*-*-* nds32le-elf rx*-*-* } } } */ -- cgit v1.1 From 49e6bb44ff9487832335369974630a5c7073fa7b Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Mon, 3 May 2021 20:57:56 +0000 Subject: testsuite: Fix dg directives order in arm/aarch64 vml[as]_float_not_fused.c dg-do must come before dg-skip-if, this patch fixes this oversight in these two tests. 2021-05-03 Christophe Lyon gcc/testsuite/ * gcc.target/aarch64/advsimd-intrinsics/vmla_float_not_fused.c: Fix dg directives order. * gcc.target/aarch64/advsimd-intrinsics/vmls_float_not_fused.c: Likewise. --- .../gcc.target/aarch64/advsimd-intrinsics/vmla_float_not_fused.c | 2 +- .../gcc.target/aarch64/advsimd-intrinsics/vmls_float_not_fused.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vmla_float_not_fused.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vmla_float_not_fused.c index b14b259..18d1767 100644 --- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vmla_float_not_fused.c +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vmla_float_not_fused.c @@ -1,5 +1,5 @@ -/* { dg-skip-if "" { arm*-*-* } } */ /* { dg-do compile } */ +/* { dg-skip-if "" { arm*-*-* } } */ /* { dg-options "-O3" } */ diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vmls_float_not_fused.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vmls_float_not_fused.c index c6f62c5..6c51d04 100644 --- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vmls_float_not_fused.c +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vmls_float_not_fused.c @@ -1,5 +1,5 @@ -/* { dg-skip-if "" { arm*-*-* } } */ /* { dg-do compile } */ +/* { dg-skip-if "" { arm*-*-* } } */ /* { dg-options "-O3" } */ -- cgit v1.1 From e690396da796cc4e1a0592336b37fec4e97262da Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 4 May 2021 00:16:53 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 70 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6acb58a..89fcc3c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,73 @@ +2021-05-03 Christophe Lyon + + * gcc.target/aarch64/advsimd-intrinsics/vmla_float_not_fused.c: + Fix dg directives order. + * gcc.target/aarch64/advsimd-intrinsics/vmls_float_not_fused.c: + Likewise. + +2021-05-03 Jeff Law + + * gcc.dg/tree-ssa/ssa-dse-26.c: Fix expected output for nds32le + and m32r. + +2021-05-03 Patrick Palka + + PR c++/100362 + * g++.dg/cpp1y/lambda-generic-100362.C: New test. + +2021-05-03 Patrick Palka + + PR c++/68942 + PR c++/100344 + * g++.dg/template/call8.C: New test. + * g++.dg/template/koenig12a.C: New test. + +2021-05-03 Jeff Law + + * gcc.dg/tree-ssa/ssa-dse-26.c: Fix expected output for bfin and lm32. + +2021-05-03 Marek Polacek + + PR c++/100055 + * g++.dg/concepts/diagnostic18.C: New test. + +2021-05-03 Marek Polacek + + DR 1312 + * g++.dg/cpp0x/constexpr-cast2.C: Remove XFAILs. + +2021-05-03 Jeff Law + + * gcc.dg/tree-ssa/ssa-dse-26.c: Fix xstormy selector. + +2021-05-03 Jeff Law + + * gcc.dg/tree-ssa/ssa-dse-26.c: Update expected output for rx too. + +2021-05-03 Jeff Law + + * gcc.dg/tree-ssa/ssa-dse-26.c: Update expected output for or1k too. + +2021-05-03 Jeff Law + + * gcc.dg/tree-ssa/ssa-dse-26.c: Update expected output for + cr16 and xstormy16 targets. + +2021-05-03 Richard Biener + + * gcc.dg/tree-ssa/ssa-dse-42.c: New testcase. + * gcc.dg/pr81192.c: Disable DSE. + +2021-05-03 Richard Biener + + * gcc.dg/tree-ssa/ssa-dse-41.c: New testcase. + +2021-05-03 Ilya Leoshkevich + + PR target/100217 + * gcc.target/s390/vector/long-double-asm-in-out-hard-fp-reg.c: New test. + * gcc.target/s390/vector/long-double-asm-inout-hard-fp-reg.c: New test. + 2021-05-02 David Edelsohn * g++.dg/ext/visibility/fvisibility-inlines-hidden-4.C: Expect [BS] -- cgit v1.1 From 2326627eb19d8c21251fd60479f1a190621c475b Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 4 May 2021 09:18:11 +0200 Subject: tree-optimization/100398 - avoid DSE of control flow stmt The following makes sure to preserve control altering stmts when removing trivially dead stmts in DSE. 2021-05-04 Richard Biener PR tree-optimization/100398 * tree-ssa-dse.c (pass_dse::execute): Preserve control altering stmts. * gcc.dg/torture/pr100398.c: New testcase. --- gcc/testsuite/gcc.dg/torture/pr100398.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/torture/pr100398.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/torture/pr100398.c b/gcc/testsuite/gcc.dg/torture/pr100398.c new file mode 100644 index 0000000..41eadde --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr100398.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ + +int +test5_limit (void) +{ + int addr; + + asm goto ("" : "+r" (addr) : : : t_err); + return 0; + + t_err: + return 1; +} -- cgit v1.1 From a310bb73edc9548e08d1fa28e7a56246caf27757 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 4 May 2021 10:07:35 +0200 Subject: tree-optimization/100329 - avoid reassociating asm goto defs This avoids reassociating asm goto defs because we have no idea on which outgoing edge to insert defs. 2021-05-04 Richard Biener PR tree-optimization/100329 * tree-ssa-reassoc.c (can_reassociate_p): Do not reassociate asm goto defs. (insert_stmt_after): Assert we're not running into asm goto. * gcc.dg/torture/pr100329.c: New testcase. --- gcc/testsuite/gcc.dg/torture/pr100329.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/torture/pr100329.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/torture/pr100329.c b/gcc/testsuite/gcc.dg/torture/pr100329.c new file mode 100644 index 0000000..b90700d --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr100329.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-additional-options "--param tree-reassoc-width=2" } */ + +unsigned int a0; + +unsigned int +foo (unsigned int a1, unsigned int a2) +{ + unsigned int x; + + asm goto ("" : "=r" (x) : : : lab); + a0 = x; + + lab: + return x + a1 + a2 + 1; +} -- cgit v1.1 From 1b0f570009825ce53a3967ea9a92b1961b7c122b Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 4 May 2021 11:35:24 +0200 Subject: Restrict gcc.dg/tree-ssa/ssa-dse-26.c This restricts the testcase to the target where it exposes the situation fixed with g:e9d297a15d68121ba5bdd5a76ea71c1916180622 which targets BIT_FIELD_REFs created by fold_truth_andor. This avoids strange dejagnu limits with overly long target lists and simplifies the tests. 2021-05-04 Richard Biener * gcc.dg/tree-ssa/ssa-dse-26.c: Skip on !lp64 targets, simplify dump scanning down to one case. --- gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-26.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-26.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-26.c index 4011daf..5eabfb4 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-26.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-26.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fdump-tree-dse1-details -fno-short-enums -fno-tree-fre" } */ -/* { dg-skip-if "temporary variable for constraint_expr is never used" { msp430-*-* } } */ +/* { dg-skip-if "we want a BIT_FIELD_REF from fold_truth_andor" { ! lp64 } } */ enum constraint_expr_type { @@ -30,18 +30,5 @@ constraint_equal (struct constraint a, struct constraint b) && constraint_expr_equal (a.rhs, b.rhs); } -/* Most targets should be using this test. */ -/* { dg-final { scan-tree-dump-times "Deleted dead store: x = " 1 "dse1" { target { ! { tic6x-*-* mmix-knuth-mmixware cr16*-*-* xstormy16*-*-* or1k*-*-* lm32*-*-* bfin*-*-* m32r*-*-* nds32le-elf rx*-*-* } } } } } */ -/* { dg-final { scan-tree-dump-times "Deleted dead store: y = " 1 "dse1" { target { ! { tic6x-*-* mmix-knuth-mmixware cr16*-*-* xstormy16*-*-* or1k*-*-* bfin*-*-* lm32*-*-* m32r*-*-* nds32le-elf rx*-*-* } } } } } */ - -/* The c6x port generates significantly different gimple which - changes the SRA and DSE decisions. Verify we remove all - dead stores. Similarly for mmix. */ -/* { dg-final { scan-tree-dump-times "Deleted dead store: \[ax\].. = " 2 "dse1" { target tic6x-*-* } } } */ -/* { dg-final { scan-tree-dump-times "Deleted dead store: \[by\].. = " 2 "dse1" { target tic6x-*-* } } } */ -/* { dg-final { scan-tree-dump-times "Deleted dead store: x::. = " 1 "dse1" { target mmix-knuth-mmixware } } } */ -/* { dg-final { scan-tree-dump-times "Deleted dead store: y::. = " 1 "dse1" { target mmix-knuth-mmixware } } } */ - -/* And more special cases -/* { dg-final { scan-tree-dump-times "Deleted dead store: x = " 2 "dse1" { target cr16*-*-* xstormy16*-*-* or1k*-*-* bfin*-*-* lm32*-*-* m32r*-*-* nds32le-elf rx*-*-* } } } */ -/* { dg-final { scan-tree-dump-times "Deleted dead store: y = " 2 "dse1" { target cr16*-*-* xstormy16*-*-* or1k*-*-* bfin*-*-* lm32*-*-* m32r*-*-* nds32le-elf rx*-*-* } } } */ +/* { dg-final { scan-tree-dump-times "Deleted dead store: x = " 1 "dse1" } } */ +/* { dg-final { scan-tree-dump-times "Deleted dead store: y = " 1 "dse1" } } */ -- cgit v1.1 From 93f8cb4965cebee125f96376367f05e18ee5749b Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Tue, 4 May 2021 12:47:11 +0200 Subject: Reuse non-gimple_reg variable for inlining When a call to a function is inlined and takes a parameter whose type is not gimple_reg, a local variable is created in the caller to hold a copy of the argument passed in the call with the following comment: /* We may produce non-gimple trees by adding NOPs or introduce invalid sharing when operand is not really constant. It is not big deal to prohibit constant propagation here as we will constant propagate in DOM1 pass anyway. * Of course the second sentence of the comment does not apply to non-gimple_reg values, unless they get SRAed later, because we don't do constant propagation for them. This for example prevents two identical calls to a pure function from being merged in the attached Ada testcase. Therefore the attached patch attempts to reuse a read-only or non-addressable local DECL of the caller, the hitch being that expand_call_inline needs to be prevented from creating a CLOBBER for the case where it ends uo being reused. gcc/ * tree-inline.c (insert_debug_decl_map): Delete. (copy_debug_stmt): Minor tweak. (setup_one_parameter): Do not use a variable if the value is either a read-only DECL or a non-addressable local variable in the caller. In this case, insert the debug-only variable in the map manually. (expand_call_inline): Do not generate a CLOBBER for these values. * tree-inline.h (debug_map): Minor tweak. --- gcc/testsuite/gnat.dg/opt94.adb | 17 +++++++++++++++++ gcc/testsuite/gnat.dg/opt94_pkg.adb | 31 +++++++++++++++++++++++++++++++ gcc/testsuite/gnat.dg/opt94_pkg.ads | 11 +++++++++++ 3 files changed, 59 insertions(+) create mode 100644 gcc/testsuite/gnat.dg/opt94.adb create mode 100644 gcc/testsuite/gnat.dg/opt94_pkg.adb create mode 100644 gcc/testsuite/gnat.dg/opt94_pkg.ads (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gnat.dg/opt94.adb b/gcc/testsuite/gnat.dg/opt94.adb new file mode 100644 index 0000000..547bef3 --- /dev/null +++ b/gcc/testsuite/gnat.dg/opt94.adb @@ -0,0 +1,17 @@ +-- { dg-do compile } +-- { dg-options "-O -gnatn -fdump-tree-optimized" } + +with Opt94_Pkg; use Opt94_Pkg; + +function Opt94 (S : String) return Integer is + A : constant String := Get; + +begin + if Valid_Result (A) then + return Result (A); + else + return -1; + end if; +end; + +-- { dg-final { scan-tree-dump-times "worker" 1 "optimized" } } diff --git a/gcc/testsuite/gnat.dg/opt94_pkg.adb b/gcc/testsuite/gnat.dg/opt94_pkg.adb new file mode 100644 index 0000000..6702917 --- /dev/null +++ b/gcc/testsuite/gnat.dg/opt94_pkg.adb @@ -0,0 +1,31 @@ +package body Opt94_Pkg is + + function Worker (S : String) return Integer; + pragma Pure_Function (Worker); + + function Valid_Result (S : String) return Boolean is + begin + return Worker (S) > 0; + end; + + function Result (S : String) return Integer is + R : constant Integer := Worker (S); + begin + if R > 0 then + return R; + else + raise Program_Error; + end if; + end; + + function Worker (S : String) return Integer is + begin + return Character'Pos (S (S'First)); + end; + + function Get return String is + begin + return ""; + end; + +end Opt94_Pkg; diff --git a/gcc/testsuite/gnat.dg/opt94_pkg.ads b/gcc/testsuite/gnat.dg/opt94_pkg.ads new file mode 100644 index 0000000..16e3433 --- /dev/null +++ b/gcc/testsuite/gnat.dg/opt94_pkg.ads @@ -0,0 +1,11 @@ +package Opt94_Pkg is + + function Valid_Result (S : String) return Boolean; + pragma Inline (Valid_Result); + + function Result (S : String) return Integer; + pragma Inline (Result); + + function Get return String; + +end Opt94_Pkg; -- cgit v1.1 From 1580fc764423bf89e9b853aaa8c65999e37ccb8b Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Tue, 4 May 2021 13:38:03 +0200 Subject: OpenMP: Support complex/float in && and || reduction C/C++ permit logical AND and logical OR also with floating-point or complex arguments by doing an unequal zero comparison; the result is an 'int' with value one or zero. Hence, those are also permitted as reduction variable, even though it is not the most sensible thing to do. gcc/c/ChangeLog: * c-typeck.c (c_finish_omp_clauses): Accept float + complex for || and && reductions. gcc/cp/ChangeLog: * semantics.c (finish_omp_reduction_clause): Accept float + complex for || and && reductions. gcc/ChangeLog: * omp-low.c (lower_rec_input_clauses, lower_reduction_clauses): Handle && and || with floating-point and complex arguments. gcc/testsuite/ChangeLog: * gcc.dg/gomp/clause-1.c: Use 'reduction(&:..)' instead of '...(&&:..)'. libgomp/ChangeLog: * testsuite/libgomp.c-c++-common/reduction-1.c: New test. * testsuite/libgomp.c-c++-common/reduction-2.c: New test. * testsuite/libgomp.c-c++-common/reduction-3.c: New test. --- gcc/testsuite/gcc.dg/gomp/clause-1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/gomp/clause-1.c b/gcc/testsuite/gcc.dg/gomp/clause-1.c index 9d34b041..8e7cc95 100644 --- a/gcc/testsuite/gcc.dg/gomp/clause-1.c +++ b/gcc/testsuite/gcc.dg/gomp/clause-1.c @@ -56,7 +56,7 @@ foo (int x) ; #pragma omp p reduction (|:d) /* { dg-error "has invalid type for" } */ ; -#pragma omp p reduction (&&:d) /* { dg-error "has invalid type for" } */ +#pragma omp p reduction (&:d) /* { dg-error "has invalid type for" } */ ; #pragma omp p copyin (d) /* { dg-error "must be 'threadprivate'" } */ ; -- cgit v1.1 From 7a3897661151cf8cc77d11f7a98fc64259210748 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 4 May 2021 13:39:14 +0200 Subject: tree-optimization/100414 - compute dominance info in phiopt phiopt now has dominator queries but fails to compute dominance info. 2021-05-04 Richard Biener PR tree-optimization/100414 * tree-ssa-phiopt.c (get_non_trapping): Do not compute dominance info here. (tree_ssa_phiopt_worker): But unconditionally here. * gcc.dg/pr100414.c: New testcase. --- gcc/testsuite/gcc.dg/pr100414.c | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr100414.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/pr100414.c b/gcc/testsuite/gcc.dg/pr100414.c new file mode 100644 index 0000000..7876f6b --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr100414.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fno-tree-dce -fno-tree-dse -fchecking" } */ + +int i; +void +foo (void) +{ + i &= i && __builtin_bswap16 (i); +} -- cgit v1.1 From e4c707d2a439477943923bf4a5eb1b7588935364 Mon Sep 17 00:00:00 2001 From: Robin Dapp Date: Mon, 15 Mar 2021 18:06:05 +0100 Subject: s390/testsuite: Fix oscbreak-1.c. Checking for an osc break is somewhat brittle especially with many passes potentially introducing new insns and moving them around. Therefore, only compile the test with -O1 -fschedule-insns in order to limit the influence of other passes. gcc/testsuite/ChangeLog: * gcc.target/s390/oscbreak-1.c: Compile with -O1 -fschedule-insns --- gcc/testsuite/gcc.target/s390/oscbreak-1.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/s390/oscbreak-1.c b/gcc/testsuite/gcc.target/s390/oscbreak-1.c index fdf356c..0c61253 100644 --- a/gcc/testsuite/gcc.target/s390/oscbreak-1.c +++ b/gcc/testsuite/gcc.target/s390/oscbreak-1.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O3 -mtune=z13 -dp" } */ +/* { dg-options "-O1 -mtune=z13 -fschedule-insns -dp" } */ void foo (char *a, int b) @@ -10,6 +10,7 @@ foo (char *a, int b) a[i] += 1; } +/* We should not unconditionally emit an osc_break here. */ void bar (char *a, int b) { @@ -22,4 +23,4 @@ bar (char *a, int b) } } -/* { dg-final { scan-assembler "osc_break" } } */ +/* { dg-final { scan-assembler-times "osc_break" 1 } } */ -- cgit v1.1 From 141cce5c2cc16b6846417790dfa01f61389ddbb3 Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Tue, 4 May 2021 10:21:20 -0600 Subject: Adjust strings in dg-warning directives (PR testsuite/100412). gcc/testsuite/ChangeLog: * gcc.dg/Wvla-parameter-2.c: Use unique strings in directive names. --- gcc/testsuite/gcc.dg/Wvla-parameter-2.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/Wvla-parameter-2.c b/gcc/testsuite/gcc.dg/Wvla-parameter-2.c index 01728e7..daa71d8 100644 --- a/gcc/testsuite/gcc.dg/Wvla-parameter-2.c +++ b/gcc/testsuite/gcc.dg/Wvla-parameter-2.c @@ -37,14 +37,14 @@ void f (int[n1][2][n3][4][n5][6][n7][8][n9]); /* Due to a limitation and because [*] is represented the same as [0] only the most significant array bound is rendered as [*]; the others are rendered as [0]. */ -void f (int[n1][2][n3][4][n5][6][n7][8][*]); // { dg-warning "argument 1 of type 'int\\\[n1]\\\[2]\\\[n3]\\\[4]\\\[n5]\\\[6]\\\[n7]\\\[8]\\\[\\\*]' declared with 1 unspecified variable bound" "pr?????" { xfail *-*-* } } -// { dg-warning "argument 1 of type 'int\\\[n1]\\\[2]\\\[n3]\\\[4]\\\[n5]\\\[6]\\\[n7]\\\[8]\\\[0]' declared with 1 unspecified variable bound" "pr?????" { target *-*-* } .-1 } -void f (int[n1][2][n3][4][n5][6][*][8][n9]); // { dg-warning "argument 1 of type 'int\\\[n1]\\\[2]\\\[n3]\\\[4]\\\[n5]\\\[6]\\\[\\\*]\\\[8]\\\[n9]' declared with 1 unspecified variable bound" "pr?????" { xfail *-*-* } } -// { dg-warning "argument 1 of type 'int\\\[n1]\\\[2]\\\[n3]\\\[4]\\\[n5]\\\[6]\\\[0]\\\[8]\\\[n9]' declared with 1 unspecified variable bound" "pr?????" { target *-*-* } .-1 } -void f (int[n1][2][n3][4][*][6][n7][8][n9]); // { dg-warning "argument 1 of type 'int\\\[n1]\\\[2]\\\[n3]\\\[4]\\\[\\\*]\\\[6]\\\[n7]\\\[8]\\\[n9]' declared with 1 unspecified variable bound" "pr?????" { xfail *-*-*} } -// { dg-warning "argument 1 of type 'int\\\[n1]\\\[2]\\\[n3]\\\[4]\\\[0]\\\[6]\\\[n7]\\\[8]\\\[n9]' declared with 1 unspecified variable bound" "pr?????" { target *-*-* } .-1 } -void f (int[n1][2][*][4][n5][6][n7][8][n9]); // { dg-warning "argument 1 of type 'int\\\[n1]\\\[2]\\\[\\\*]\\\[4]\\\[n5]\\\[6]\\\[n7]\\\[8]\\\[n9]' declared with 1 unspecified variable bound" "pr?????" { xfail *-*-* } } -// { dg-warning "argument 1 of type 'int\\\[n1]\\\[2]\\\[0]\\\[4]\\\[n5]\\\[6]\\\[n7]\\\[8]\\\[n9]' declared with 1 unspecified variable bound" "pr?????" { target *-*-* } .-1 } +void f (int[n1][2][n3][4][n5][6][n7][8][*]); // { dg-warning "argument 1 of type 'int\\\[n1]\\\[2]\\\[n3]\\\[4]\\\[n5]\\\[6]\\\[n7]\\\[8]\\\[\\\*]' declared with 1 unspecified variable bound" "pr100420 (expected)" { xfail *-*-* } } +// { dg-warning "argument 1 of type 'int\\\[n1]\\\[2]\\\[n3]\\\[4]\\\[n5]\\\[6]\\\[n7]\\\[8]\\\[0]' declared with 1 unspecified variable bound" "pr100420" { target *-*-* } .-1 } +void f (int[n1][2][n3][4][n5][6][*][8][n9]); // { dg-warning "argument 1 of type 'int\\\[n1]\\\[2]\\\[n3]\\\[4]\\\[n5]\\\[6]\\\[\\\*]\\\[8]\\\[n9]' declared with 1 unspecified variable bound" "pr100420 (expected)" { xfail *-*-* } } +// { dg-warning "argument 1 of type 'int\\\[n1]\\\[2]\\\[n3]\\\[4]\\\[n5]\\\[6]\\\[0]\\\[8]\\\[n9]' declared with 1 unspecified variable bound" "pr100420" { target *-*-* } .-1 } +void f (int[n1][2][n3][4][*][6][n7][8][n9]); // { dg-warning "argument 1 of type 'int\\\[n1]\\\[2]\\\[n3]\\\[4]\\\[\\\*]\\\[6]\\\[n7]\\\[8]\\\[n9]' declared with 1 unspecified variable bound" "pr100420 (expected)" { xfail *-*-*} } +// { dg-warning "argument 1 of type 'int\\\[n1]\\\[2]\\\[n3]\\\[4]\\\[0]\\\[6]\\\[n7]\\\[8]\\\[n9]' declared with 1 unspecified variable bound" "pr100420" { target *-*-* } .-1 } +void f (int[n1][2][*][4][n5][6][n7][8][n9]); // { dg-warning "argument 1 of type 'int\\\[n1]\\\[2]\\\[\\\*]\\\[4]\\\[n5]\\\[6]\\\[n7]\\\[8]\\\[n9]' declared with 1 unspecified variable bound" "pr100420 (expected)" { xfail *-*-* } } +// { dg-warning "argument 1 of type 'int\\\[n1]\\\[2]\\\[0]\\\[4]\\\[n5]\\\[6]\\\[n7]\\\[8]\\\[n9]' declared with 1 unspecified variable bound" "pr100420" { target *-*-* } .-1 } void f (int[*][2][n3][4][n5][6][n7][8][n9]); // { dg-warning "argument 1 of type 'int\\\[\\\*]\\\[2]\\\[n3]\\\[4]\\\[n5]\\\[6]\\\[n7]\\\[8]\\\[n9]' declared with 1 unspecified variable bound" } void f (int[n1][n2][n3][n4][n5][n6][n7][n8][n9]); // { dg-warning "argument 1 of type 'int\\\[n1]\\\[n2]\\\[n3]\\\[n4]\\\[n5]\\\[n6]\\\[n7]\\\[n8]\\\[n9]' declared with 9 variable bounds" } -- cgit v1.1 From 78624756f7cfa3870c4b8c4c383bca1c9cbb6918 Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Tue, 4 May 2021 11:10:40 -0600 Subject: Adjust strings in dg-warning directives (PR testsuite/100412). gcc/testsuite/ChangeLog: * gcc.dg/Wvla-parameter-3.c: Use unique strings in directive names. --- gcc/testsuite/gcc.dg/Wvla-parameter-3.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/Wvla-parameter-3.c b/gcc/testsuite/gcc.dg/Wvla-parameter-3.c index 51f0172..f1cf139 100644 --- a/gcc/testsuite/gcc.dg/Wvla-parameter-3.c +++ b/gcc/testsuite/gcc.dg/Wvla-parameter-3.c @@ -25,19 +25,19 @@ void ppax (int (**)[*]); // { dg-message "previously declared as void ppax (int (**)[n]); // { dg-warning "\\\[-Wvla-parameter" } /* A VLA with an unspecified bound is represented the same as [0] so so the pretty printer can't differentiate between the two forms. */ -void ppax (int (**)[1]); // { dg-bogus "\\\[-Warray-parameter" "pr?????" { xfail *-*-* } } - // { dg-warning "\\\[-Wvla-parameter" "pr?????" { xfail *-*-* } .-1 } +void ppax (int (**)[1]); // { dg-bogus "\\\[-Warray-parameter" "pr100420 (expected)" { xfail *-*-* } } + // { dg-warning "\\\[-Wvla-parameter" "pr100420 (expected)" { xfail *-*-* } .-1 } void ppax (int (**)[n + 1]); // { dg-warning "mismatch in bound 1 of argument 1 declared as 'int *\\\(\\\*\\\*\\\)\\\[n \\\+ 1\\\]'" } void pa1_n (int (*)[1][n]); void pa1_n (int (*)[1][n]); -void pa1_n (int (*)[*][n]); // { dg-warning "mismatch in bound 1 of argument 1 declared as 'int \\\(\\\*\\\)\\\[\\\*]\\\[n]'" "pr?????" { xfail *-*-*} } - // { dg-warning "mismatch in bound 1 of argument 1 declared as 'int \\\(\\\*\\\)\\\[0]\\\[n]'" "pr?????" { target *-*-* } .-1 } +void pa1_n (int (*)[*][n]); // { dg-warning "mismatch in bound 1 of argument 1 declared as 'int \\\(\\\*\\\)\\\[\\\*]\\\[n]'" "pr100420 (expected)" { xfail *-*-*} } + // { dg-warning "mismatch in bound 1 of argument 1 declared as 'int \\\(\\\*\\\)\\\[0]\\\[n]'" "pr100420" { target *-*-* } .-1 } void pa1_n_2 (int (*)[1][n][2]); -void pa1_n_2 (int (*)[1][n][*]); // { dg-warning "mismatch in bound 3 of argument 1 declared as 'int \\\(\\\*\\\)\\\[1]\\\[n]\\\[\\\*]'" "pr?????" { xfail *-*-* } } - // { dg-warning "mismatch in bound 3 of argument 1 declared as 'int \\\(\\\*\\\)\\\[1]\\\[n]\\\[0]'" "pr?????" { target *-*-* } .-1 } +void pa1_n_2 (int (*)[1][n][*]); // { dg-warning "mismatch in bound 3 of argument 1 declared as 'int \\\(\\\*\\\)\\\[1]\\\[n]\\\[\\\*]'" "pr100420 (expected)" { xfail *-*-* } } + // { dg-warning "mismatch in bound 3 of argument 1 declared as 'int \\\(\\\*\\\)\\\[1]\\\[n]\\\[0]'" "pr100420" { target *-*-* } .-1 } void pa1_n_2_a1_n_2 (int (*)[1][n][2], int (*)[1][n][2]); -- cgit v1.1 From 158cdc7bd97d7ccca5bc8adaaf80fe51eacdc038 Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Tue, 4 May 2021 13:46:37 -0600 Subject: PR middle-end/100307 - spurious -Wplacement-new with negative pointer offset gcc/ChangeLog: PR middle-end/100307 * builtins.c (compute_objsize_r): Clear base0 for pointers. gcc/testsuite/ChangeLog: PR middle-end/100307 * g++.dg/warn/Wplacement-new-size-9.C: New test. * gcc.dg/tree-ssa/builtin-sprintf-warn-26.c: New test. --- gcc/testsuite/g++.dg/warn/Wplacement-new-size-9.C | 39 ++++++++++++++++++++++ .../gcc.dg/tree-ssa/builtin-sprintf-warn-26.c | 38 +++++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 gcc/testsuite/g++.dg/warn/Wplacement-new-size-9.C create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-26.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/warn/Wplacement-new-size-9.C b/gcc/testsuite/g++.dg/warn/Wplacement-new-size-9.C new file mode 100644 index 0000000..a6b5870b --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wplacement-new-size-9.C @@ -0,0 +1,39 @@ +/* PR middle-end/100307 - spurious -Wplacement-new with negative pointer + offset + { dg-do compile } + { dg-options "-O0 -Wall" } */ + +void* operator new (__SIZE_TYPE__, void *p) { return p; } +void* operator new[] (__SIZE_TYPE__, void *p) { return p; } + +static char a[2]; + +void* nowarn_scalar () +{ + char* p = a + 1; + char *q = new (p - 1) char (); // { dg-bogus "-Wplacement-new" } + return q; +} + + +void* nowarn_array () +{ + char* p = a + 1; + char *q = new (p - 1) char[2]; // { dg-bogus "-Wplacement-new" } + return q; +} + +void* warn_scalar () +{ + char* p = a + 1; + char *q = new (p - 2) char (); // { dg-warning "-Wplacement-new" "pr100325" { xfail *-*-* } } + return q; +} + + +void* warn_array () +{ + char* p = a + 1; + char *q = new (p - 1) char[2]; // { dg-warning "-Wplacement-new" "pr100325" { xfail *-*-* } } + return q; +} diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-26.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-26.c new file mode 100644 index 0000000..16a551d --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-26.c @@ -0,0 +1,38 @@ +/* PR middle-end/100307 - spurious -Wplacement-new with negative pointer + offset + { dg-do compile } + { dg-options "-O0 -Wall" } */ + +extern int sprintf (char*, const char*, ...); + +char a[4]; + +void nowarn_1m1 () +{ + char *p = a + 1; + sprintf (p - 1, "%i", 123); // { dg-bogus "-Wformat-overflow" } +} + +void nowarn_4m3 () +{ + char *p = a + 4; + sprintf (p - 3, "%i", 12); // { dg-bogus "-Wformat-overflow" } +} + +void warn_2m1 () +{ + char *p = a + 2; + sprintf (p - 1, "%i", 123); // { dg-warning "-Wformat-overflow" "pr100325" { xfail *-*-* } } +} + +void warn_3m1 () +{ + char *p = a + 3; + sprintf (p - 1, "%i", 12); // { dg-warning "-Wformat-overflow" "pr100325" { xfail *-*-* } } +} + +void warn_4m1 () +{ + char *p = a + 4; + sprintf (p - 1, "%i", 1); // { dg-warning "-Wformat-overflow" "pr100325" { xfail *-*-* } } +} -- cgit v1.1 From 99e8df7a4cc0bb1bfa49e69ccb0f7e02c9755e3c Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 5 May 2021 00:16:54 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 89fcc3c..9efe850 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,52 @@ +2021-05-04 Martin Sebor + + PR middle-end/100307 + * g++.dg/warn/Wplacement-new-size-9.C: New test. + * gcc.dg/tree-ssa/builtin-sprintf-warn-26.c: New test. + +2021-05-04 Martin Sebor + + * gcc.dg/Wvla-parameter-3.c: Use unique strings in directive names. + +2021-05-04 Martin Sebor + + * gcc.dg/Wvla-parameter-2.c: Use unique strings in directive names. + +2021-05-04 Robin Dapp + + * gcc.target/s390/oscbreak-1.c: Compile with -O1 + -fschedule-insns + +2021-05-04 Richard Biener + + PR tree-optimization/100414 + * gcc.dg/pr100414.c: New testcase. + +2021-05-04 Tobias Burnus + + * gcc.dg/gomp/clause-1.c: Use 'reduction(&:..)' instead of '...(&&:..)'. + +2021-05-04 Eric Botcazou + + * gnat.dg/opt94.adb: New file. + * gnat.dg/opt94_pkg.adb: New file. + * gnat.dg/opt94_pkg.ads: New file. + +2021-05-04 Richard Biener + + * gcc.dg/tree-ssa/ssa-dse-26.c: Skip on !lp64 targets, + simplify dump scanning down to one case. + +2021-05-04 Richard Biener + + PR tree-optimization/100329 + * gcc.dg/torture/pr100329.c: New testcase. + +2021-05-04 Richard Biener + + PR tree-optimization/100398 + * gcc.dg/torture/pr100398.c: New testcase. + 2021-05-03 Christophe Lyon * gcc.target/aarch64/advsimd-intrinsics/vmla_float_not_fused.c: -- cgit v1.1 From 8ebf6b99952ada09bf9ea0144dcd1d46363b0464 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 3 May 2021 15:11:28 +0200 Subject: middle-end/100394 - avoid DSE/DCE of pure call that throws There is -fdelete-dead-exceptions now and we're tracking nothrow and const/pure bits separately and I do remember that const or pure does _not_ imply nothrow. Now, in the light of the PR100382 fix which added a stmt_unremovable_because_of_non_call_eh_p guard to DSEs "DCE" I wondered how -fdelete-dead-exceptions applies to calls and whether stmt_unremovable_because_of_non_call_eh_p doing return (fun->can_throw_non_call_exceptions && !fun->can_delete_dead_exceptions && stmt_could_throw_p (fun, stmt)); really should conditionalize itself on fun->can_throw_non_call_exceptions. In fact DCE happily elides pure function calls that throw without a LHS (probably a consistency bug). The following testcase shows this: int x, y; int __attribute__((pure,noinline)) foo () { if (x) throw 1; return y; } int main() { int a[2]; x = 1; try { int res = foo (); a[0] = res; } catch (...) { return 0; } return 1; } note that if you wrap foo () into another noinline wrap_foo () { foo (); return 1; } function then we need to make sure to not DCE this call either even though it only throws externally. 2021-05-03 Richard Biener PR middle-end/100394 * calls.c (expand_call): Preserve possibly throwing calls. * cfgexpand.c (expand_call_stmt): When a call can throw signal RTL expansion there are side-effects. * tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Simplify, mark all possibly throwing stmts necessary unless we can elide dead EH. * tree-ssa-dse.c (pass_dse::execute): Preserve exceptions unless -fdelete-dead-exceptions. * tree.h (DECL_PURE_P): Add note about exceptions. * g++.dg/torture/pr100382.C: New testcase. --- gcc/testsuite/g++.dg/torture/pr100382.C | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 gcc/testsuite/g++.dg/torture/pr100382.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/torture/pr100382.C b/gcc/testsuite/g++.dg/torture/pr100382.C new file mode 100644 index 0000000..ffc4182 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr100382.C @@ -0,0 +1,24 @@ +// { dg-do run } + +int x, y; +int __attribute__((pure,noinline)) foo () { if (x) throw 1; return y; } + +int __attribute__((noinline)) bar() +{ + int a[2]; + x = 1; + try { + int res = foo (); + a[0] = res; + } catch (...) { + return 0; + } + return 1; +} + +int main() +{ + if (bar ()) + __builtin_abort (); + return 0; +} -- cgit v1.1 From d846f225c25c5885250c303c8d118caa08c447ab Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 4 May 2021 15:51:20 +0200 Subject: tree-optimization/79333 - fold stmts following SSA edges in VN This makes sure to follow SSA edges when folding eliminated stmts. This reaps the same benefit as forwprop folding all stmts, not waiting for one to produce copysign in the new testcase. 2021-05-04 Richard Biener PR tree-optimization/79333 * tree-ssa-sccvn.c (eliminate_dom_walker::eliminate_stmt): Fold stmt following SSA edges. * gcc.dg/tree-ssa/ssa-fre-94.c: New testcase. * gcc.dg/graphite/fuse-1.c: Adjust. * gcc.dg/pr43864-4.c: Likewise. --- gcc/testsuite/gcc.dg/graphite/fuse-1.c | 4 ++-- gcc/testsuite/gcc.dg/pr43864-4.c | 6 +++--- gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-94.c | 16 ++++++++++++++++ 3 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-94.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/graphite/fuse-1.c b/gcc/testsuite/gcc.dg/graphite/fuse-1.c index 204d3b2..527b6e5 100644 --- a/gcc/testsuite/gcc.dg/graphite/fuse-1.c +++ b/gcc/testsuite/gcc.dg/graphite/fuse-1.c @@ -1,6 +1,6 @@ /* Check that the two loops are fused and that we manage to fold the two xor operations. */ -/* { dg-options "-O2 -floop-nest-optimize -fdump-tree-forwprop-all -fdump-tree-graphite-all" } */ +/* { dg-options "-O2 -floop-nest-optimize -fdump-tree-forwprop4 -fdump-tree-graphite-all" } */ /* Make sure we fuse the loops like this: AST generated by isl: @@ -12,7 +12,7 @@ for (int c0 = 0; c0 <= 99; c0 += 1) { /* { dg-final { scan-tree-dump-times "AST generated by isl:.*for \\(int c0 = 0; c0 <= 99; c0 \\+= 1\\) \\{.*S_.*\\(c0\\);.*S_.*\\(c0\\);.*S_.*\\(c0\\);.*\\}" 1 "graphite" } } */ /* Check that after fusing the loops, the scalar computation is also fused. */ -/* { dg-final { scan-tree-dump-times "gimple_simplified to\[^\\n\]*\\^ 12" 1 "forwprop4" } } */ +/* { dg-final { scan-tree-dump-times " \\^ 12;" 2 "forwprop4" } } */ #define MAX 100 int A[MAX]; diff --git a/gcc/testsuite/gcc.dg/pr43864-4.c b/gcc/testsuite/gcc.dg/pr43864-4.c index 3c6cc50..8a25b0f 100644 --- a/gcc/testsuite/gcc.dg/pr43864-4.c +++ b/gcc/testsuite/gcc.dg/pr43864-4.c @@ -22,7 +22,7 @@ int f(int c, int b, int d) return r - r2; } -/* { dg-final { scan-tree-dump-times "if " 0 "pre"} } */ -/* { dg-final { scan-tree-dump-times "(?n)_.*\\+.*_" 1 "pre"} } */ -/* { dg-final { scan-tree-dump-times "(?n)_.*-.*_" 2 "pre"} } */ +/* During PRE elimination we should simplify this to return b * 2. */ +/* { dg-final { scan-tree-dump-times "if " 0 "pre" } } */ +/* { dg-final { scan-tree-dump "_\[0-9\]+ = b_\[0-9\]+\\(D\\) \\* 2;\[\\r\\n\]\[^\\r\\n\]*return _\[0-9\]+;" "pre" } } */ /* { dg-final { scan-tree-dump-not "Invalid sum" "pre"} } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-94.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-94.c new file mode 100644 index 0000000..92eebf6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-94.c @@ -0,0 +1,16 @@ +/* PR tree-optimization/79333 */ +/* { dg-do compile } */ +/* { dg-options "-O -ffinite-math-only -fdump-tree-fre1" } */ + +extern __inline __attribute__ ((__always_inline__,__gnu_inline__)) +double __attribute__ ((__nothrow__ , __leaf__)) +fabs (double __x) { return __builtin_fabs (__x); } + +double f(float f) +{ + double t1 = fabs(f); + double t2 = f / t1; + return t2; +} + +/* { dg-final { scan-tree-dump "copysign" "fre1" } } */ -- cgit v1.1 From af4e4d35f0b84d7c2f57a7b682a09116e9911142 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Wed, 5 May 2021 08:50:15 +0200 Subject: g++.dg/gomp/clause-3.C: Fix - missing in r12-438-g1580fc7 [PR100422] gcc/testsuite/ PR testsuite/100422 * g++.dg/gomp/clause-3.C: Use 'reduction(&:..)' instead of '...(&&:..)'. --- gcc/testsuite/g++.dg/gomp/clause-3.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/gomp/clause-3.C b/gcc/testsuite/g++.dg/gomp/clause-3.C index e0edc87..aad97d6 100644 --- a/gcc/testsuite/g++.dg/gomp/clause-3.C +++ b/gcc/testsuite/g++.dg/gomp/clause-3.C @@ -56,7 +56,7 @@ foo (int x) ; #pragma omp p reduction (|:d) // { dg-error "user defined reduction not found for" } ; -#pragma omp p reduction (&&:d) // { dg-error "user defined reduction not found for" } +#pragma omp p reduction (&:d) // { dg-error "user defined reduction not found for" } ; #pragma omp p copyin (d) // { dg-error "must be 'threadprivate'" } ; -- cgit v1.1 From 3db6989aba707708f4fca3ff1bc92c4078b5c4cc Mon Sep 17 00:00:00 2001 From: Robin Dapp Date: Tue, 27 Apr 2021 17:11:54 +0200 Subject: testsuite: Add s390 to gcc.dg/vect/slp-21.c On s390 we vectorize 4 statements using SLP. Add s390*-*-* to the appropriate dg-finals. gcc/testsuite/ChangeLog: * gcc.dg/vect/slp-21.c: Add s390. --- gcc/testsuite/gcc.dg/vect/slp-21.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/vect/slp-21.c b/gcc/testsuite/gcc.dg/vect/slp-21.c index 8539397..4b83adb 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-21.c +++ b/gcc/testsuite/gcc.dg/vect/slp-21.c @@ -210,7 +210,7 @@ int main (void) Not all vect_perm targets support that, and it's a bit too specific to have its own effective-target selector, so we just test targets directly. */ -/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 4 "vect" { target powerpc64*-*-* } } } */ -/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" { target { vect_strided4 && { ! powerpc64*-*-* } } } } } */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 4 "vect" { target { powerpc64*-*-* s390*-*-* } } } } */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" { target { vect_strided4 && { ! { powerpc64*-*-* s390*-*-* } } } } } } */ /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" { target { ! { vect_strided4 } } } } } */ -- cgit v1.1 From 5747baa984d96241e4e2608da3c3e0160e32410b Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Wed, 5 May 2021 12:07:24 +0200 Subject: Generate debug info for local dynamic record types In Ada you can embed VLAs in local record types and thus end up with dynamic offsets in record types, which are not well described in DWARF because 1) the temporaries generated for them by the gimplifier are naturally marked DECL_IGNORED_P and 2) when the types are referenced in nested subprograms, the DWARF back-end does not correctly handle the rewritten references. gcc/ * dwarf2out.c (loc_list_from_tree_1) : During early DWARF, do not expand the VALUE_EXPR of variables put in the non-local frame. * gimplify.c (gimplify_type_sizes) : If the type is not to be ignored for debug info, ensure its variable offsets are not. gcc/testsuite/ * gnat.dg/debug8.adb: Minor tweak. * gnat.dg/debug11.adb: Likewise. * gnat.dg/debug16.adb: Likewise. * gnat.dg/debug17.adb: New test. * gnat.dg/specs/debug1.ads: Minor tweak. --- gcc/testsuite/gnat.dg/debug11.adb | 20 ++++++++++---------- gcc/testsuite/gnat.dg/debug16.adb | 8 ++++---- gcc/testsuite/gnat.dg/debug17.adb | 27 +++++++++++++++++++++++++++ gcc/testsuite/gnat.dg/debug8.adb | 8 +++++--- gcc/testsuite/gnat.dg/specs/debug1.ads | 3 ++- 5 files changed, 48 insertions(+), 18 deletions(-) create mode 100644 gcc/testsuite/gnat.dg/debug17.adb (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gnat.dg/debug11.adb b/gcc/testsuite/gnat.dg/debug11.adb index 26db5db..0fd9e36 100644 --- a/gcc/testsuite/gnat.dg/debug11.adb +++ b/gcc/testsuite/gnat.dg/debug11.adb @@ -1,14 +1,11 @@ --- { dg-do compile } --- { dg-skip-if "No Dwarf" { { hppa*-*-hpux* } && { ! lp64 } } } --- { dg-options "-cargs -O0 -g -dA -fgnat-encodings=minimal -margs" } +-- { dg-do compile } +-- { dg-skip-if "No Dwarf" { { hppa*-*-hpux* } && { ! lp64 } } } +-- { dg-options "-cargs -O0 -g -dA -fgnat-encodings=minimal -margs" } -- --- This testcase checks that in the DWARF description of the variant type --- below, the C discriminant is properly described as unsigned, hence the 0x5a --- ('Z') and 0x80 (128) values in the DW_AT_discr_list attribute. If it was --- described as signed, we would have instead 90 and -128. --- --- { dg-final { scan-assembler-times "0x5a.*DW_AT_discr_list" 1 } } --- { dg-final { scan-assembler-times "0x80.*DW_AT_discr_list" 1 } } +-- This testcase checks that in the DWARF description of the variant type +-- below, the C discriminant is properly described as unsigned, hence the 0x5a +-- ('Z') and 0x80 (128) values in the DW_AT_discr_list attribute. If it was +-- described as signed, we would have instead 90 and -128. with Ada.Text_IO; @@ -25,3 +22,6 @@ begin R.I := 0; Ada.Text_IO.Put_Line ("" & R.C); end Debug11; + +-- { dg-final { scan-assembler-times "0x5a.*DW_AT_discr_list" 1 } } +-- { dg-final { scan-assembler-times "0x80.*DW_AT_discr_list" 1 } } diff --git a/gcc/testsuite/gnat.dg/debug16.adb b/gcc/testsuite/gnat.dg/debug16.adb index 8752002..5695edb 100644 --- a/gcc/testsuite/gnat.dg/debug16.adb +++ b/gcc/testsuite/gnat.dg/debug16.adb @@ -1,6 +1,6 @@ --- { dg-do compile } --- { dg-skip-if "No Dwarf" { { hppa*-*-hpux* } && { ! lp64 } } } --- { dg-options "-cargs -O0 -g -dA -fgnat-encodings=minimal -margs" } +-- { dg-do compile } +-- { dg-skip-if "No Dwarf" { { hppa*-*-hpux* } && { ! lp64 } } } +-- { dg-options "-cargs -O0 -g -dA -fgnat-encodings=minimal -margs" } procedure Debug16 is @@ -24,4 +24,4 @@ begin end if; end; --- { dg-final { scan-assembler-times "DW_AT_discr" 4 } } +-- { dg-final { scan-assembler-times "DW_AT_discr" 4 } } diff --git a/gcc/testsuite/gnat.dg/debug17.adb b/gcc/testsuite/gnat.dg/debug17.adb new file mode 100644 index 0000000..4f33ecd --- /dev/null +++ b/gcc/testsuite/gnat.dg/debug17.adb @@ -0,0 +1,27 @@ +-- { dg-do compile } +-- { dg-skip-if "No Dwarf" { { hppa*-*-hpux* } && { ! lp64 } } } +-- { dg-options "-cargs -O0 -g -dA -fgnat-encodings=minimal -margs" } + +pragma No_Component_Reordering; + +procedure Debug17 (Number_Of_Bits : Natural) is + + type Bitinfos_T is array (Natural range 1 .. Number_Of_Bits) of Float; + + type Inner_Record_T is + record + Bitinfos : Bitinfos_T := (others => 1.5); + Check1 : Integer := 1983; + Check2 : Integer := 1995; + Flag : Boolean := False; + Check3 : Integer := 2005; + + end record; + + Rfield : Inner_Record_T; + +begin + null; +end; + +-- { dg-final { scan-assembler-not "DW_AT_data_member_location (0)" } } diff --git a/gcc/testsuite/gnat.dg/debug8.adb b/gcc/testsuite/gnat.dg/debug8.adb index 882be55..6302be3 100644 --- a/gcc/testsuite/gnat.dg/debug8.adb +++ b/gcc/testsuite/gnat.dg/debug8.adb @@ -1,7 +1,6 @@ -- { dg-do compile } --- { dg-options "-cargs -g -fgnat-encodings=minimal -dA -margs" } --- { dg-final { scan-assembler-not "DW_OP_const4u" } } --- { dg-final { scan-assembler-not "DW_OP_const8u" } } +-- { dg-skip-if "No Dwarf" { { hppa*-*-hpux* } && { ! lp64 } } } +-- { dg-options "-cargs -O0 -g -dA -fgnat-encodings=minimal -margs" } -- The DW_AT_byte_size attribute DWARF expression for the -- DW_TAG_structure_type DIE that describes Rec_Type contains the -4u literal. @@ -27,3 +26,6 @@ procedure Debug8 is begin null; end Debug8; + +-- { dg-final { scan-assembler-not "DW_OP_const4u" } } +-- { dg-final { scan-assembler-not "DW_OP_const8u" } } diff --git a/gcc/testsuite/gnat.dg/specs/debug1.ads b/gcc/testsuite/gnat.dg/specs/debug1.ads index f94b42a..9b67427 100644 --- a/gcc/testsuite/gnat.dg/specs/debug1.ads +++ b/gcc/testsuite/gnat.dg/specs/debug1.ads @@ -1,5 +1,6 @@ -- { dg-do compile } --- { dg-options "-cargs -g -dA -fgnat-encodings=minimal -margs" } +-- { dg-skip-if "No Dwarf" { { hppa*-*-hpux* } && { ! lp64 } } } +-- { dg-options "-cargs -O0 -g -dA -fgnat-encodings=minimal -margs" } package Debug1 is -- cgit v1.1 From 0bd8a9ef70e5461b68f1ec34a4fbee3eb7021510 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Wed, 5 May 2021 12:48:44 +0200 Subject: Minor formatting tweak gcc/testsuite/ * gnat.dg/debug17.adb: Minor tweak. --- gcc/testsuite/gnat.dg/debug17.adb | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gnat.dg/debug17.adb b/gcc/testsuite/gnat.dg/debug17.adb index 4f33ecd..d3ad812 100644 --- a/gcc/testsuite/gnat.dg/debug17.adb +++ b/gcc/testsuite/gnat.dg/debug17.adb @@ -8,15 +8,13 @@ procedure Debug17 (Number_Of_Bits : Natural) is type Bitinfos_T is array (Natural range 1 .. Number_Of_Bits) of Float; - type Inner_Record_T is - record - Bitinfos : Bitinfos_T := (others => 1.5); - Check1 : Integer := 1983; - Check2 : Integer := 1995; - Flag : Boolean := False; - Check3 : Integer := 2005; - - end record; + type Inner_Record_T is record + Bitinfos : Bitinfos_T := (others => 1.5); + Check1 : Integer := 1983; + Check2 : Integer := 1995; + Flag : Boolean := False; + Check3 : Integer := 2005; + end record; Rfield : Inner_Record_T; -- cgit v1.1 From f3661f2d63fbc5fd30c24d22137691e16b0a0a17 Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Wed, 5 May 2021 15:07:25 +0200 Subject: i386: Implement integer vector compares for 64bit vectors [PR98218] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implement integer vector compares for 64bit vectors for TARGET_MMX_WITH_SSE. 2021-05-05 UroÅ¡ Bizjak gcc/ PR target/98218 * config/i386/i386-expand.c (ix86_expand_int_sse_cmp): Handle V8QI, V4HI and V2SI modes. * config/i386/i386.c (ix86_build_const_vector): Handle V2SImode. (ix86_build_signbit_mask): Ditto. * config/i386/mmx.md (MMXMODE14): New mode iterator. (3): New expander. (*mmx_3): New insn pattern. (3): New expander. (*mmx_3): New insn pattern. (vec_cmp): New expander. (vec_cmpu): Ditto. (vcond): Ditto. (vcondu): Ditto. (vcond_mask_): Ditto. gcc/testsuite/ PR target/98218 * gcc.target/i386/pr98218-1.c: New test. * gcc.target/i386/pr98218-1a.c: Ditto. * gcc.target/i386/pr98218-2.c: Ditto. * gcc.target/i386/pr98218-2a.c: Ditto. * gcc.target/i386/pr98218-3.c: Ditto. * gcc.target/i386/pr98218-3a.c: Ditto. * gcc.dg/vect/vect-bool-cmp.c (dg-final): Scan vect tree dump for "LOOP VECTORIZED", not VECTORIZED. --- gcc/testsuite/gcc.dg/vect/vect-bool-cmp.c | 2 +- gcc/testsuite/gcc.target/i386/pr98218-1.c | 21 +++++++++++++++++++++ gcc/testsuite/gcc.target/i386/pr98218-1a.c | 19 +++++++++++++++++++ gcc/testsuite/gcc.target/i386/pr98218-2.c | 21 +++++++++++++++++++++ gcc/testsuite/gcc.target/i386/pr98218-2a.c | 19 +++++++++++++++++++ gcc/testsuite/gcc.target/i386/pr98218-3.c | 21 +++++++++++++++++++++ gcc/testsuite/gcc.target/i386/pr98218-3a.c | 19 +++++++++++++++++++ 7 files changed, 121 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr98218-1.c create mode 100644 gcc/testsuite/gcc.target/i386/pr98218-1a.c create mode 100644 gcc/testsuite/gcc.target/i386/pr98218-2.c create mode 100644 gcc/testsuite/gcc.target/i386/pr98218-2a.c create mode 100644 gcc/testsuite/gcc.target/i386/pr98218-3.c create mode 100644 gcc/testsuite/gcc.target/i386/pr98218-3a.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/vect/vect-bool-cmp.c b/gcc/testsuite/gcc.dg/vect/vect-bool-cmp.c index 35d2a3c..c97da52 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-bool-cmp.c +++ b/gcc/testsuite/gcc.dg/vect/vect-bool-cmp.c @@ -253,4 +253,4 @@ main (int argc, char **argv) check (res, ne); } -/* { dg-final { scan-tree-dump-times "VECTORIZED" 18 "vect" { target sse4_runtime } } } */ +/* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 18 "vect" { target sse4_runtime } } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr98218-1.c b/gcc/testsuite/gcc.target/i386/pr98218-1.c new file mode 100644 index 0000000..48407da --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr98218-1.c @@ -0,0 +1,21 @@ +/* PR target/98522 */ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-O2 -msse2" } */ + +typedef char vec __attribute__((vector_size(8))); + +vec lt (vec a, vec b) { return a < b; } +vec le (vec a, vec b) { return a <= b; } +vec eq (vec a, vec b) { return a == b; } +vec ne (vec a, vec b) { return a != b; } +vec ge (vec a, vec b) { return a >= b; } +vec gt (vec a, vec b) { return a > b; } + +typedef unsigned char uvec __attribute__((vector_size(8))); + +vec ltu (uvec a, uvec b) { return a < b; } +vec leu (uvec a, uvec b) { return a <= b; } +vec geu (uvec a, uvec b) { return a >= b; } +vec gtu (uvec a, uvec b) { return a > b; } + +/* { dg-final { scan-assembler-not "cmpb" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr98218-1a.c b/gcc/testsuite/gcc.target/i386/pr98218-1a.c new file mode 100644 index 0000000..3470c87 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr98218-1a.c @@ -0,0 +1,19 @@ +/* PR target/98522 */ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-O2 -ftree-vectorize -msse2" } */ + +typedef char T; + +#define M 8 + +extern T a[M], b[M], s1[M], s2[M], r[M]; + +void foo (void) +{ + int j; + + for (j = 0; j < M; j++) + r[j] = (a[j] < b[j]) ? s1[j] : s2[j]; +} + +/* { dg-final { scan-assembler "pcmpgtb" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr98218-2.c b/gcc/testsuite/gcc.target/i386/pr98218-2.c new file mode 100644 index 0000000..0b71612 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr98218-2.c @@ -0,0 +1,21 @@ +/* PR target/98522 */ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-O2 -msse2" } */ + +typedef short vec __attribute__((vector_size(8))); + +vec lt (vec a, vec b) { return a < b; } +vec le (vec a, vec b) { return a <= b; } +vec eq (vec a, vec b) { return a == b; } +vec ne (vec a, vec b) { return a != b; } +vec ge (vec a, vec b) { return a >= b; } +vec gt (vec a, vec b) { return a > b; } + +typedef unsigned short uvec __attribute__((vector_size(8))); + +vec ltu (uvec a, uvec b) { return a < b; } +vec leu (uvec a, uvec b) { return a <= b; } +vec geu (uvec a, uvec b) { return a >= b; } +vec gtu (uvec a, uvec b) { return a > b; } + +/* { dg-final { scan-assembler-not "cmpw" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr98218-2a.c b/gcc/testsuite/gcc.target/i386/pr98218-2a.c new file mode 100644 index 0000000..6afd0a4 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr98218-2a.c @@ -0,0 +1,19 @@ +/* PR target/98522 */ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-O2 -ftree-vectorize -msse2" } */ + +typedef short T; + +#define M 4 + +extern T a[M], b[M], s1[M], s2[M], r[M]; + +void foo (void) +{ + int j; + + for (j = 0; j < M; j++) + r[j] = (a[j] < b[j]) ? s1[j] : s2[j]; +} + +/* { dg-final { scan-assembler "pcmpgtw" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr98218-3.c b/gcc/testsuite/gcc.target/i386/pr98218-3.c new file mode 100644 index 0000000..83a8c29 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr98218-3.c @@ -0,0 +1,21 @@ +/* PR target/98522 */ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-O2 -msse2" } */ + +typedef int vec __attribute__((vector_size(8))); + +vec lt (vec a, vec b) { return a < b; } +vec le (vec a, vec b) { return a <= b; } +vec eq (vec a, vec b) { return a == b; } +vec ne (vec a, vec b) { return a != b; } +vec ge (vec a, vec b) { return a >= b; } +vec gt (vec a, vec b) { return a > b; } + +typedef unsigned int uvec __attribute__((vector_size(8))); + +vec ltu (uvec a, uvec b) { return a < b; } +vec leu (uvec a, uvec b) { return a <= b; } +vec geu (uvec a, uvec b) { return a >= b; } +vec gtu (uvec a, uvec b) { return a > b; } + +/* { dg-final { scan-assembler-not "cmpl" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr98218-3a.c b/gcc/testsuite/gcc.target/i386/pr98218-3a.c new file mode 100644 index 0000000..272d54e --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr98218-3a.c @@ -0,0 +1,19 @@ +/* PR target/98522 */ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-O2 -ftree-vectorize -msse2" } */ + +typedef int T; + +#define M 2 + +extern T a[M], b[M], s1[M], s2[M], r[M]; + +void foo (void) +{ + int j; + + for (j = 0; j < M; j++) + r[j] = (a[j] < b[j]) ? s1[j] : s2[j]; +} + +/* { dg-final { scan-assembler "pcmpgtd" { xfail *-*-* } } } */ -- cgit v1.1 From a8b79cc939d6786293f654c42a2d1b0ab040de0e Mon Sep 17 00:00:00 2001 From: Harald Anlauf Date: Wed, 5 May 2021 15:25:50 +0200 Subject: PR fortran/100274 - ICE in gfc_conv_procedure_call, at fortran/trans-expr.c:6131 When the check for the length of formal and actual character arguments found a mismatch and emitted a warning, it would skip further checks like that could lead to errors. Fix that by continuing the checking. Also catch a NULL pointer dereference. gcc/fortran/ChangeLog: PR fortran/100274 * interface.c (gfc_compare_actual_formal): Continue checks after emitting warning for argument length mismatch. * trans-expr.c (gfc_conv_procedure_call): Check for NULL pointer dereference. gcc/testsuite/ChangeLog: PR fortran/100274 * gfortran.dg/argument_checking_25.f90: New test. --- gcc/testsuite/gfortran.dg/argument_checking_25.f90 | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/argument_checking_25.f90 (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gfortran.dg/argument_checking_25.f90 b/gcc/testsuite/gfortran.dg/argument_checking_25.f90 new file mode 100644 index 0000000..e699160 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/argument_checking_25.f90 @@ -0,0 +1,12 @@ +! { dg-do compile } +! PR fortran/100274 - ICE in gfc_conv_procedure_call, at fortran/trans-expr.c:6131 + +program p + call s('y') ! { dg-warning "Character length of actual argument" } +contains + subroutine s(x) + character(8), intent(out) :: x + end +end + +! { dg-error "in variable definition context" " " { target *-*-* } 5 } -- cgit v1.1 From 2254b3233b5bfa690e8c6e6fa923e4626a6a93d3 Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Wed, 5 May 2021 11:07:39 -0600 Subject: PR middle-end/100325 - missing warning with -O0 on sprintf overflow with pointer plus offset gcc/ChangeLog: * passes.def (pass_warn_printf): Run after SSA. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/builtin-sprintf-warn-26.c: New test. --- gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-26.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-26.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-26.c index 16a551d..677b634 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-26.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-26.c @@ -22,17 +22,17 @@ void nowarn_4m3 () void warn_2m1 () { char *p = a + 2; - sprintf (p - 1, "%i", 123); // { dg-warning "-Wformat-overflow" "pr100325" { xfail *-*-* } } + sprintf (p - 1, "%i", 123); // { dg-warning "-Wformat-overflow" "pr100325" } } void warn_3m1 () { char *p = a + 3; - sprintf (p - 1, "%i", 12); // { dg-warning "-Wformat-overflow" "pr100325" { xfail *-*-* } } + sprintf (p - 1, "%i", 12); // { dg-warning "-Wformat-overflow" "pr100325" } } void warn_4m1 () { char *p = a + 4; - sprintf (p - 1, "%i", 1); // { dg-warning "-Wformat-overflow" "pr100325" { xfail *-*-* } } + sprintf (p - 1, "%i", 1); // { dg-warning "-Wformat-overflow" "pr100325" } } -- cgit v1.1 From a0b4e09ab0102d9c0a5e6d603a080cb78600c40d Mon Sep 17 00:00:00 2001 From: Ivan Sorokin Date: Mon, 3 May 2021 11:39:48 +0300 Subject: x86: Build only one __cpu_model/__cpu_features2 variables GCC -O2 generated quite bad code for this function: bool f (void) { return __builtin_cpu_supports("popcnt") && __builtin_cpu_supports("ssse3"); } f: movl __cpu_model+12(%rip), %edx movl %edx, %eax shrl $6, %eax andl $1, %eax andl $4, %edx movl $0, %edx cmove %edx, %eax ret The problem was caused by the fact that internally every invocation of __builtin_cpu_supports built a new variable __cpu_model and a new type __processor_model. Because of this, GIMPLE level optimizers weren't able to CSE the loads of __cpu_model and optimize bit-operations properly. Improve GCC -O2 code generation by caching __cpu_model and__cpu_features2 variables as well as their types: f: movl __cpu_model+12(%rip), %eax andl $68, %eax cmpl $68, %eax sete %al ret 2021-05-05 Ivan Sorokin H.J. Lu gcc/ PR target/91400 * config/i386/i386-builtins.c (ix86_cpu_model_type_node): New. (ix86_cpu_model_var): Likewise. (ix86_cpu_features2_type_node): Likewise. (ix86_cpu_features2_var): Likewise. (fold_builtin_cpu): Cache __cpu_model and __cpu_features2 with their types. gcc/testsuite/ PR target/91400 * gcc.target/i386/pr91400-1.c: New test. * gcc.target/i386/pr91400-2.c: Likewise. --- gcc/testsuite/gcc.target/i386/pr91400-1.c | 14 ++++++++++++++ gcc/testsuite/gcc.target/i386/pr91400-2.c | 14 ++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr91400-1.c create mode 100644 gcc/testsuite/gcc.target/i386/pr91400-2.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/i386/pr91400-1.c b/gcc/testsuite/gcc.target/i386/pr91400-1.c new file mode 100644 index 0000000..6124058 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr91400-1.c @@ -0,0 +1,14 @@ +/* PR target/91400 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +/* { dg-final { scan-assembler-times "andl" 1 } } */ +/* { dg-final { scan-assembler-times "cmpl" 1 } } */ +/* { dg-final { scan-assembler-times "sete" 1 } } */ +/* { dg-final { scan-assembler-not "cmove" } } */ + +_Bool +f (void) +{ + return __builtin_cpu_supports("popcnt") + && __builtin_cpu_supports("ssse3"); +} diff --git a/gcc/testsuite/gcc.target/i386/pr91400-2.c b/gcc/testsuite/gcc.target/i386/pr91400-2.c new file mode 100644 index 0000000..1af5a2f --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr91400-2.c @@ -0,0 +1,14 @@ +/* PR target/91400 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +/* { dg-final { scan-assembler-times "andl" 1 } } */ +/* { dg-final { scan-assembler-times "cmpl" 1 } } */ +/* { dg-final { scan-assembler-times "sete" 1 } } */ +/* { dg-final { scan-assembler-not "cmove" } } */ + +_Bool +f (void) +{ + return __builtin_cpu_supports("avx512vnni") + && __builtin_cpu_supports("3dnow"); +} -- cgit v1.1 From e8d1ca7d2c344a411779892616c423e157f4aea8 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Wed, 5 May 2021 22:48:51 +0200 Subject: Fix PR target/100402 This is a regression for 64-bit Windows present from mainline down to the 9 branch and introduced by the fix for PR target/99234. Again SEH, but with a twist related to the way MinGW implements setjmp/longjmp, which turns out to be piggybacked on SEH with recent versions of MinGW, i.e. the longjmp performs a bona-fide unwinding of the stack, because it calls RtlUnwindEx with the second argument initially passed to setjmp, which is the result of __builtin_frame_address (0) in the MinGW header file: define setjmp(BUF) _setjmp((BUF), __builtin_frame_address (0)) This means that we directly expose the frame pointer to the SEH machinery here (unlike with regular exception handling where we use an intermediate CFA) and thus that we cannot do whatever we want with it. The old code would leave it unaligned, i.e. not multiple of 16, whereas the new code aligns it, but this breaks for some reason; at least it appears that a .seh_setframe directive with 0 as second argument always works, so the fix aligns it this way. gcc/ PR target/100402 * config/i386/i386.c (ix86_compute_frame_layout): For a SEH target, always return the establisher frame for __builtin_frame_address (0). gcc/testsuite/ * gcc.c-torture/execute/20210505-1.c: New test. --- gcc/testsuite/gcc.c-torture/execute/20210505-1.c | 31 ++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 gcc/testsuite/gcc.c-torture/execute/20210505-1.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.c-torture/execute/20210505-1.c b/gcc/testsuite/gcc.c-torture/execute/20210505-1.c new file mode 100644 index 0000000..10a2de0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20210505-1.c @@ -0,0 +1,31 @@ +/* PR target/100402 */ +/* Testcase by Hannes Domani */ + +/* { dg-require-effective-target indirect_jumps } */ + +#include +#include + +static jmp_buf buf; +static _Bool stop = false; + +void call_func (void(*func)(void)) +{ + func (); +} + +void func (void) +{ + stop = true; + longjmp (buf, 1); +} + +int main (void) +{ + setjmp (buf); + + while (!stop) + call_func (func); + + return 0; +} -- cgit v1.1 From 449480114aa5ee7e400b75c654f548e38fd03a64 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 6 May 2021 00:16:37 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 64 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9efe850..70c5d50 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,67 @@ +2021-05-05 Eric Botcazou + + * gcc.c-torture/execute/20210505-1.c: New test. + +2021-05-05 Ivan Sorokin + + PR target/91400 + * gcc.target/i386/pr91400-1.c: New test. + * gcc.target/i386/pr91400-2.c: Likewise. + +2021-05-05 Martin Sebor + + * gcc.dg/tree-ssa/builtin-sprintf-warn-26.c: New test. + +2021-05-05 Harald Anlauf + + PR fortran/100274 + * gfortran.dg/argument_checking_25.f90: New test. + +2021-05-05 UroÅ¡ Bizjak + + PR target/98218 + * gcc.target/i386/pr98218-1.c: New test. + * gcc.target/i386/pr98218-1a.c: Ditto. + * gcc.target/i386/pr98218-2.c: Ditto. + * gcc.target/i386/pr98218-2a.c: Ditto. + * gcc.target/i386/pr98218-3.c: Ditto. + * gcc.target/i386/pr98218-3a.c: Ditto. + * gcc.dg/vect/vect-bool-cmp.c (dg-final): + Scan vect tree dump for "LOOP VECTORIZED", not VECTORIZED. + +2021-05-05 Eric Botcazou + + * gnat.dg/debug17.adb: Minor tweak. + +2021-05-05 Eric Botcazou + + * gnat.dg/debug8.adb: Minor tweak. + * gnat.dg/debug11.adb: Likewise. + * gnat.dg/debug16.adb: Likewise. + * gnat.dg/debug17.adb: New test. + * gnat.dg/specs/debug1.ads: Minor tweak. + +2021-05-05 Robin Dapp + + * gcc.dg/vect/slp-21.c: Add s390. + +2021-05-05 Tobias Burnus + + PR testsuite/100422 + * g++.dg/gomp/clause-3.C: Use 'reduction(&:..)' instead of '...(&&:..)'. + +2021-05-05 Richard Biener + + PR tree-optimization/79333 + * gcc.dg/tree-ssa/ssa-fre-94.c: New testcase. + * gcc.dg/graphite/fuse-1.c: Adjust. + * gcc.dg/pr43864-4.c: Likewise. + +2021-05-05 Richard Biener + + PR middle-end/100394 + * g++.dg/torture/pr100382.C: New testcase. + 2021-05-04 Martin Sebor PR middle-end/100307 -- cgit v1.1 From b5254d6b75fe6be669396cd1261f1cba829cc451 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 5 May 2021 10:15:27 +0200 Subject: ipa/100373 - fix emutls lowering compare-debug issue emutls figured that tls uses in debug-insns need lowering but that obviously has effects on code-generation as can be seen in the following IL diff with the new testcase: [local count: 1073741824]: - a = 0; + # DEBUG BEGIN_STMT _4 = __builtin___emutls_get_address (&__emutls_v.b); + # DEBUG D#1 => *_4 + # DEBUG d => (long int) D#1 + # DEBUG BEGIN_STMT + a = 0; + # DEBUG BEGIN_STMT *_4 = 0; return; where it figured the debug use of b in the original [local count: 1073741824]: # DEBUG BEGIN_STMT # DEBUG D#1 => b # DEBUG d => (long int) D#1 # DEBUG BEGIN_STMT a = 0; needs lowering (it maybe does when we want to produce perfect debug but that's just bad luck). The following patch fixes this by avoiding to create a new emutls address when visiting debug stmts and instead resets them. Another option might be to simply not lower debug stmt uses but I have no way to verify actual debug info for this. 2021-05-05 Richard Biener PR ipa/100373 * tree-emutls.c (gen_emutls_addr): Pass in whether we're dealing with a debug use and only query existing addresses if so. (lower_emutls_1): Avoid splitting out addresses for debug stmts, reset the debug stmt when we fail to find existing lowered addresses. (lower_emutls_phi_arg): Set wi.stmt. * gcc.dg/pr100373.c: New testcase. --- gcc/testsuite/gcc.dg/pr100373.c | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr100373.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/pr100373.c b/gcc/testsuite/gcc.dg/pr100373.c new file mode 100644 index 0000000..d4cd52a --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr100373.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fcompare-debug" } */ + +int a; +_Thread_local int b; +void c() +{ + long d = b; + a = 0; + b = 0; +} -- cgit v1.1 From ad96c867e173c1ebcfc201b201adac5095683a08 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 6 May 2021 10:15:40 +0200 Subject: phiopt: Optimize (x <=> y) cmp z [PR94589] genericize_spaceship genericizes i <=> j to approximately ({ int c; if (i == j) c = 0; else if (i < j) c = -1; else c = 1; c; }) for strong ordering and ({ int c; if (i == j) c = 0; else if (i < j) c = -1; else if (i > j) c = 1; else c = 2; c; }) for partial ordering. The C++ standard supports then == or != comparisons of that against strong/partial ordering enums, or />= comparisons of <=> result against literal 0. In some cases we already optimize that but in many cases we keep performing all the 2 or 3 comparisons, compute the spaceship value and then compare that. The following patch recognizes those patterns if the <=> operands are integral types or floating point (the latter only for -ffast-math) and optimizes it to the single comparison that is needed (plus adds debug stmts if needed for the spaceship result). There is one thing I'd like to address in a follow-up: the pr94589-2.C testcase should be matching just 12 times each, but runs into operator>=(partial_ordering, unspecified) being defined as (_M_value&1)==_M_value rather than _M_value>=0. When not honoring NaNs, the 2 case should be unreachable and so (_M_value&1)==_M_value is then equivalent to _M_value>=0, but is not a single use but two uses. I'll need to pattern match that case specially. 2021-05-06 Jakub Jelinek PR tree-optimization/94589 * tree-ssa-phiopt.c (tree_ssa_phiopt_worker): Call spaceship_replacement. (cond_only_block_p, spaceship_replacement): New functions. * gcc.dg/pr94589-1.c: New test. * gcc.dg/pr94589-2.c: New test. * gcc.dg/pr94589-3.c: New test. * gcc.dg/pr94589-4.c: New test. * g++.dg/opt/pr94589-1.C: New test. * g++.dg/opt/pr94589-2.C: New test. * g++.dg/opt/pr94589-3.C: New test. * g++.dg/opt/pr94589-4.C: New test. --- gcc/testsuite/g++.dg/opt/pr94589-1.C | 33 ++++++++++++ gcc/testsuite/g++.dg/opt/pr94589-2.C | 33 ++++++++++++ gcc/testsuite/g++.dg/opt/pr94589-3.C | 84 +++++++++++++++++++++++++++++++ gcc/testsuite/g++.dg/opt/pr94589-4.C | 84 +++++++++++++++++++++++++++++++ gcc/testsuite/gcc.dg/pr94589-1.c | 35 +++++++++++++ gcc/testsuite/gcc.dg/pr94589-2.c | 35 +++++++++++++ gcc/testsuite/gcc.dg/pr94589-3.c | 97 ++++++++++++++++++++++++++++++++++++ gcc/testsuite/gcc.dg/pr94589-4.c | 97 ++++++++++++++++++++++++++++++++++++ 8 files changed, 498 insertions(+) create mode 100644 gcc/testsuite/g++.dg/opt/pr94589-1.C create mode 100644 gcc/testsuite/g++.dg/opt/pr94589-2.C create mode 100644 gcc/testsuite/g++.dg/opt/pr94589-3.C create mode 100644 gcc/testsuite/g++.dg/opt/pr94589-4.C create mode 100644 gcc/testsuite/gcc.dg/pr94589-1.c create mode 100644 gcc/testsuite/gcc.dg/pr94589-2.c create mode 100644 gcc/testsuite/gcc.dg/pr94589-3.c create mode 100644 gcc/testsuite/gcc.dg/pr94589-4.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/opt/pr94589-1.C b/gcc/testsuite/g++.dg/opt/pr94589-1.C new file mode 100644 index 0000000..d1cc505 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr94589-1.C @@ -0,0 +1,33 @@ +// PR tree-optimization/94589 +// { dg-do compile { target c++20 } } +// { dg-options "-O2 -g0 -fdump-tree-optimized" } +// { dg-final { scan-tree-dump-times "\[ij]_\[0-9]+\\(D\\) (?:<|<=|==|!=|>|>=) \[ij]_\[0-9]+\\(D\\)" 12 "optimized" } } +// { dg-final { scan-tree-dump-times "i_\[0-9]+\\(D\\) (?:<|<=|==|!=|>|>=) \[45]" 12 "optimized" } } + +#include + +#define A __attribute__((noipa)) +A bool f1 (int i, int j) { auto c = i <=> j; return c == 0; } +A bool f2 (int i, int j) { auto c = i <=> j; return c != 0; } +A bool f3 (int i, int j) { auto c = i <=> j; return c > 0; } +A bool f4 (int i, int j) { auto c = i <=> j; return c < 0; } +A bool f5 (int i, int j) { auto c = i <=> j; return c >= 0; } +A bool f6 (int i, int j) { auto c = i <=> j; return c <= 0; } +A bool f7 (int i, int j) { auto c = i <=> j; return c == std::strong_ordering::less; } +A bool f8 (int i, int j) { auto c = i <=> j; return c != std::strong_ordering::less; } +A bool f9 (int i, int j) { auto c = i <=> j; return c == std::strong_ordering::equal; } +A bool f10 (int i, int j) { auto c = i <=> j; return c != std::strong_ordering::equal; } +A bool f11 (int i, int j) { auto c = i <=> j; return c == std::strong_ordering::greater; } +A bool f12 (int i, int j) { auto c = i <=> j; return c != std::strong_ordering::greater; } +A bool f13 (int i) { auto c = i <=> 5; return c == 0; } +A bool f14 (int i) { auto c = i <=> 5; return c != 0; } +A bool f15 (int i) { auto c = i <=> 5; return c > 0; } +A bool f16 (int i) { auto c = i <=> 5; return c < 0; } +A bool f17 (int i) { auto c = i <=> 5; return c >= 0; } +A bool f18 (int i) { auto c = i <=> 5; return c <= 0; } +A bool f19 (int i) { auto c = i <=> 5; return c == std::strong_ordering::less; } +A bool f20 (int i) { auto c = i <=> 5; return c != std::strong_ordering::less; } +A bool f21 (int i) { auto c = i <=> 5; return c == std::strong_ordering::equal; } +A bool f22 (int i) { auto c = i <=> 5; return c != std::strong_ordering::equal; } +A bool f23 (int i) { auto c = i <=> 5; return c == std::strong_ordering::greater; } +A bool f24 (int i) { auto c = i <=> 5; return c != std::strong_ordering::greater; } diff --git a/gcc/testsuite/g++.dg/opt/pr94589-2.C b/gcc/testsuite/g++.dg/opt/pr94589-2.C new file mode 100644 index 0000000..dda947e --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr94589-2.C @@ -0,0 +1,33 @@ +// PR tree-optimization/94589 +// { dg-do compile { target c++20 } } +// { dg-options "-O2 -g0 -ffast-math -fdump-tree-optimized" } +// { dg-final { scan-tree-dump-times "\[ij]_\[0-9]+\\(D\\) (?:<|<=|==|!=|>|>=) \[ij]_\[0-9]+\\(D\\)" 14 "optimized" } } +// { dg-final { scan-tree-dump-times "i_\[0-9]+\\(D\\) (?:<|<=|==|!=|>|>=) 5\\.0" 14 "optimized" } } + +#include + +#define A __attribute__((noipa)) +A bool f1 (double i, double j) { auto c = i <=> j; return c == 0; } +A bool f2 (double i, double j) { auto c = i <=> j; return c != 0; } +A bool f3 (double i, double j) { auto c = i <=> j; return c > 0; } +A bool f4 (double i, double j) { auto c = i <=> j; return c < 0; } +A bool f5 (double i, double j) { auto c = i <=> j; return c >= 0; } +A bool f6 (double i, double j) { auto c = i <=> j; return c <= 0; } +A bool f7 (double i, double j) { auto c = i <=> j; return c == std::partial_ordering::less; } +A bool f8 (double i, double j) { auto c = i <=> j; return c != std::partial_ordering::less; } +A bool f9 (double i, double j) { auto c = i <=> j; return c == std::partial_ordering::equivalent; } +A bool f10 (double i, double j) { auto c = i <=> j; return c != std::partial_ordering::equivalent; } +A bool f11 (double i, double j) { auto c = i <=> j; return c == std::partial_ordering::greater; } +A bool f12 (double i, double j) { auto c = i <=> j; return c != std::partial_ordering::greater; } +A bool f13 (double i) { auto c = i <=> 5.0; return c == 0; } +A bool f14 (double i) { auto c = i <=> 5.0; return c != 0; } +A bool f15 (double i) { auto c = i <=> 5.0; return c > 0; } +A bool f16 (double i) { auto c = i <=> 5.0; return c < 0; } +A bool f17 (double i) { auto c = i <=> 5.0; return c >= 0; } +A bool f18 (double i) { auto c = i <=> 5.0; return c <= 0; } +A bool f19 (double i) { auto c = i <=> 5.0; return c == std::partial_ordering::less; } +A bool f20 (double i) { auto c = i <=> 5.0; return c != std::partial_ordering::less; } +A bool f21 (double i) { auto c = i <=> 5.0; return c == std::partial_ordering::equivalent; } +A bool f22 (double i) { auto c = i <=> 5.0; return c != std::partial_ordering::equivalent; } +A bool f23 (double i) { auto c = i <=> 5.0; return c == std::partial_ordering::greater; } +A bool f24 (double i) { auto c = i <=> 5.0; return c != std::partial_ordering::greater; } diff --git a/gcc/testsuite/g++.dg/opt/pr94589-3.C b/gcc/testsuite/g++.dg/opt/pr94589-3.C new file mode 100644 index 0000000..725b81f --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr94589-3.C @@ -0,0 +1,84 @@ +// { dg-do run { target c++20 } } +// { dg-options "-O2 -g" } + +#include "pr94589-1.C" + +#define C(fn, i, j, r) if (fn (i, j) != r) __builtin_abort () +#define D(fn, i, r) if (fn (i) != r) __builtin_abort () + +int +main () +{ + C (f1, 7, 8, false); + C (f1, 8, 8, true); + C (f1, 9, 8, false); + C (f2, 7, 8, true); + C (f2, 8, 8, false); + C (f2, 9, 8, true); + C (f3, 7, 8, false); + C (f3, 8, 8, false); + C (f3, 9, 8, true); + C (f4, 7, 8, true); + C (f4, 8, 8, false); + C (f4, 9, 8, false); + C (f5, 7, 8, false); + C (f5, 8, 8, true); + C (f5, 9, 8, true); + C (f6, 7, 8, true); + C (f6, 8, 8, true); + C (f6, 9, 8, false); + C (f7, 7, 8, true); + C (f7, 8, 8, false); + C (f7, 9, 8, false); + C (f8, 7, 8, false); + C (f8, 8, 8, true); + C (f8, 9, 8, true); + C (f9, 7, 8, false); + C (f9, 8, 8, true); + C (f9, 9, 8, false); + C (f10, 7, 8, true); + C (f10, 8, 8, false); + C (f10, 9, 8, true); + C (f11, 7, 8, false); + C (f11, 8, 8, false); + C (f11, 9, 8, true); + C (f12, 7, 8, true); + C (f12, 8, 8, true); + C (f12, 9, 8, false); + D (f13, 4, false); + D (f13, 5, true); + D (f13, 6, false); + D (f14, 4, true); + D (f14, 5, false); + D (f14, 6, true); + D (f15, 4, false); + D (f15, 5, false); + D (f15, 6, true); + D (f16, 4, true); + D (f16, 5, false); + D (f16, 6, false); + D (f17, 4, false); + D (f17, 5, true); + D (f17, 6, true); + D (f18, 4, true); + D (f18, 5, true); + D (f18, 6, false); + D (f19, 4, true); + D (f19, 5, false); + D (f19, 6, false); + D (f20, 4, false); + D (f20, 5, true); + D (f20, 6, true); + D (f21, 4, false); + D (f21, 5, true); + D (f21, 6, false); + D (f22, 4, true); + D (f22, 5, false); + D (f22, 6, true); + D (f23, 4, false); + D (f23, 5, false); + D (f23, 6, true); + D (f24, 4, true); + D (f24, 5, true); + D (f24, 6, false); +} diff --git a/gcc/testsuite/g++.dg/opt/pr94589-4.C b/gcc/testsuite/g++.dg/opt/pr94589-4.C new file mode 100644 index 0000000..256a455 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr94589-4.C @@ -0,0 +1,84 @@ +// { dg-do run { target c++20 } } +// { dg-options "-O2 -g -ffast-math" } + +#include "pr94589-2.C" + +#define C(fn, i, j, r) if (fn (i, j) != r) __builtin_abort () +#define D(fn, i, r) if (fn (i) != r) __builtin_abort () + +int +main () +{ + C (f1, 7.0, 8.0, false); + C (f1, 8.0, 8.0, true); + C (f1, 9.0, 8.0, false); + C (f2, 7.0, 8.0, true); + C (f2, 8.0, 8.0, false); + C (f2, 9.0, 8.0, true); + C (f3, 7.0, 8.0, false); + C (f3, 8.0, 8.0, false); + C (f3, 9.0, 8.0, true); + C (f4, 7.0, 8.0, true); + C (f4, 8.0, 8.0, false); + C (f4, 9.0, 8.0, false); + C (f5, 7.0, 8.0, false); + C (f5, 8.0, 8.0, true); + C (f5, 9.0, 8.0, true); + C (f6, 7.0, 8.0, true); + C (f6, 8.0, 8.0, true); + C (f6, 9.0, 8.0, false); + C (f7, 7.0, 8.0, true); + C (f7, 8.0, 8.0, false); + C (f7, 9.0, 8.0, false); + C (f8, 7.0, 8.0, false); + C (f8, 8.0, 8.0, true); + C (f8, 9.0, 8.0, true); + C (f9, 7.0, 8.0, false); + C (f9, 8.0, 8.0, true); + C (f9, 9.0, 8.0, false); + C (f10, 7.0, 8.0, true); + C (f10, 8.0, 8.0, false); + C (f10, 9.0, 8.0, true); + C (f11, 7.0, 8.0, false); + C (f11, 8.0, 8.0, false); + C (f11, 9.0, 8.0, true); + C (f12, 7.0, 8.0, true); + C (f12, 8.0, 8.0, true); + C (f12, 9.0, 8.0, false); + D (f13, 4.0, false); + D (f13, 5.0, true); + D (f13, 6.0, false); + D (f14, 4.0, true); + D (f14, 5.0, false); + D (f14, 6.0, true); + D (f15, 4.0, false); + D (f15, 5.0, false); + D (f15, 6.0, true); + D (f16, 4.0, true); + D (f16, 5.0, false); + D (f16, 6.0, false); + D (f17, 4.0, false); + D (f17, 5.0, true); + D (f17, 6.0, true); + D (f18, 4.0, true); + D (f18, 5.0, true); + D (f18, 6.0, false); + D (f19, 4.0, true); + D (f19, 5.0, false); + D (f19, 6.0, false); + D (f20, 4.0, false); + D (f20, 5.0, true); + D (f20, 6.0, true); + D (f21, 4.0, false); + D (f21, 5.0, true); + D (f21, 6.0, false); + D (f22, 4.0, true); + D (f22, 5.0, false); + D (f22, 6.0, true); + D (f23, 4.0, false); + D (f23, 5.0, false); + D (f23, 6.0, true); + D (f24, 4.0, true); + D (f24, 5.0, true); + D (f24, 6.0, false); +} diff --git a/gcc/testsuite/gcc.dg/pr94589-1.c b/gcc/testsuite/gcc.dg/pr94589-1.c new file mode 100644 index 0000000..de404ea --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr94589-1.c @@ -0,0 +1,35 @@ +/* PR tree-optimization/94589 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -g0 -fdump-tree-optimized" } */ +/* { dg-final { scan-tree-dump-times "\[ij]_\[0-9]+\\(D\\) (?:<|<=|==|!=|>|>=) \[ij]_\[0-9]+\\(D\\)" 14 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "i_\[0-9]+\\(D\\) (?:<|<=|==|!=|>|>=) \[45]" 14 "optimized" } } */ + +#define A __attribute__((noipa)) +A int f1 (int i, int j) { int c = i == j ? 0 : i < j ? -1 : 1; return c == 0; } +A int f2 (int i, int j) { int c = i == j ? 0 : i < j ? -1 : 1; return c != 0; } +A int f3 (int i, int j) { int c = i == j ? 0 : i < j ? -1 : 1; return c > 0; } +A int f4 (int i, int j) { int c = i == j ? 0 : i < j ? -1 : 1; return c < 0; } +A int f5 (int i, int j) { int c = i == j ? 0 : i < j ? -1 : 1; return c >= 0; } +A int f6 (int i, int j) { int c = i == j ? 0 : i < j ? -1 : 1; return c <= 0; } +A int f7 (int i, int j) { int c = i == j ? 0 : i < j ? -1 : 1; return c == -1; } +A int f8 (int i, int j) { int c = i == j ? 0 : i < j ? -1 : 1; return c != -1; } +A int f9 (int i, int j) { int c = i == j ? 0 : i < j ? -1 : 1; return c > -1; } +A int f10 (int i, int j) { int c = i == j ? 0 : i < j ? -1 : 1; return c <= -1; } +A int f11 (int i, int j) { int c = i == j ? 0 : i < j ? -1 : 1; return c == 1; } +A int f12 (int i, int j) { int c = i == j ? 0 : i < j ? -1 : 1; return c != 1; } +A int f13 (int i, int j) { int c = i == j ? 0 : i < j ? -1 : 1; return c < 1; } +A int f14 (int i, int j) { int c = i == j ? 0 : i < j ? -1 : 1; return c >= 1; } +A int f15 (int i) { int c = i == 5 ? 0 : i < 5 ? -1 : 1; return c == 0; } +A int f16 (int i) { int c = i == 5 ? 0 : i < 5 ? -1 : 1; return c != 0; } +A int f17 (int i) { int c = i == 5 ? 0 : i < 5 ? -1 : 1; return c > 0; } +A int f18 (int i) { int c = i == 5 ? 0 : i < 5 ? -1 : 1; return c < 0; } +A int f19 (int i) { int c = i == 5 ? 0 : i < 5 ? -1 : 1; return c >= 0; } +A int f20 (int i) { int c = i == 5 ? 0 : i < 5 ? -1 : 1; return c <= 0; } +A int f21 (int i) { int c = i == 5 ? 0 : i < 5 ? -1 : 1; return c == -1; } +A int f22 (int i) { int c = i == 5 ? 0 : i < 5 ? -1 : 1; return c != -1; } +A int f23 (int i) { int c = i == 5 ? 0 : i < 5 ? -1 : 1; return c > -1; } +A int f24 (int i) { int c = i == 5 ? 0 : i < 5 ? -1 : 1; return c <= -1; } +A int f25 (int i) { int c = i == 5 ? 0 : i < 5 ? -1 : 1; return c == 1; } +A int f26 (int i) { int c = i == 5 ? 0 : i < 5 ? -1 : 1; return c != 1; } +A int f27 (int i) { int c = i == 5 ? 0 : i < 5 ? -1 : 1; return c < 1; } +A int f28 (int i) { int c = i == 5 ? 0 : i < 5 ? -1 : 1; return c >= 1; } diff --git a/gcc/testsuite/gcc.dg/pr94589-2.c b/gcc/testsuite/gcc.dg/pr94589-2.c new file mode 100644 index 0000000..9481b76 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr94589-2.c @@ -0,0 +1,35 @@ +/* PR tree-optimization/94589 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -g0 -ffast-math -fdump-tree-optimized" } */ +/* { dg-final { scan-tree-dump-times "\[ij]_\[0-9]+\\(D\\) (?:<|<=|==|!=|>|>=) \[ij]_\[0-9]+\\(D\\)" 14 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "i_\[0-9]+\\(D\\) (?:<|<=|==|!=|>|>=) 5\\.0" 14 "optimized" } } */ + +#define A __attribute__((noipa)) +A int f1 (double i, double j) { int c; if (i == j) c = 0; else if (i < j) c = -1; else if (i > j) c = 1; else c = 2; return c == 0; } +A int f2 (double i, double j) { int c; if (i == j) c = 0; else if (i < j) c = -1; else if (i > j) c = 1; else c = 2; return c != 0; } +A int f3 (double i, double j) { int c; if (i == j) c = 0; else if (i < j) c = -1; else if (i > j) c = 1; else c = 2; return c > 0; } +A int f4 (double i, double j) { int c; if (i == j) c = 0; else if (i < j) c = -1; else if (i > j) c = 1; else c = 2; return c < 0; } +A int f5 (double i, double j) { int c; if (i == j) c = 0; else if (i < j) c = -1; else if (i > j) c = 1; else c = 2; return c >= 0; } +A int f6 (double i, double j) { int c; if (i == j) c = 0; else if (i < j) c = -1; else if (i > j) c = 1; else c = 2; return c <= 0; } +A int f7 (double i, double j) { int c; if (i == j) c = 0; else if (i < j) c = -1; else if (i > j) c = 1; else c = 2; return c == -1; } +A int f8 (double i, double j) { int c; if (i == j) c = 0; else if (i < j) c = -1; else if (i > j) c = 1; else c = 2; return c != -1; } +A int f9 (double i, double j) { int c; if (i == j) c = 0; else if (i < j) c = -1; else if (i > j) c = 1; else c = 2; return c > -1; } +A int f10 (double i, double j) { int c; if (i == j) c = 0; else if (i < j) c = -1; else if (i > j) c = 1; else c = 2; return c <= -1; } +A int f11 (double i, double j) { int c; if (i == j) c = 0; else if (i < j) c = -1; else if (i > j) c = 1; else c = 2; return c == 1; } +A int f12 (double i, double j) { int c; if (i == j) c = 0; else if (i < j) c = -1; else if (i > j) c = 1; else c = 2; return c != 1; } +A int f13 (double i, double j) { int c; if (i == j) c = 0; else if (i < j) c = -1; else if (i > j) c = 1; else c = 2; return c < 1; } +A int f14 (double i, double j) { int c; if (i == j) c = 0; else if (i < j) c = -1; else if (i > j) c = 1; else c = 2; return c >= 1; } +A int f15 (double i) { int c; if (i == 5.0) c = 0; else if (i < 5.0) c = -1; else if (i > 5.0) c = 1; else c = 2; return c == 0; } +A int f16 (double i) { int c; if (i == 5.0) c = 0; else if (i < 5.0) c = -1; else if (i > 5.0) c = 1; else c = 2; return c != 0; } +A int f17 (double i) { int c; if (i == 5.0) c = 0; else if (i < 5.0) c = -1; else if (i > 5.0) c = 1; else c = 2; return c > 0; } +A int f18 (double i) { int c; if (i == 5.0) c = 0; else if (i < 5.0) c = -1; else if (i > 5.0) c = 1; else c = 2; return c < 0; } +A int f19 (double i) { int c; if (i == 5.0) c = 0; else if (i < 5.0) c = -1; else if (i > 5.0) c = 1; else c = 2; return c >= 0; } +A int f20 (double i) { int c; if (i == 5.0) c = 0; else if (i < 5.0) c = -1; else if (i > 5.0) c = 1; else c = 2; return c <= 0; } +A int f21 (double i) { int c; if (i == 5.0) c = 0; else if (i < 5.0) c = -1; else if (i > 5.0) c = 1; else c = 2; return c == -1; } +A int f22 (double i) { int c; if (i == 5.0) c = 0; else if (i < 5.0) c = -1; else if (i > 5.0) c = 1; else c = 2; return c != -1; } +A int f23 (double i) { int c; if (i == 5.0) c = 0; else if (i < 5.0) c = -1; else if (i > 5.0) c = 1; else c = 2; return c > -1; } +A int f24 (double i) { int c; if (i == 5.0) c = 0; else if (i < 5.0) c = -1; else if (i > 5.0) c = 1; else c = 2; return c <= -1; } +A int f25 (double i) { int c; if (i == 5.0) c = 0; else if (i < 5.0) c = -1; else if (i > 5.0) c = 1; else c = 2; return c == 1; } +A int f26 (double i) { int c; if (i == 5.0) c = 0; else if (i < 5.0) c = -1; else if (i > 5.0) c = 1; else c = 2; return c != 1; } +A int f27 (double i) { int c; if (i == 5.0) c = 0; else if (i < 5.0) c = -1; else if (i > 5.0) c = 1; else c = 2; return c < 1; } +A int f28 (double i) { int c; if (i == 5.0) c = 0; else if (i < 5.0) c = -1; else if (i > 5.0) c = 1; else c = 2; return c >= 1; } diff --git a/gcc/testsuite/gcc.dg/pr94589-3.c b/gcc/testsuite/gcc.dg/pr94589-3.c new file mode 100644 index 0000000..df82fab --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr94589-3.c @@ -0,0 +1,97 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -g" } */ + +#include "pr94589-1.c" + +#define C(fn, i, j, r) if (fn (i, j) != r) __builtin_abort () +#define D(fn, i, r) if (fn (i) != r) __builtin_abort () + +int +main () +{ + C (f1, 7, 8, 0); + C (f1, 8, 8, 1); + C (f1, 9, 8, 0); + C (f2, 7, 8, 1); + C (f2, 8, 8, 0); + C (f2, 9, 8, 1); + C (f3, 7, 8, 0); + C (f3, 8, 8, 0); + C (f3, 9, 8, 1); + C (f4, 7, 8, 1); + C (f4, 8, 8, 0); + C (f4, 9, 8, 0); + C (f5, 7, 8, 0); + C (f5, 8, 8, 1); + C (f5, 9, 8, 1); + C (f6, 7, 8, 1); + C (f6, 8, 8, 1); + C (f6, 9, 8, 0); + C (f7, 7, 8, 1); + C (f7, 8, 8, 0); + C (f7, 9, 8, 0); + C (f8, 7, 8, 0); + C (f8, 8, 8, 1); + C (f8, 9, 8, 1); + C (f9, 7, 8, 0); + C (f9, 8, 8, 1); + C (f9, 9, 8, 1); + C (f10, 7, 8, 1); + C (f10, 8, 8, 0); + C (f10, 9, 8, 0); + C (f11, 7, 8, 0); + C (f11, 8, 8, 0); + C (f11, 9, 8, 1); + C (f12, 7, 8, 1); + C (f12, 8, 8, 1); + C (f12, 9, 8, 0); + C (f13, 7, 8, 1); + C (f13, 8, 8, 1); + C (f13, 9, 8, 0); + C (f14, 7, 8, 0); + C (f14, 8, 8, 0); + C (f14, 9, 8, 1); + D (f15, 4, 0); + D (f15, 5, 1); + D (f15, 6, 0); + D (f16, 4, 1); + D (f16, 5, 0); + D (f16, 6, 1); + D (f17, 4, 0); + D (f17, 5, 0); + D (f17, 6, 1); + D (f18, 4, 1); + D (f18, 5, 0); + D (f18, 6, 0); + D (f19, 4, 0); + D (f19, 5, 1); + D (f19, 6, 1); + D (f20, 4, 1); + D (f20, 5, 1); + D (f20, 6, 0); + D (f21, 4, 1); + D (f21, 5, 0); + D (f21, 6, 0); + D (f22, 4, 0); + D (f22, 5, 1); + D (f22, 6, 1); + D (f23, 4, 0); + D (f23, 5, 1); + D (f23, 6, 1); + D (f24, 4, 1); + D (f24, 5, 0); + D (f24, 6, 0); + D (f25, 4, 0); + D (f25, 5, 0); + D (f25, 6, 1); + D (f26, 4, 1); + D (f26, 5, 1); + D (f26, 6, 0); + D (f27, 4, 1); + D (f27, 5, 1); + D (f27, 6, 0); + D (f28, 4, 0); + D (f28, 5, 0); + D (f28, 6, 1); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/pr94589-4.c b/gcc/testsuite/gcc.dg/pr94589-4.c new file mode 100644 index 0000000..b2557fb --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr94589-4.c @@ -0,0 +1,97 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -g -ffast-math" } */ + +#include "pr94589-2.c" + +#define C(fn, i, j, r) if (fn (i, j) != r) __builtin_abort () +#define D(fn, i, r) if (fn (i) != r) __builtin_abort () + +int +main () +{ + C (f1, 7.0, 8.0, 0); + C (f1, 8.0, 8.0, 1); + C (f1, 9.0, 8.0, 0); + C (f2, 7.0, 8.0, 1); + C (f2, 8.0, 8.0, 0); + C (f2, 9.0, 8.0, 1); + C (f3, 7.0, 8.0, 0); + C (f3, 8.0, 8.0, 0); + C (f3, 9.0, 8.0, 1); + C (f4, 7.0, 8.0, 1); + C (f4, 8.0, 8.0, 0); + C (f4, 9.0, 8.0, 0); + C (f5, 7.0, 8.0, 0); + C (f5, 8.0, 8.0, 1); + C (f5, 9.0, 8.0, 1); + C (f6, 7.0, 8.0, 1); + C (f6, 8.0, 8.0, 1); + C (f6, 9.0, 8.0, 0); + C (f7, 7.0, 8.0, 1); + C (f7, 8.0, 8.0, 0); + C (f7, 9.0, 8.0, 0); + C (f8, 7.0, 8.0, 0); + C (f8, 8.0, 8.0, 1); + C (f8, 9.0, 8.0, 1); + C (f9, 7.0, 8.0, 0); + C (f9, 8.0, 8.0, 1); + C (f9, 9.0, 8.0, 1); + C (f10, 7.0, 8.0, 1); + C (f10, 8.0, 8.0, 0); + C (f10, 9.0, 8.0, 0); + C (f11, 7.0, 8.0, 0); + C (f11, 8.0, 8.0, 0); + C (f11, 9.0, 8.0, 1); + C (f12, 7.0, 8.0, 1); + C (f12, 8.0, 8.0, 1); + C (f12, 9.0, 8.0, 0); + C (f13, 7.0, 8.0, 1); + C (f13, 8.0, 8.0, 1); + C (f13, 9.0, 8.0, 0); + C (f14, 7.0, 8.0, 0); + C (f14, 8.0, 8.0, 0); + C (f14, 9.0, 8.0, 1); + D (f15, 4.0, 0); + D (f15, 5.0, 1); + D (f15, 6.0, 0); + D (f16, 4.0, 1); + D (f16, 5.0, 0); + D (f16, 6.0, 1); + D (f17, 4.0, 0); + D (f17, 5.0, 0); + D (f17, 6.0, 1); + D (f18, 4.0, 1); + D (f18, 5.0, 0); + D (f18, 6.0, 0); + D (f19, 4.0, 0); + D (f19, 5.0, 1); + D (f19, 6.0, 1); + D (f20, 4.0, 1); + D (f20, 5.0, 1); + D (f20, 6.0, 0); + D (f21, 4.0, 1); + D (f21, 5.0, 0); + D (f21, 6.0, 0); + D (f22, 4.0, 0); + D (f22, 5.0, 1); + D (f22, 6.0, 1); + D (f23, 4.0, 0); + D (f23, 5.0, 1); + D (f23, 6.0, 1); + D (f24, 4.0, 1); + D (f24, 5.0, 0); + D (f24, 6.0, 0); + D (f25, 4.0, 0); + D (f25, 5.0, 0); + D (f25, 6.0, 1); + D (f26, 4.0, 1); + D (f26, 5.0, 1); + D (f26, 6.0, 0); + D (f27, 4.0, 1); + D (f27, 5.0, 1); + D (f27, 6.0, 0); + D (f28, 4.0, 0); + D (f28, 5.0, 0); + D (f28, 6.0, 1); + return 0; +} -- cgit v1.1 From 3c33c00f43bfe585d9414dfb620f0f518e55a457 Mon Sep 17 00:00:00 2001 From: Marius Hillenbrand Date: Tue, 4 May 2021 13:30:05 +0200 Subject: IBM Z: Fix error checking for builtin vec_permi The builtin vec_permi is peculiar in that its immediate operand is encoded differently than the immediate operand that is backing the builtin. This fixes the check for the immediate operand, adding a regression test in the process. This partially reverts commit 3191c1f4488d1f7563b563d7ae2a102a26f16d82 2021-05-06 Marius Hillenbrand gcc/ChangeLog: * config/s390/s390-builtins.def (O_M5, O1_M5, ...): Remove unused macros. (s390_vec_permi_s64, s390_vec_permi_b64, s390_vec_permi_u64) (s390_vec_permi_dbl, s390_vpdi): Use the O3_U2 type for the immediate operand. * config/s390/s390.c (s390_const_operand_ok): Remove unused values. gcc/testsuite/ChangeLog: * gcc.target/s390/zvector/imm-range-error-1.c: Fix test for __builtin_s390_vpdi. * gcc.target/s390/zvector/vec-permi.c: New test for builtin vec_permi. --- .../gcc.target/s390/zvector/imm-range-error-1.c | 2 +- gcc/testsuite/gcc.target/s390/zvector/vec-permi.c | 54 ++++++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/s390/zvector/vec-permi.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/s390/zvector/imm-range-error-1.c b/gcc/testsuite/gcc.target/s390/zvector/imm-range-error-1.c index 1fe68f5..021c8d2 100644 --- a/gcc/testsuite/gcc.target/s390/zvector/imm-range-error-1.c +++ b/gcc/testsuite/gcc.target/s390/zvector/imm-range-error-1.c @@ -22,5 +22,5 @@ main () __builtin_s390_vrepf (s, 4); /* { dg-error "constant argument 2 for builtin '__builtin_s390_vrepf' is out of range \\(0..3\\)" } */ __builtin_s390_vrepg (d, 2); /* { dg-error "constant argument 2 for builtin '__builtin_s390_vrepg' is out of range \\(0..1\\)" } */ - __builtin_s390_vpdi (d, d, 2); /* { dg-error "constant argument 3 for builtin '__builtin_s390_vpdi' is invalid \\(0, 1, 4, 5\\)" } */ + __builtin_s390_vpdi (d, d, 4); /* { dg-error "constant argument 3 for builtin '__builtin_s390_vpdi' is out of range \\(0..3\\)" } */ } diff --git a/gcc/testsuite/gcc.target/s390/zvector/vec-permi.c b/gcc/testsuite/gcc.target/s390/zvector/vec-permi.c new file mode 100644 index 0000000..c0a852b --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/zvector/vec-permi.c @@ -0,0 +1,54 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -march=z13 -mzarch --save-temps" } */ +/* { dg-do run { target { s390_z13_hw } } } */ + +/* + * The vector intrinsic vec_permi(a, b, c) chooses one of the two eight-byte + * vector elements in each of a and b, depending on the value of c. The valid + * values for c differ from the encoding for the M4 field in assembly and in the + * binary instruction. + * + * selection | c | encoding in assembly + * a[0] b[0] | 0 | 0 + * a[0] b[1] | 1 | 1 + * a[1] b[0] | 2 | 4 + * a[1] b[1] | 3 | 5 + * + * (i.e., indices a[i] b[j] are encoded for c as (i<<1) | j, yet for the + * M4 field as (i<<2) | j. + */ +#include +#include + +typedef unsigned long long uv2di __attribute__((vector_size(16))); + +__attribute__ ((noipa)) static uv2di +do_vec_permi(uv2di a, uv2di b, int c) +{ + switch(c) { + case 0: return vec_permi(a, b, 0); + case 1: return vec_permi(a, b, 1); + case 2: return vec_permi(a, b, 2); + case 3: return vec_permi(a, b, 3); + default: assert(0); + } +} + +/* { dg-final { scan-assembler-times {\n\tvpdi\t%v\d+,%v\d+,%v\d+,0\n} 1 } } */ +/* { dg-final { scan-assembler-times {\n\tvpdi\t%v\d+,%v\d+,%v\d+,1\n} 1 } } */ +/* { dg-final { scan-assembler-times {\n\tvpdi\t%v\d+,%v\d+,%v\d+,4\n} 1 } } */ +/* { dg-final { scan-assembler-times {\n\tvpdi\t%v\d+,%v\d+,%v\d+,5\n} 1 } } */ + +int +main (void) +{ + uv2di a = { 0xa0, 0xa1 }; + uv2di b = { 0xb0, 0xb1 }; + + for (int i = 0; i < 2; i++) + for (int j = 0; j < 2; j++) { + uv2di res = do_vec_permi(a, b, (i<<1)|j); + assert(res[0] == a[i]); + assert(res[1] == b[j]); + } +} -- cgit v1.1 From e82e87a851cdea9f4f43f342842025b068287d4e Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Thu, 6 May 2021 09:05:52 +0000 Subject: testsuite: gcc.c-torture/execute/ieee/cdivchkld.c needs fmaxl The new test gcc.c-torture/execute/ieee/cdivchkld.c needs fmaxl(), which may not be available, for instance on aarch64-elf with newlib. As discussed in the PR, requiring c99_runtime enables to skip the test in this case. 2021-05-06 Christophe Lyon PR testsuite/100355 gcc/testsuite/ * gcc.c-torture/execute/ieee/cdivchkld.x: New. --- gcc/testsuite/gcc.c-torture/execute/ieee/cdivchkld.x | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 gcc/testsuite/gcc.c-torture/execute/ieee/cdivchkld.x (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/cdivchkld.x b/gcc/testsuite/gcc.c-torture/execute/ieee/cdivchkld.x new file mode 100644 index 0000000..f798152 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/cdivchkld.x @@ -0,0 +1,4 @@ +if { [check_effective_target_c99_runtime] } { + return 0 +} +return 1 -- cgit v1.1 From a2c593009fef1564dbef2237ee71e9fd08f5361e Mon Sep 17 00:00:00 2001 From: Paul Thomas Date: Thu, 6 May 2021 14:41:33 +0100 Subject: Fortran: Assumed and explicit size class arrays [PR46691/99819]. 2021-05-06 Paul Thomas gcc/fortran/ChangeLog PR fortran/46691 PR fortran/99819 * class.c (gfc_build_class_symbol): Remove the error that disables assumed size class arrays. Class array types that are not deferred shape or assumed rank are given a unique name and placed in the procedure namespace. * trans-array.c (gfc_trans_g77_array): Obtain the data pointer for class arrays. (gfc_trans_dummy_array_bias): Suppress the runtime error for extent violations in explicit shape class arrays because it always fails. * trans-expr.c (gfc_conv_procedure_call): Handle assumed size class actual arguments passed to non-descriptor formal args by using the data pointer, stored as the symbol's backend decl. gcc/testsuite/ChangeLog PR fortran/46691 PR fortran/99819 * gfortran.dg/class_dummy_6.f90: New test. * gfortran.dg/class_dummy_7.f90: New test. --- gcc/testsuite/gfortran.dg/class_dummy_6.f90 | 65 +++++++++++++++++++++++++++++ gcc/testsuite/gfortran.dg/class_dummy_7.f90 | 60 ++++++++++++++++++++++++++ 2 files changed, 125 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/class_dummy_6.f90 create mode 100644 gcc/testsuite/gfortran.dg/class_dummy_7.f90 (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gfortran.dg/class_dummy_6.f90 b/gcc/testsuite/gfortran.dg/class_dummy_6.f90 new file mode 100644 index 0000000..79f6e86 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/class_dummy_6.f90 @@ -0,0 +1,65 @@ +! { dg-do run } +! +! Test the fix for PR99819 - explicit shape class arrays in different +! procedures caused an ICE. +! +! Contributed by Gerhard Steinmetz +! +program p + type t + integer :: i + end type + class(t), allocatable :: dum1(:), dum2(:), dum3(:,:) + + allocate (t :: dum1(3), dum2(10), dum3(2,5)) + dum2%i = [1,2,3,4,5,6,7,8,9,10] + dum3%i = reshape ([1,2,3,4,5,6,7,8,9,10],[2,5]) + +! Somewhat elaborated versions of the PR procedures. + if (f (dum1, dum2, dum3) .ne. 10) stop 1 + if (g (dum1) .ne. 3) stop 2 + +! Test the original versions of the procedures. + if (f_original (dum1, dum2) .ne. 3) stop 3 + if (g_original (dum2) .ne. 10) stop 4 + +contains + integer function f(x, y, z) + class(t) :: x(:) + class(t) :: y(size( x)) + class(t) :: z(2,*) + if (size (y) .ne. 3) stop 5 + if (size (z) .ne. 0) stop 6 + select type (y) + type is (t) + f = 1 + if (any (y%i .ne. [1,2,3])) stop 7 + class default + f = 0 + end select + select type (z) + type is (t) + f = f*10 + if (any (z(1,1:4)%i .ne. [1,3,5,7])) stop 8 + class default + f = 0 + end select + end + integer function g(z) + class(t) :: z(:) + type(t) :: u(size(z)) + g = size (u) + end + + integer function f_original(x, y) + class(t) :: x(:) + class(*) :: y(size (x)) + f_original = size (y) + end + + integer function g_original(z) + class(*) :: z(:) + type(t) :: u(size(z)) + g_original = size (u) + end +end diff --git a/gcc/testsuite/gfortran.dg/class_dummy_7.f90 b/gcc/testsuite/gfortran.dg/class_dummy_7.f90 new file mode 100644 index 0000000..9134268 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/class_dummy_7.f90 @@ -0,0 +1,60 @@ +! { dg-do run } +! +! Test the fix for PR46691 - enable class assumed size arrays +! +! Reported by Tobias Burnus +! from http://j3-fortran.org/pipermail/j3/2010-December/004084.html +! submitted by Robert Corbett. +! + MODULE TYPES + PRIVATE + PUBLIC REC, REC2 + + TYPE REC + INTEGER A + END TYPE + + TYPE, EXTENDS(REC) :: REC2 + INTEGER B + END TYPE + END + + SUBROUTINE SUB1(A, N) + USE TYPES + CLASS(REC), INTENT(IN) :: A(*) + INTERFACE + SUBROUTINE SUB2(A, N, IARRAY) + USE TYPES + TYPE(REC) A(*) + INTEGER :: N, IARRAY(N) + END + END INTERFACE + + CALL SUB2(A, N,[1,2,2,3,3,4,4,5,5,6]) + select type (B => A(1:N)) + type is (REC2) + call SUB2(B%REC,N,[1,2,3,4,5,6,7,8,9,10]) + end select + + END + + SUBROUTINE SUB2(A, N, IARRAY) + USE TYPES + TYPE(REC) A(*) + INTEGER :: N, IARRAY(N) + if (any (A(:N)%A .ne. IARRAY(:N))) stop 1 + END + + PROGRAM MAIN + USE TYPES + CLASS(REC), ALLOCATABLE :: A(:) + INTERFACE + SUBROUTINE SUB1(A, N) + USE TYPES + CLASS(REC), INTENT(IN) :: A(*) + END SUBROUTINE + END INTERFACE + + A = [ (REC2(I, I+1), I = 1, 10) ] + CALL SUB1(A, 10) + END -- cgit v1.1 From 1e27ffde96b3967a3abfb4218a20e8ce75b04003 Mon Sep 17 00:00:00 2001 From: Robin Dapp Date: Thu, 6 May 2021 15:52:48 +0200 Subject: testsuite: Add vect_floatint_cvt to gcc.dg/vect/pr56541.c pr56541.c converts a float vector to an int (bool) vector. Add vect_floatint_cvt in order to select the right targets. gcc/testsuite/ChangeLog: * gcc.dg/vect/pr56541.c: Add vect_floatint_cvt. --- gcc/testsuite/gcc.dg/vect/pr56541.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/vect/pr56541.c b/gcc/testsuite/gcc.dg/vect/pr56541.c index d5def68..e1cee6d 100644 --- a/gcc/testsuite/gcc.dg/vect/pr56541.c +++ b/gcc/testsuite/gcc.dg/vect/pr56541.c @@ -24,4 +24,4 @@ void foo() } } -/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail { ! vect_cond_mixed } } } } */ +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { ! vect_floatint_cvt } xfail { ! vect_cond_mixed } } } } */ -- cgit v1.1 From 5edc7a0af6ffbaadd6acc4c8d2911d92f317e9a5 Mon Sep 17 00:00:00 2001 From: Robin Dapp Date: Thu, 6 May 2021 15:55:47 +0200 Subject: testsuite: Add s390 to vect_*_cvt checks. This patch adds s390 to vect_*_cvt checks in target-supports.exp. gcc/testsuite/ChangeLog: * lib/target-supports.exp: Add s390 checks for vect conversions. --- gcc/testsuite/lib/target-supports.exp | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index a522da3..5700c23 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -3504,7 +3504,9 @@ proc check_effective_target_vect_intfloat_cvt { } { || [is-effective-target arm_neon] || ([istarget mips*-*-*] && [et-is-effective-target mips_msa]) - || [istarget amdgcn-*-*] }}] + || [istarget amdgcn-*-*] + || ([istarget s390*-*-*] + && [check_effective_target_s390_vxe2]) }}] } # Return 1 if the target supports signed double->int conversion @@ -3521,7 +3523,9 @@ proc check_effective_target_vect_doubleint_cvt { } { || [istarget aarch64*-*-*] || ([istarget powerpc*-*-*] && [check_vsx_hw_available]) || ([istarget mips*-*-*] - && [et-is-effective-target mips_msa]) }}] + && [et-is-effective-target mips_msa]) + || ([istarget s390*-*-*] + && [check_effective_target_s390_vx]) }}] } # Return 1 if the target supports signed int->double conversion @@ -3538,7 +3542,9 @@ proc check_effective_target_vect_intdouble_cvt { } { || [istarget aarch64*-*-*] || ([istarget powerpc*-*-*] && [check_vsx_hw_available]) || ([istarget mips*-*-*] - && [et-is-effective-target mips_msa]) }}] + && [et-is-effective-target mips_msa]) + || ([istarget s390*-*-*] + && [check_effective_target_s390_vx]) }}] } #Return 1 if we're supporting __int128 for target, 0 otherwise. @@ -3567,7 +3573,9 @@ proc check_effective_target_vect_uintfloat_cvt { } { || [is-effective-target arm_neon] || ([istarget mips*-*-*] && [et-is-effective-target mips_msa]) - || [istarget amdgcn-*-*] }}] + || [istarget amdgcn-*-*] + || ([istarget s390*-*-*] + && [check_effective_target_s390_vxe2]) }}] } @@ -3582,7 +3590,9 @@ proc check_effective_target_vect_floatint_cvt { } { || [is-effective-target arm_neon] || ([istarget mips*-*-*] && [et-is-effective-target mips_msa]) - || [istarget amdgcn-*-*] }}] + || [istarget amdgcn-*-*] + || ([istarget s390*-*-*] + && [check_effective_target_s390_vxe2]) }}] } # Return 1 if the target supports unsigned float->int conversion @@ -3595,7 +3605,9 @@ proc check_effective_target_vect_floatuint_cvt { } { || [is-effective-target arm_neon] || ([istarget mips*-*-*] && [et-is-effective-target mips_msa]) - || [istarget amdgcn-*-*] }}] + || [istarget amdgcn-*-*] + || ([istarget s390*-*-*] + && [check_effective_target_s390_vxe2]) }}] } # Return 1 if peeling for alignment might be profitable on the target @@ -9794,7 +9806,10 @@ proc check_vect_support_and_set_flags { } { lappend DEFAULT_VECTCFLAGS "--param" "max-unroll-times=8" lappend DEFAULT_VECTCFLAGS "--param" "max-completely-peeled-insns=200" lappend DEFAULT_VECTCFLAGS "--param" "max-completely-peel-times=16" - if [check_effective_target_s390_vxe] { + if [check_effective_target_s390_vxe2] { + lappend DEFAULT_VECTCFLAGS "-march=z15" "-mzarch" + set dg-do-what-default run + } elseif [check_effective_target_s390_vxe] { lappend DEFAULT_VECTCFLAGS "-march=z14" "-mzarch" set dg-do-what-default run } elseif [check_effective_target_s390_vx] { -- cgit v1.1 From 0f442f1378f4e9866793309504e38467f34c5d61 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Thu, 6 May 2021 16:26:55 +0200 Subject: Fix PR testsuite/100454 gcc/testsuite/ * gnat.dg/opt93.adb: Compile only for LP64 targets. --- gcc/testsuite/gnat.dg/opt93.adb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gnat.dg/opt93.adb b/gcc/testsuite/gnat.dg/opt93.adb index 5c82ad2..04a6a06 100644 --- a/gcc/testsuite/gnat.dg/opt93.adb +++ b/gcc/testsuite/gnat.dg/opt93.adb @@ -1,4 +1,4 @@ --- { dg-do compile } +-- { dg-do compile { target lp64 } } -- { dg-options "-O2 -fdump-tree-optimized" } package body Opt93 is -- cgit v1.1 From 717d278af93a4ab04ff30267888fc14fe0221799 Mon Sep 17 00:00:00 2001 From: Martin Jambor Date: Wed, 5 May 2021 10:41:41 +0200 Subject: ipa-sra: Do not bail out when callers cannot be cloned IPA-SRA fails to produce (very simple) edge summaries when a caller cannot be cloned or its signature cannot be changed which makes it less powerful for no good reason. This patch fixes that problem. gcc/ChangeLog: 2021-04-12 Martin Jambor * ipa-sra.c (ipa_sra_dump_all_summaries): Dump edge summaries even when there is no function summary. (ipa_sra_summarize_function): produce edge summaries even when bailing out early. gcc/testsuite/ChangeLog: 2021-04-12 Martin Jambor * gcc.dg/ipa/ipa-sra-1.c (main): Revert change done by 05193687dde, make the argv again pointer to an array. --- gcc/testsuite/gcc.dg/ipa/ipa-sra-1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-sra-1.c b/gcc/testsuite/gcc.dg/ipa/ipa-sra-1.c index df7e356..4a22e39 100644 --- a/gcc/testsuite/gcc.dg/ipa/ipa-sra-1.c +++ b/gcc/testsuite/gcc.dg/ipa/ipa-sra-1.c @@ -24,7 +24,7 @@ ox (struct bovid cow) } int -main (int argc, char **argv) +main (int argc, char *argv[]) { struct bovid cow; -- cgit v1.1 From 8f51cf38bb9628546effe66c070188d10f80b5ca Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Thu, 6 May 2021 23:20:35 +0000 Subject: preprocessor: Fix pp-number lexing of digit separators [PR83873, PR97604] When the preprocessor lexes preprocessing numbers in lex_number, it accepts digit separators in more cases than actually permitted in pp-numbers by the standard syntax. One thing this accepts is adjacent digit separators; there is some code to reject those later, but as noted in bug 83873 it fails to cover the case of adjacent digit separators within a floating-point exponent. Accepting adjacent digit separators only results in a missing diagnostic, not in valid code being rejected or being accepted with incorrect semantics, because the correct lexing in such a case would have '' start the following preprocessing tokens, and no valid preprocessing token starts '' while ' isn't valid on its own as a preprocessing token either. So this patch fixes that case by moving the error for adjacent digit separators to lex_number (allowing a more specific diagnostic than if '' were excluded from the pp-number completely). Other cases inappropriately accepted involve digit separators before '.', 'e+', 'e-', 'p+' or 'p-' (or corresponding uppercase variants). In those cases, as shown by the test digit-sep-pp-number.C added, this can result in valid code being wrongly rejected as a result of too many characters being included in the pp-number. So this case is fixed by terminating the pp-number at the correct character according to the standard. That test also covers the case where a digit separator was followed by an identifier-nondigit that is not a nondigit (e.g. a UCN); that case was already handled correctly. Bootstrapped with no regressions for x86_64-pc-linux-gnu. libcpp/ PR c++/83873 PR preprocessor/97604 * lex.c (lex_number): Reject adjacent digit separators here. Do not allow digit separators before '.' or an exponent with sign. * expr.c (cpp_classify_number): Do not check for adjacent digit separators here. gcc/testsuite/ PR c++/83873 PR preprocessor/97604 * g++.dg/cpp1y/digit-sep-neg-2.C, g++.dg/cpp1y/digit-sep-pp-number.C: New tests. * g++.dg/cpp1y/digit-sep-line-neg.C, g++.dg/cpp1y/digit-sep-neg.C: Adjust expected messages. --- gcc/testsuite/g++.dg/cpp1y/digit-sep-line-neg.C | 1 + gcc/testsuite/g++.dg/cpp1y/digit-sep-neg-2.C | 4 ++++ gcc/testsuite/g++.dg/cpp1y/digit-sep-neg.C | 3 ++- gcc/testsuite/g++.dg/cpp1y/digit-sep-pp-number.C | 17 +++++++++++++++++ 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp1y/digit-sep-neg-2.C create mode 100644 gcc/testsuite/g++.dg/cpp1y/digit-sep-pp-number.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp1y/digit-sep-line-neg.C b/gcc/testsuite/g++.dg/cpp1y/digit-sep-line-neg.C index fa3b135..239d028 100644 --- a/gcc/testsuite/g++.dg/cpp1y/digit-sep-line-neg.C +++ b/gcc/testsuite/g++.dg/cpp1y/digit-sep-line-neg.C @@ -2,3 +2,4 @@ // { dg-do preprocess { target c++14 } } #line 0''123 // { dg-error "is not a positive integer" } +// { dg-error "adjacent digit separators" "adjacent" { target *-*-* } .-1 } diff --git a/gcc/testsuite/g++.dg/cpp1y/digit-sep-neg-2.C b/gcc/testsuite/g++.dg/cpp1y/digit-sep-neg-2.C new file mode 100644 index 0000000..09393aa --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/digit-sep-neg-2.C @@ -0,0 +1,4 @@ +// Test adjacent digit separators rejected in exponent (bug 83873). +// { dg-do compile { target c++14 } } + +double d = 1.0e1''0; /* { dg-error "adjacent digit separators" } */ diff --git a/gcc/testsuite/g++.dg/cpp1y/digit-sep-neg.C b/gcc/testsuite/g++.dg/cpp1y/digit-sep-neg.C index 5343e52..300fe51 100644 --- a/gcc/testsuite/g++.dg/cpp1y/digit-sep-neg.C +++ b/gcc/testsuite/g++.dg/cpp1y/digit-sep-neg.C @@ -16,7 +16,7 @@ main() unsigned u = 0b0001'0000'0000'0000'0000'0000'U; // { dg-error "digit separator outside digit sequence" } double d = 0.0; - d = 1'.602'176'565e-19; // { dg-error "digit separator adjacent to decimal point" } + d = 1'.602'176'565e-19; // { dg-warning "multi-character" } d = 1.'602'176'565e-19; // { dg-error "digit separator adjacent to decimal point" } d = 1.602''176'565e-19; // { dg-error "adjacent digit separators" } d = 1.602'176'565'e-19; // { dg-error "digit separator adjacent to exponent" } @@ -29,4 +29,5 @@ main() // { dg-error "exponent has no digits" "exponent has no digits" { target *-*-* } 23 } // { dg-error "expected ';' before" "expected ';' before" { target *-*-* } 15 } +// { dg-error "expected ';' before" "expected ';' before" { target *-*-* } 19 } // { dg-error "expected ';' before" "expected ';' before" { target *-*-* } 26 } diff --git a/gcc/testsuite/g++.dg/cpp1y/digit-sep-pp-number.C b/gcc/testsuite/g++.dg/cpp1y/digit-sep-pp-number.C new file mode 100644 index 0000000..9777382 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/digit-sep-pp-number.C @@ -0,0 +1,17 @@ +// Test lexing of pp-numbers does not allow digit separators that do +// not form part of the pp-number syntax, when the code is valid with +// correct lexing but not with too many characters accepted in the +// pp-number (bug 97604). +// { dg-do compile { target c++14 } } + +static_assert (0x0'e-0xe == 0, "signs"); + +#define a0 '.' - +#define acat(x) a ## x +static_assert (acat (0'.') == 0, "."); + +// This case was not actually buggy. +#define c0(x) 0 +#define b0 c0 ( +#define bcat(x) b ## x +static_assert (bcat (0'\u00c0')) == 0, "identifier-nondigit"); -- cgit v1.1 From cfe82a0cbe72baa723f7d89502cdf59c0e87fff4 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 7 May 2021 00:16:33 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 62 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 70c5d50..dcd4752 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,65 @@ +2021-05-06 Joseph Myers + + PR c++/83873 + PR preprocessor/97604 + * g++.dg/cpp1y/digit-sep-neg-2.C, + g++.dg/cpp1y/digit-sep-pp-number.C: New tests. + * g++.dg/cpp1y/digit-sep-line-neg.C, g++.dg/cpp1y/digit-sep-neg.C: + Adjust expected messages. + +2021-05-06 Martin Jambor + + * gcc.dg/ipa/ipa-sra-1.c (main): Revert change done by + 05193687dde, make the argv again pointer to an array. + +2021-05-06 Eric Botcazou + + * gnat.dg/opt93.adb: Compile only for LP64 targets. + +2021-05-06 Robin Dapp + + * lib/target-supports.exp: Add s390 checks for vect conversions. + +2021-05-06 Robin Dapp + + * gcc.dg/vect/pr56541.c: Add vect_floatint_cvt. + +2021-05-06 Paul Thomas + + PR fortran/46691 + PR fortran/99819 + * gfortran.dg/class_dummy_6.f90: New test. + * gfortran.dg/class_dummy_7.f90: New test. + +2021-05-06 Christophe Lyon + + PR testsuite/100355 + * gcc.c-torture/execute/ieee/cdivchkld.x: New. + +2021-05-06 Marius Hillenbrand + + * gcc.target/s390/zvector/imm-range-error-1.c: Fix test for + __builtin_s390_vpdi. + * gcc.target/s390/zvector/vec-permi.c: New test for builtin + vec_permi. + +2021-05-06 Jakub Jelinek + + PR tree-optimization/94589 + * gcc.dg/pr94589-1.c: New test. + * gcc.dg/pr94589-2.c: New test. + * gcc.dg/pr94589-3.c: New test. + * gcc.dg/pr94589-4.c: New test. + * g++.dg/opt/pr94589-1.C: New test. + * g++.dg/opt/pr94589-2.C: New test. + * g++.dg/opt/pr94589-3.C: New test. + * g++.dg/opt/pr94589-4.C: New test. + +2021-05-06 Richard Biener + + PR ipa/100373 + * gcc.dg/pr100373.c: New testcase. + 2021-05-05 Eric Botcazou * gcc.c-torture/execute/20210505-1.c: New test. -- cgit v1.1 From 323b18d54b960d3ef64f60ad20838ef958334dc0 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 7 May 2021 10:37:52 +0200 Subject: i386: Fix up 8-byte vcond* with -mxop [PR100445] ix86_expand_sse_movcc has special TARGET_XOP handling and the recent addition of support of v*cond* patterns for MMXMODEI modes results in ICEs because the expected pattern doesn't exist. We can handle it using 128-bit vpcmov (if we ignore the upper 64 bits like we ignore in other TARGET_MMX_WITH_SSE support). 2021-05-07 Jakub Jelinek PR target/100445 * config/i386/mmx.md (*xop_pcmov_): New define_insn. * gcc.target/i386/pr100445.c: New test. --- gcc/testsuite/gcc.target/i386/pr100445.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr100445.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/i386/pr100445.c b/gcc/testsuite/gcc.target/i386/pr100445.c new file mode 100644 index 0000000..2f54fec --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr100445.c @@ -0,0 +1,12 @@ +/* PR target/100445 */ +/* { dg-do compile } */ +/* { dg-options "-O3 -mxop" } */ + +int a, b[3]; + +void +foo (void) +{ + for (; a < 3; a++) + b[a] = (a - 1) / 2; +} -- cgit v1.1 From 92f372f00936a549de2cb9764eee722bb07959ba Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Fri, 7 May 2021 11:15:07 +0200 Subject: i386: Do not emit mask compares for mode sizes < 16 [PR100445] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Recent addition of v*cond* patterns for MMXMODEI modes allows 64bit MMX modes to enter ix86_expand_sse_cmp. ix86_use_mask_cmp_p was not prepared to reject mode sizes < 16, resulting in ICE due to unavailability of 64bit masked PCOM instructions. 2021-05-07 UroÅ¡ Bizjak gcc/ PR target/100445 * config/i386/i386-expand.c (ix86_use_mask_cmp_p): Return false for mode sizes < 16. gcc/testsuite/ PR target/100445 * gcc.target/i386/pr100445-1.c: New test. --- gcc/testsuite/gcc.target/i386/pr100445-1.c | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr100445-1.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/i386/pr100445-1.c b/gcc/testsuite/gcc.target/i386/pr100445-1.c new file mode 100644 index 0000000..a1c18af --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr100445-1.c @@ -0,0 +1,5 @@ +/* PR target/100445 */ +/* { dg-do compile } */ +/* { dg-options "-O3 -mavx512vl" } */ + +#include "pr96827.c" -- cgit v1.1 From 170c850e4bd46745e2a5130b5eb09f9fceb98416 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 7 May 2021 17:48:37 +0200 Subject: libcpp: Fix up pragma preprocessing [PR100450] Since the r0-85991-ga25a8f3be322fe0f838947b679f73d6efc2a412c https://gcc.gnu.org/legacy-ml/gcc-patches/2008-02/msg01329.html changes, so that we handle macros inside of pragmas that should expand macros, during preprocessing we print those pragmas token by token, with CPP_PRAGMA printed as fputs ("#pragma ", print.outf); if (space) fprintf (print.outf, "%s %s", space, name); else fprintf (print.outf, "%s", name); where name is some identifier (so e.g. print #pragma omp parallel or #pragma omp for etc.). Because it ends in an identifier, we need to handle it like an identifier (i.e. CPP_NAME) for the decision whether a space needs to be emitted in between that #pragma whatever or #pragma whatever whatever and following token, otherwise the attached testcase is preprocessed as #pragma omp forreduction(+:red) rather than #pragma omp for reduction(+:red) The cpp_avoid_paste function is only called for this purpose. 2021-05-07 Jakub Jelinek PR c/100450 * lex.c (cpp_avoid_paste): Handle token1 CPP_PRAGMA like CPP_NAME. * c-c++-common/gomp/pr100450.c: New test. --- gcc/testsuite/c-c++-common/gomp/pr100450.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 gcc/testsuite/c-c++-common/gomp/pr100450.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/c-c++-common/gomp/pr100450.c b/gcc/testsuite/c-c++-common/gomp/pr100450.c new file mode 100644 index 0000000..a6d2a28 --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr100450.c @@ -0,0 +1,20 @@ +/* PR c/100450 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp -save-temps -Wunknown-pragmas" } */ + +#define TEST(T) { \ + {T} \ +} +#define CLAUSES reduction(+:red) +#define PARALLEL_FOR(X) TEST({ \ +_Pragma("omp for CLAUSES") \ +X \ +}) + +void foo() +{ + int red = 0; + int A[3] = {}; + #pragma omp parallel shared(red) + PARALLEL_FOR( for(int i=0; i < 3; i++) red += A[i]; ) +} -- cgit v1.1 From 601191b2a48cb8f4657bb2fa2270a7fde9d52e9c Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Fri, 7 May 2021 15:52:35 +0000 Subject: tree-optimization/79333 - fold stmts following SSA edges in VN copysign is only available with c99_runtime, skip ssa-fre-94.c otherwise. 2021-05-07 Christophe Lyon PR tree-optimization/79333 gcc/testsuite/ * gcc.dg/tree-ssa/ssa-fre-94.c: Require c99_runtime. --- gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-94.c | 1 + 1 file changed, 1 insertion(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-94.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-94.c index 92eebf6..99c7375 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-94.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-94.c @@ -1,5 +1,6 @@ /* PR tree-optimization/79333 */ /* { dg-do compile } */ +/* { dg-require-effective-target c99_runtime } */ /* { dg-options "-O -ffinite-math-only -fdump-tree-fre1" } */ extern __inline __attribute__ ((__always_inline__,__gnu_inline__)) -- cgit v1.1 From 14ed21f8749ae359690d9c4a69ca38cc45d0d1b0 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 4 May 2021 21:33:36 -0400 Subject: c++: don't call 'rvalue' in coroutines code A change to check glvalue_p rather than specifically for TARGET_EXPR revealed issues with the coroutines code's use of the 'rvalue' function, which shouldn't be used on class glvalues, so I've removed those calls. In build_co_await I just dropped them, because I don't see anything in the co_await specification that indicates that we would want to move from an lvalue result of operator co_await. And simplified that code while I was touching it; cp_build_modify_expr (...INIT_EXPR...) will call the constructor. In morph_fn_to_coro I changed the handling of the rvalue reference coroutine frame field to use move, to treat the rval ref as an xvalue. I used forward_parm to pass the function parms to the constructor for the field. And I simplified the return handling so we get the desired rvalue semantics from the normal implicit move on return. I question default-initializing the non-void return value of the function if get_return_object returns void; I'm not messing with it here, but I've filed PR100476 about it. gcc/cp/ChangeLog: * coroutines.cc (build_co_await): Don't call 'rvalue'. (flatten_await_stmt): Simplify initialization. (morph_fn_to_coro): Change 'rvalue' to 'move'. Simplify. gcc/testsuite/ChangeLog: * g++.dg/coroutines/coro-bad-gro-00-class-gro-scalar-return.C: Adjust diagnostic. --- .../g++.dg/coroutines/coro-bad-gro-00-class-gro-scalar-return.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/coroutines/coro-bad-gro-00-class-gro-scalar-return.C b/gcc/testsuite/g++.dg/coroutines/coro-bad-gro-00-class-gro-scalar-return.C index f9e8a5f..0512f03 100644 --- a/gcc/testsuite/g++.dg/coroutines/coro-bad-gro-00-class-gro-scalar-return.C +++ b/gcc/testsuite/g++.dg/coroutines/coro-bad-gro-00-class-gro-scalar-return.C @@ -37,7 +37,7 @@ my_coro (std::coroutine_handle<>& h) { PRINT ("coro1: about to return"); co_return; -} // { dg-error {'struct Thing' used where a 'int' was expected} } +} // { dg-error {cannot convert 'Thing' to 'int' in return} } int main () { -- cgit v1.1 From e2bc5b6c04df820017c497a2578bd3c4c7b6c89b Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Fri, 7 May 2021 20:44:36 +0200 Subject: Do not apply scalar storage order to pointer fields Pointer fields (and vector fields originally) were not really considered when the scalar_storage_order attribute, so they are swapped as well. As pointed out, this is problematic to describe in DWARF and probably not very useful in any case, so this pulls them out. gcc/ * doc/extend.texi (scalar_storage_order): Mention effect on pointer and vector fields. * tree.h (reverse_storage_order_for_component_p): Return false if the type is a pointer. gcc/c/ * c-typeck.c (build_unary_op) : Do not issue an error on the address of a pointer field in a record with reverse SSO. gcc/testsuite/ * gcc.dg/sso-12.c: New test. --- gcc/testsuite/gcc.dg/sso-12.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/sso-12.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/sso-12.c b/gcc/testsuite/gcc.dg/sso-12.c new file mode 100644 index 0000000..3bed280 --- /dev/null +++ b/gcc/testsuite/gcc.dg/sso-12.c @@ -0,0 +1,27 @@ +/* Test scalar_storage_order attribute and pointer fields */ + +/* { dg-do run } */ +/* { dg-options "-Wno-pedantic" } */ + +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ +struct __attribute__((scalar_storage_order("big-endian"))) Rec +{ + int *p; +}; +#else +struct __attribute__((scalar_storage_order("little-endian"))) Rec +{ + int *p; +}; +#endif + +int main (int argc) +{ + struct Rec r = { &argc }; + int *p = &argc; + + if (__builtin_memcmp (&r.p, &p, sizeof (int *)) != 0) + __builtin_abort (); + + return 0; +} -- cgit v1.1 From 7c4c9fcc0de865876fb25fe75f4ed6e143bd48c0 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Fri, 7 May 2021 22:52:18 +0200 Subject: Fix incorrect array bounds with -fgnat-encodings=minimal in DWARF This makes add_subscript_info query the get_array_descr_info hook for the actual information when it is defined. gcc/ * cfgexpand.c (expand_gimple_basic_block): Do not inherit a current location for the outgoing edges of an empty block. * dwarf2out.c (add_subscript_info): Retrieve the bounds and index type by means of the get_array_descr_info langhook, if it is set and returns true. Remove obsolete code dealing with unnamed subtypes. gcc/testsuite/ * gnat.dg/debug18.adb: New test. --- gcc/testsuite/gnat.dg/debug18.adb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 gcc/testsuite/gnat.dg/debug18.adb (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gnat.dg/debug18.adb b/gcc/testsuite/gnat.dg/debug18.adb new file mode 100644 index 0000000..59ba54d --- /dev/null +++ b/gcc/testsuite/gnat.dg/debug18.adb @@ -0,0 +1,20 @@ +-- { dg-do compile } +-- { dg-skip-if "No Dwarf" { { hppa*-*-hpux* } && { ! lp64 } } } +-- { dg-options "-cargs -O0 -g -dA -fgnat-encodings=minimal -margs" } + +procedure Debug18 is + + procedure Check (Size : Integer) is + type Bit_Array_Type is array (1 .. Size) of boolean; + pragma Pack (Bit_Array_Type); + + Bits : Bit_Array_Type := (others => False); + begin + Bits (Bits'First) := True; + end; + +begin + Check (Size => 9); +end; + +-- { dg-final { scan-assembler-not "DW_AT_lower_bound" } } -- cgit v1.1 From 62d87a321b29f9febdacc6220367021d98db3057 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 8 May 2021 00:16:27 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index dcd4752..80eb9a6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,36 @@ +2021-05-07 Eric Botcazou + + * gnat.dg/debug18.adb: New test. + +2021-05-07 Eric Botcazou + + * gcc.dg/sso-12.c: New test. + +2021-05-07 Jason Merrill + + * g++.dg/coroutines/coro-bad-gro-00-class-gro-scalar-return.C: + Adjust diagnostic. + +2021-05-07 Christophe Lyon + + PR tree-optimization/79333 + * gcc.dg/tree-ssa/ssa-fre-94.c: Require c99_runtime. + +2021-05-07 Jakub Jelinek + + PR c/100450 + * c-c++-common/gomp/pr100450.c: New test. + +2021-05-07 UroÅ¡ Bizjak + + PR target/100445 + * gcc.target/i386/pr100445-1.c: New test. + +2021-05-07 Jakub Jelinek + + PR target/100445 + * gcc.target/i386/pr100445.c: New test. + 2021-05-06 Joseph Myers PR c++/83873 -- cgit v1.1 From dddc07b4932a3b6e720cf32f0ff2ec2be356a8be Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Sat, 8 May 2021 09:49:38 +0200 Subject: Remove obsolete gcc.dg/sso-9.c gcc/testsuite/ * gcc.dg/sso-9.c: Delete. --- gcc/testsuite/gcc.dg/sso-9.c | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 gcc/testsuite/gcc.dg/sso-9.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/sso-9.c b/gcc/testsuite/gcc.dg/sso-9.c deleted file mode 100644 index 765f16a..0000000 --- a/gcc/testsuite/gcc.dg/sso-9.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Test support of scalar_storage_order attribute */ - -/* { dg-do compile } */ - -#include - -int x; - -#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -struct __attribute__((scalar_storage_order("big-endian"))) Rec -{ - va_list v; -}; -#else -struct __attribute__((scalar_storage_order("little-endian"))) Rec -{ - va_list v; -}; -#endif - -void foo (int i, ...) -{ - struct Rec a; - va_start (a.v, i); - a.v = 0, x = va_arg (a.v, int); /* { dg-error "type|reverse storage order" } */ - va_end (a.v); -} -- cgit v1.1 From 7920c05ce0b737da1abf644cf4b3fa862a1b3df1 Mon Sep 17 00:00:00 2001 From: Paul Thomas Date: Fri, 7 May 2021 19:52:40 +0100 Subject: Fortran: Correct PR number from 46691 [PR46991]. 2021-05-07 Paul Thomas gcc/testsuite/ChangeLog PR fortran/46991 * gfortran.dg/class_dummy_7.f90: Correct PR number. --- gcc/testsuite/gfortran.dg/class_dummy_7.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gfortran.dg/class_dummy_7.f90 b/gcc/testsuite/gfortran.dg/class_dummy_7.f90 index 9134268..107a4ab 100644 --- a/gcc/testsuite/gfortran.dg/class_dummy_7.f90 +++ b/gcc/testsuite/gfortran.dg/class_dummy_7.f90 @@ -1,6 +1,6 @@ ! { dg-do run } ! -! Test the fix for PR46691 - enable class assumed size arrays +! Test the fix for PR46991 - enable class assumed size arrays ! ! Reported by Tobias Burnus ! from http://j3-fortran.org/pipermail/j3/2010-December/004084.html -- cgit v1.1 From 56103737f1731616dfbe500fad2c0bb3cc084238 Mon Sep 17 00:00:00 2001 From: Paul Thomas Date: Sat, 8 May 2021 12:12:48 +0100 Subject: Correct ChangeLob entries for PR46991 --- gcc/testsuite/ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 80eb9a6..5e703da 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -59,7 +59,7 @@ 2021-05-06 Paul Thomas - PR fortran/46691 + PR fortran/46991 PR fortran/99819 * gfortran.dg/class_dummy_6.f90: New test. * gfortran.dg/class_dummy_7.f90: New test. -- cgit v1.1 From 5e0236d3b0e0d7ad98bcee36128433fa755b5558 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sun, 9 May 2021 00:16:29 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5e703da..15c14626 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2021-05-08 Paul Thomas + + PR fortran/46991 + * gfortran.dg/class_dummy_7.f90: Correct PR number. + +2021-05-08 Eric Botcazou + + * gcc.dg/sso-9.c: Delete. + 2021-05-07 Eric Botcazou * gnat.dg/debug18.adb: New test. -- cgit v1.1 From 7596c762137f26f495b53ec93471273887832e31 Mon Sep 17 00:00:00 2001 From: Alex Coplan Date: Mon, 10 May 2021 09:46:45 +0100 Subject: arm: Fix wrong code with MVE V2DImode loads and stores [PR99960] As the PR shows, we currently miscompile V2DImode loads and stores for MVE. We're currently using 64-bit loads/stores, but need to be using 128-bit vector loads and stores. Fixed thusly. Some intrinsics tests were checking that we (incorrectly) used the 64-bit loads/stores: these have been updated. gcc/ChangeLog: PR target/99960 * config/arm/mve.md (*mve_mov): Simplify output code. Use vldrw.u32 and vstrw.32 for V2D[IF]mode loads and stores. gcc/testsuite/ChangeLog: PR target/99960 * gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_s64.c: Update now that we're (correctly) using full 128-bit vector loads/stores. * gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_u64.c: Likewise. * gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_z_s64.c: Likewise. * gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_z_u64.c: Likewise. * gcc.target/arm/mve/intrinsics/vuninitializedq_int.c: Likewise. * gcc.target/arm/mve/intrinsics/vuninitializedq_int1.c: Likewise. --- .../gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_s64.c | 4 ++-- .../gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_u64.c | 4 ++-- .../gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_z_s64.c | 4 ++-- .../gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_z_u64.c | 4 ++-- gcc/testsuite/gcc.target/arm/mve/intrinsics/vuninitializedq_int.c | 3 +-- gcc/testsuite/gcc.target/arm/mve/intrinsics/vuninitializedq_int1.c | 3 +-- 6 files changed, 10 insertions(+), 12 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_s64.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_s64.c index 7420d01..a9b1f81 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_s64.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_s64.c @@ -11,6 +11,6 @@ foo (uint64x2_t * addr) } /* { dg-final { scan-assembler "vldrd.64\tq\[0-9\]+, \\\[q\[0-9\]+, #\[0-9\]+\\\]!" } } */ -/* { dg-final { scan-assembler-times "vldr.64" 1 } } */ -/* { dg-final { scan-assembler-times "vstr.64" 1 } } */ +/* { dg-final { scan-assembler-times "vldrw.u32" 1 } } */ +/* { dg-final { scan-assembler-times "vstrw.32" 1 } } */ /* { dg-final { scan-assembler-not "__ARM_undef" } } */ diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_u64.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_u64.c index ebe5b2f..e32a066 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_u64.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_u64.c @@ -11,6 +11,6 @@ foo (uint64x2_t * addr) } /* { dg-final { scan-assembler "vldrd.64\tq\[0-9\]+, \\\[q\[0-9\]+, #\[0-9\]+\\\]!" } } */ -/* { dg-final { scan-assembler-times "vldr.64" 1 } } */ -/* { dg-final { scan-assembler-times "vstr.64" 1 } } */ +/* { dg-final { scan-assembler-times "vldrw.u32" 1 } } */ +/* { dg-final { scan-assembler-times "vstrw.32" 1 } } */ /* { dg-final { scan-assembler-not "__ARM_undef" } } */ diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_z_s64.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_z_s64.c index 231a24a..bb06cf8 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_z_s64.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_z_s64.c @@ -10,6 +10,6 @@ int64x2_t foo (uint64x2_t * addr, mve_pred16_t p) /* { dg-final { scan-assembler "vpst" } } */ /* { dg-final { scan-assembler "vldrdt.u64\tq\[0-9\]+, \\\[q\[0-9\]+, #\[0-9\]+\\\]!" } } */ -/* { dg-final { scan-assembler-times "vldr.64" 1 } } */ -/* { dg-final { scan-assembler-times "vstr.64" 1 } } */ +/* { dg-final { scan-assembler-times "vldrw.u32" 1 } } */ +/* { dg-final { scan-assembler-times "vstrw.32" 1 } } */ /* { dg-final { scan-assembler-not "__ARM_undef" } } */ diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_z_u64.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_z_u64.c index b8d9b5c..558115d 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_z_u64.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_z_u64.c @@ -10,6 +10,6 @@ uint64x2_t foo (uint64x2_t * addr, mve_pred16_t p) /* { dg-final { scan-assembler "vpst" } } */ /* { dg-final { scan-assembler "vldrdt.u64\tq\[0-9\]+, \\\[q\[0-9\]+, #\[0-9\]+\\\]!" } } */ -/* { dg-final { scan-assembler-times "vldr.64" 1 } } */ -/* { dg-final { scan-assembler-times "vstr.64" 1 } } */ +/* { dg-final { scan-assembler-times "vldrw.u32" 1 } } */ +/* { dg-final { scan-assembler-times "vstrw.32" 1 } } */ /* { dg-final { scan-assembler-not "__ARM_undef" } } */ diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vuninitializedq_int.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vuninitializedq_int.c index bf6692f..cc5e635 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vuninitializedq_int.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vuninitializedq_int.c @@ -27,6 +27,5 @@ foo () /* { dg-final { scan-assembler-times "vstrb.8" 2 } } */ /* { dg-final { scan-assembler-times "vstrh.16" 2 } } */ -/* { dg-final { scan-assembler-times "vstrw.32" 2 } } */ -/* { dg-final { scan-assembler-times "vstr.64" 2 } } */ +/* { dg-final { scan-assembler-times "vstrw.32" 4 } } */ /* { dg-final { scan-assembler-not "__ARM_undef" } } */ diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vuninitializedq_int1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vuninitializedq_int1.c index 4f66a07..bfeb52b 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vuninitializedq_int1.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vuninitializedq_int1.c @@ -28,6 +28,5 @@ foo () /* { dg-final { scan-assembler-times "vstrb.8" 2 } } */ /* { dg-final { scan-assembler-times "vstrh.16" 2 } } */ -/* { dg-final { scan-assembler-times "vstrw.32" 2 } } */ -/* { dg-final { scan-assembler-times "vstr.64" 2 } } */ +/* { dg-final { scan-assembler-times "vstrw.32" 4 } } */ /* { dg-final { scan-assembler-not "__ARM_undef" } } */ -- cgit v1.1 From a564da506f52be66ade298b562417641e87b549f Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 5 May 2021 16:15:12 +0200 Subject: tree-optimization/100434 - DSE aggregate call LHS This makes DSE consider aggregate LHS of calls as dead, for pure or const calls the whole stmt and for others by removing the LHS. 2021-05-05 Richard Biener PR tree-optimization/100434 * tree-ssa-dse.c (initialize_ao_ref_for_dse): Handle call LHS. (dse_optimize_stmt): Handle call LHS by dropping the LHS or the whole call if it doesn't have other side-effects. (pass_dse::execute): Adjust. * gcc.dg/tree-ssa/ssa-dse-43.c: New testcase. --- gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-43.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-43.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-43.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-43.c new file mode 100644 index 0000000..f8785e9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-43.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-dse1-details" } */ + +struct X { int x; }; +struct X x; + +extern struct X foo (void); +void bar() +{ + x = foo(); + x = (struct X){}; +} + +extern struct X __attribute__((const)) foo2 (int); +void bar2() +{ + x = foo2 (1); + x = foo2 (2); +} + +/* { dg-final { scan-tree-dump-times "Deleted dead store in call LHS: x = foo " 1 "dse1" } } */ +/* { dg-final { scan-tree-dump-times "Deleted dead store: x = foo2 " 1 "dse1" } } */ -- cgit v1.1 From a076632e274abe344ca7648b7c7f299273d4cbe0 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Fri, 7 May 2021 09:51:18 +0200 Subject: middle-end/100464 - avoid spurious TREE_ADDRESSABLE in folding debug stmts canonicalize_constructor_val was setting TREE_ADDRESSABLE on bases of ADDR_EXPRs but that's futile when we're dealing with CTOR values in debug stmts. This rips out the code which was added for Java and should have been an assertion when we didn't have debug stmts. To not regress g++.dg/tree-ssa/array-temp1.C we have to adjust the testcase to not look for a no longer applied invalid optimization. 2021-05-10 Richard Biener PR middle-end/100464 PR c++/100468 gcc/ * gimple-fold.c (canonicalize_constructor_val): Do not set TREE_ADDRESSABLE. gcc/cp/ * call.c (set_up_extended_ref_temp): Mark the temporary addressable if the TARGET_EXPR was. gcc/testsuite/ * gcc.dg/pr100464.c: New testcase. * g++.dg/tree-ssa/array-temp1.C: Adjust. --- gcc/testsuite/g++.dg/tree-ssa/array-temp1.C | 6 ------ gcc/testsuite/gcc.dg/pr100464.c | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pr100464.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/tree-ssa/array-temp1.C b/gcc/testsuite/g++.dg/tree-ssa/array-temp1.C index 97c2e05..3df7aad 100644 --- a/gcc/testsuite/g++.dg/tree-ssa/array-temp1.C +++ b/gcc/testsuite/g++.dg/tree-ssa/array-temp1.C @@ -13,9 +13,3 @@ int f() using AR = const int[]; return AR{ 1,42,3,4,5,6,7,8,9,0 }[5]; } - -int g() -{ - std::initializer_list a = {1,42,3}; - return a.begin()[0]; -} diff --git a/gcc/testsuite/gcc.dg/pr100464.c b/gcc/testsuite/gcc.dg/pr100464.c new file mode 100644 index 0000000..46cc37df --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr100464.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -fcompare-debug" } */ + +int *a; +static int b, c, d, e, g, h; +int f; +void i() { + int *j[] = {&e, &b, &b, &d, &b, &b, &g, &e, &g, &b, &b, + &b, &b, &g, &e, &e, &b, &b, &d, &b, &b, &e, + &e, &g, &b, &b, &b, &b, &g, &e, &g, &c, &e}; + int **k = &j[5]; + for (; f;) + b |= *a; + *k = &h; +} +int main() {} -- cgit v1.1 From cc1d563887b1fe3183a21572b2ea63466b2bfa3a Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Mon, 10 May 2021 12:03:19 +0200 Subject: d: Fix qualifier ignored in alias definition if parentheses are not present Fixes regression where the qualifier was ignored in an alias definition if parentheses were not present. Reviewed-on: https://github.com/dlang/dmd/pull/12504 gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd b7d146c4c. --- gcc/testsuite/gdc.test/compilable/test21898.d | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 gcc/testsuite/gdc.test/compilable/test21898.d (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gdc.test/compilable/test21898.d b/gcc/testsuite/gdc.test/compilable/test21898.d new file mode 100644 index 0000000..9ac18b8 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test21898.d @@ -0,0 +1,7 @@ +// https://issues.dlang.org/show_bug.cgi?id=21898 + +alias Works(T) = immutable(T); +alias Fails(T) = immutable T; + +static assert(is(Works!int == immutable int)); +static assert(is(Fails!int == immutable int)); -- cgit v1.1 From 60af2db18013a0339302928ba98fee893ccc1957 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 10 May 2021 11:37:27 +0200 Subject: tree-optimization/100492 - avoid irreducible regions in loop distribution When we distribute away a condition we rely on the ability to change it to either 1 != 0 or 0 != 0 depending on the direction of the exit branch in the respective loop. But when the loop contains an irreducible sub-region then for the conditions inside this this fails and can lead to infinite loops being generated. Avoid distibuting loops with irreducible sub-regions. 2021-05-10 Richard Biener PR tree-optimization/100492 * tree-loop-distribution.c (find_seed_stmts_for_distribution): Find nothing when the loop contains an irreducible region. * gcc.dg/torture/pr100492.c: New testcase. --- gcc/testsuite/gcc.dg/torture/pr100492.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/torture/pr100492.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/torture/pr100492.c b/gcc/testsuite/gcc.dg/torture/pr100492.c new file mode 100644 index 0000000..75229c8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr100492.c @@ -0,0 +1,26 @@ +/* { dg-do run } */ +/* { dg-additional-options "-ftree-loop-distribution" } */ + +extern void abort (void); + +signed char a, c; +int b, d, *e = &d, g; +signed static char f; +int main() { + int h = 0; + int a_ = a; + for (; a_ < 1; a = ++a_) { + int *i[5], **j = &i[4], ***k[3][2] = {{&j}}, ****l = &k[2][1], *****m = &l; + char *n = &c; + f = *e = g = 0; + for (; g < 2; g++) { + for (b = 0; b < 3; b++) + h = (h && (*n = 0)) == 0; + if (g) + break; + } + } + if (f != 0) + abort (); + return 0; +} -- cgit v1.1 From cce4471bb45f72820eb6c15b4a75e67f704b209e Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 10 May 2021 13:22:03 +0200 Subject: testsuite/100452 - fix g++.dg/vect/slp-pr99971.cc This makes sure to align data so targets without unaligned accesses can vectorize it. 2021-05-10 Richard Biener PR testsuite/100452 * g++.dg/vect/slp-pr99971.cc: Align data. --- gcc/testsuite/g++.dg/vect/slp-pr99971.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/vect/slp-pr99971.cc b/gcc/testsuite/g++.dg/vect/slp-pr99971.cc index bec6418..cf22b33 100644 --- a/gcc/testsuite/g++.dg/vect/slp-pr99971.cc +++ b/gcc/testsuite/g++.dg/vect/slp-pr99971.cc @@ -22,7 +22,7 @@ struct A d -= that.d; return *this; } -}; +} __attribute__((aligned(__BIGGEST_ALIGNMENT__))); void test(A& x, A const& y1, A const& y2) { -- cgit v1.1 From 1f94ed3b4c308c9da7baf59ecbc0f953e994f9c4 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Sat, 8 May 2021 07:23:25 -0700 Subject: Add a test for PR tree-optimization/42587 PR tree-optimization/42587 * gcc.dg/optimize-bswapsi-6.c: New test. --- gcc/testsuite/gcc.dg/optimize-bswapsi-6.c | 38 +++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/optimize-bswapsi-6.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/optimize-bswapsi-6.c b/gcc/testsuite/gcc.dg/optimize-bswapsi-6.c new file mode 100644 index 0000000..3c089b3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/optimize-bswapsi-6.c @@ -0,0 +1,38 @@ +/* PR tree-optimization/42587 */ +/* { dg-do compile } */ +/* { dg-require-effective-target bswap } */ +/* { dg-options "-O2 -fdump-tree-store-merging" } */ +/* { dg-additional-options "-march=z900" { target s390-*-* } } */ + +typedef unsigned char u8; +typedef unsigned int u32; +union __anonunion_out_195 +{ + u32 value; + u8 bytes[4]; +}; +union __anonunion_in_196 +{ + u32 value; + u8 bytes[4]; +}; +extern void acpi_ut_track_stack_ptr (void); +u32 acpi_ut_dword_byte_swap (u32 value); +u32 +acpi_ut_dword_byte_swap (u32 value) +{ + union __anonunion_out_195 out; + union __anonunion_in_196 in; + + { + acpi_ut_track_stack_ptr (); + in.value = value; + out.bytes[0] = in.bytes[3]; + out.bytes[1] = in.bytes[2]; + out.bytes[2] = in.bytes[1]; + out.bytes[3] = in.bytes[0]; + return (out.value); + } +} + +/* { dg-final { scan-tree-dump "32 bit bswap implementation found at" "store-merging" } } */ -- cgit v1.1 From d83b0c6975523ce57f29ec5a081b5b2068bf02bf Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Mon, 10 May 2021 12:45:30 +0000 Subject: testsuite/arm: Add mve-vsub-scalar-1.c test This patchs adds a test similar to mve-vsub_1.c, but operates on a scalar as second argument. For the moment we do not select the T2 vsub variant operating on a scalar final argument, and we use vadd of the opposite. 2021-05-10 Christophe Lyon gcc/testsuite/ * gcc.target/arm/simd/mve-vsub-scalar-1.c: New test. --- .../gcc.target/arm/simd/mve-vsub-scalar-1.c | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 gcc/testsuite/gcc.target/arm/simd/mve-vsub-scalar-1.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-vsub-scalar-1.c b/gcc/testsuite/gcc.target/arm/simd/mve-vsub-scalar-1.c new file mode 100644 index 0000000..61a9a0e --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/simd/mve-vsub-scalar-1.c @@ -0,0 +1,47 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ +/* { dg-add-options arm_v8_1m_mve_fp } */ +/* { dg-additional-options "-O3" } */ + +#include + +#define FUNC_IMM(SIGN, TYPE, BITS, NB, OP, NAME) \ + void test_ ## NAME ##_ ## SIGN ## BITS ## x ## NB (TYPE##BITS##_t * __restrict__ dest, \ + TYPE##BITS##_t *a) { \ + int i; \ + for (i=0; i Date: Mon, 10 May 2021 12:50:48 +0000 Subject: testsuite/arm: Add mve-vmul-scalar-1.c test Support for vmul has been present for a while, but it was lacking a test for the scalar variant. This patch adds one, precisely noting that we do not yet use the T2 variants of vmul, which take a scalar as final argument. 2021-05-10 Christophe Lyon gcc/testsuite/ * gcc.target/arm/simd/mve-vmul-scalar-1.c: New. --- .../gcc.target/arm/simd/mve-vmul-scalar-1.c | 60 ++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 gcc/testsuite/gcc.target/arm/simd/mve-vmul-scalar-1.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-vmul-scalar-1.c b/gcc/testsuite/gcc.target/arm/simd/mve-vmul-scalar-1.c new file mode 100644 index 0000000..22be452 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/simd/mve-vmul-scalar-1.c @@ -0,0 +1,60 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ +/* { dg-add-options arm_v8_1m_mve_fp } */ +/* { dg-additional-options "-O3" } */ + +#include + +#define FUNC_IMM(SIGN, TYPE, BITS, NB, OP, NAME) \ + void test_ ## NAME ##_ ## SIGN ## BITS ## x ## NB (TYPE##BITS##_t * __restrict__ dest, \ + TYPE##BITS##_t *a) { \ + int i; \ + for (i=0; i Date: Mon, 10 May 2021 13:49:06 -0500 Subject: Add ALTIVEC_REGS as pressure class. Code that has heavy register pressure on Altivec registers can suffer from over-aggressive scheduling during sched1, which then leads to increased register spill. This is due to the fact that registers that prefer ALTIVEC_REGS are currently assigned an allocno class of VSX_REGS. This then misleads the scheduler to think there are 64 regs available, when in reality there are only 32 Altivec regs. This patch fixes the problem by assigning an allocno class of ALTIVEC_REGS and adding ALTIVEC_REGS as a pressure class. 2021-05-10 Pat Haugen gcc/ChangeLog: * config/rs6000/rs6000.c (rs6000_ira_change_pseudo_allocno_class): Return ALTIVEC_REGS if that is best_class. (rs6000_compute_pressure_classes): Add ALTIVEC_REGS. gcc/testsuite/ChangeLog: * gcc.target/powerpc/fold-vec-insert-float-p9.c: Adjust counts. * gcc.target/powerpc/vec-rlmi-rlnm.c: Likewise. --- gcc/testsuite/gcc.target/powerpc/fold-vec-insert-float-p9.c | 4 ++-- gcc/testsuite/gcc.target/powerpc/vec-rlmi-rlnm.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-float-p9.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-float-p9.c index 1c57672..4541768 100644 --- a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-float-p9.c +++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-float-p9.c @@ -31,5 +31,5 @@ testf_cst (float f, vector float vf) /* { dg-final { scan-assembler-times {\mstfs\M} 2 { target ilp32 } } } */ /* { dg-final { scan-assembler-times {\mlxv\M} 2 { target ilp32 } } } */ /* { dg-final { scan-assembler-times {\mlvewx\M} 1 { target ilp32 } } } */ -/* { dg-final { scan-assembler-times {\mvperm\M} 1 { target ilp32 } } } */ -/* { dg-final { scan-assembler-times {\mxxperm\M} 2 { target ilp32 } } } */ +/* { dg-final { scan-assembler-times {\mvperm\M} 2 { target ilp32 } } } */ +/* { dg-final { scan-assembler-times {\mxxperm\M} 1 { target ilp32 } } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/vec-rlmi-rlnm.c b/gcc/testsuite/gcc.target/powerpc/vec-rlmi-rlnm.c index 1e7d739..5512c0f 100644 --- a/gcc/testsuite/gcc.target/powerpc/vec-rlmi-rlnm.c +++ b/gcc/testsuite/gcc.target/powerpc/vec-rlmi-rlnm.c @@ -62,6 +62,6 @@ rlnm_test_2 (vector unsigned long long x, vector unsigned long long y, /* { dg-final { scan-assembler-times "vextsb2d" 1 } } */ /* { dg-final { scan-assembler-times "vslw" 1 } } */ /* { dg-final { scan-assembler-times "vsld" 1 } } */ -/* { dg-final { scan-assembler-times "xxlor" 3 } } */ +/* { dg-final { scan-assembler-times "xxlor" 2 } } */ /* { dg-final { scan-assembler-times "vrlwnm" 2 } } */ /* { dg-final { scan-assembler-times "vrldnm" 2 } } */ -- cgit v1.1 From f974b54b8a0c330e9dd2b43ebc940100d601df0f Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Mon, 10 May 2021 14:00:04 -0600 Subject: Avoid -Walloca-larger-than and -Wvla-larger-than false postives and negatives. Resolves: PR middle-end/100425 - missing -Walloca-larger-than with -O0 PR middle-end/100510 - bogus -Wvla-large-than with -Walloca gcc/ChangeLog: PR middle-end/100425 PR middle-end/100510 * gimple-ssa-warn-alloca.c (pass_walloca::firast_time_p): Rename... (pass_walloca::xlimit_certain_p): ...to this. (pass_walloca::gate): Execute for any kind of handled warning. (pass_walloca::execute): Avoid issuing "maybe" and "unbounded" warnings when xlimit_certain_p is set. gcc/testsuite/ChangeLog: PR middle-end/100425 PR middle-end/100510 * c-c++-common/Walloca-larger-than.C: New test. * gcc.dg/Walloca-larger-than-4.c: New test. * gcc.dg/Wvla-larger-than-5.c: New test. * gcc.dg/pr79972.c: Remove unexpected warning directive. --- gcc/testsuite/c-c++-common/Walloca-larger-than.C | 21 +++++++++++++ gcc/testsuite/gcc.dg/Walloca-larger-than-4.c | 18 +++++++++++ gcc/testsuite/gcc.dg/Wvla-larger-than-5.c | 38 ++++++++++++++++++++++++ gcc/testsuite/gcc.dg/pr79972.c | 3 +- 4 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/c-c++-common/Walloca-larger-than.C create mode 100644 gcc/testsuite/gcc.dg/Walloca-larger-than-4.c create mode 100644 gcc/testsuite/gcc.dg/Wvla-larger-than-5.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/c-c++-common/Walloca-larger-than.C b/gcc/testsuite/c-c++-common/Walloca-larger-than.C new file mode 100644 index 0000000..464ea24 --- /dev/null +++ b/gcc/testsuite/c-c++-common/Walloca-larger-than.C @@ -0,0 +1,21 @@ +/* PR middle-end/100425 - missing -Walloca-larger-than with -O0 + { dg-do compile } + { dg-options "-O0 -Wall -Walloca-larger-than=128" } */ + +typedef __SIZE_TYPE__ size_t; + +#if __cplusplus +extern "C" +#endif + +void* alloca (size_t); + +void sink (void*); + +void warn_alloca_too_large (void) +{ + sink (alloca (1)); + sink (alloca (128)); + sink (alloca (129)); // { dh-warning "\\\[-Walloca-larger-than" } + sink (alloca (1024)); // { dh-warning "\\\[-Walloca-larger-than" } +} diff --git a/gcc/testsuite/gcc.dg/Walloca-larger-than-4.c b/gcc/testsuite/gcc.dg/Walloca-larger-than-4.c new file mode 100644 index 0000000..9d4c4e8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/Walloca-larger-than-4.c @@ -0,0 +1,18 @@ +/* PR middle-end/100425 - missing -Walloca-larger-than with -O0 + { dg-do compile } + { dg-options "-O0 -Wall -Walloca-larger-than=128" } */ + +typedef __SIZE_TYPE__ size_t; + +void* alloca (size_t); + +void sink (void*); + +void warn_alloca_too_large (void) +{ + sink (alloca (1)); + sink (alloca (128)); + sink (alloca (129)); // { dg-warning "\\\[-Walloca-larger-than" } + sink (alloca (128 + 2)); // { dg-warning "\\\[-Walloca-larger-than" } + sink (alloca (1024)); // { dg-warning "\\\[-Walloca-larger-than" } +} diff --git a/gcc/testsuite/gcc.dg/Wvla-larger-than-5.c b/gcc/testsuite/gcc.dg/Wvla-larger-than-5.c new file mode 100644 index 0000000..c131f83 --- /dev/null +++ b/gcc/testsuite/gcc.dg/Wvla-larger-than-5.c @@ -0,0 +1,38 @@ +/* PR middle-end/100510 - bogus -Wvla-large-than with -Walloca + { dg-do compile } + { dg-options "-O0 -Walloca -Wvla-larger-than=1000" } */ + +void f (void*); + +#pragma GCC optimize ("0") + +void nowarn_O0 (__SIZE_TYPE__ n) +{ + if (n > 32) + return; + + char a[n]; // { dg-bogus "\\\[-Wvla-larger-than=" } + f (a); +} + +#pragma GCC optimize ("1") + +void nowarn_O1 (__SIZE_TYPE__ n) +{ + if (n > 33) + return; + + char a[n]; // { dg-bogus "\\\[-Wvla-larger-than=" } + f (a); +} + +#pragma GCC optimize ("2") + +void nowarn_O2 (__SIZE_TYPE__ n) +{ + if (n > 34) + return; + + char a[n]; // { dg-bogus "\\\[-Wvla-larger-than=" } + f (a); +} diff --git a/gcc/testsuite/gcc.dg/pr79972.c b/gcc/testsuite/gcc.dg/pr79972.c index 1d2b8be..4d3064f 100644 --- a/gcc/testsuite/gcc.dg/pr79972.c +++ b/gcc/testsuite/gcc.dg/pr79972.c @@ -6,7 +6,8 @@ int f (int dim, int *b, int *c) { - int newcentroid[3][dim]; /* { dg-warning "unbounded use of variable-length array" } */ + /* -Wvla-larger-than is only issued with optimization (see PR 100510). */ + int newcentroid[3][dim]; int *a = newcentroid[2]; int i, dist = 0; __builtin_memcpy (newcentroid, c, sizeof (newcentroid)); -- cgit v1.1 From ead233e6ff01c0bcaffce567ef656259fcc3530d Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Mon, 10 May 2021 17:41:01 +0200 Subject: Remove call to gcc_unreachable in range-op.cc The Ada testcase happens to stumble on the call to gcc_unreachable in operator_bitwise_xor::op1_range, but there is nothing wrong going on and it's safe to let it go through. gcc/ * range-op.cc (get_bool_state): Adjust head comment. (operator_not_equal::op1_range): Fix comment. (operator_bitwise_xor::op1_range): Remove call to gcc_unreachable. gcc/testsuite/ * gnat.dg/specs/opt5.ads: New test. * gnat.dg/specs/opt5_pkg.ads: New helper. --- gcc/testsuite/gnat.dg/specs/opt5.ads | 25 +++++++++++++++++++++++++ gcc/testsuite/gnat.dg/specs/opt5_pkg.ads | 17 +++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 gcc/testsuite/gnat.dg/specs/opt5.ads create mode 100644 gcc/testsuite/gnat.dg/specs/opt5_pkg.ads (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gnat.dg/specs/opt5.ads b/gcc/testsuite/gnat.dg/specs/opt5.ads new file mode 100644 index 0000000..09b8db5 --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/opt5.ads @@ -0,0 +1,25 @@ +-- { dg-do compile } +-- { dg-options "-O2 -gnata -gnatVa" } + +with Opt5_Pkg; + +package Opt5 is + + type Object is new Opt5_Pkg.Object with private; + + Undefined : constant Object; + + overriding function Is_Defined (Self : Object) return Boolean; + + function Create (Sloc : Opt5_Pkg.Object) return Integer is (0) + with Pre => Sloc.Is_Defined; + +private + + type Object is new Opt5_Pkg.Object with null record; + + Undefined : constant Object := (Opt5_Pkg.Undefined with others => <>); + + overriding function Is_Defined (Self : Object) return Boolean is (Self /= Undefined); + +end Opt5; diff --git a/gcc/testsuite/gnat.dg/specs/opt5_pkg.ads b/gcc/testsuite/gnat.dg/specs/opt5_pkg.ads new file mode 100644 index 0000000..a549f08 --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/opt5_pkg.ads @@ -0,0 +1,17 @@ +package Opt5_Pkg is + + type Object is tagged private; + + Undefined : constant Object; + + function Is_Defined (Self : Object) return Boolean; + +private + + type Object is tagged null record; + + Undefined : constant Object := (others => <>); + + function Is_Defined (Self : Object) return Boolean is (Self /= Undefined); + +end Opt5_Pkg; -- cgit v1.1 From aa891c56f25baac94db004e309d1b6e40b770a95 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 11 May 2021 00:16:36 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 70 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 15c14626..75e235b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,73 @@ +2021-05-10 Eric Botcazou + + * gnat.dg/specs/opt5.ads: New test. + * gnat.dg/specs/opt5_pkg.ads: New helper. + +2021-05-10 Martin Sebor + + PR middle-end/100425 + PR middle-end/100510 + * c-c++-common/Walloca-larger-than.C: New test. + * gcc.dg/Walloca-larger-than-4.c: New test. + * gcc.dg/Wvla-larger-than-5.c: New test. + * gcc.dg/pr79972.c: Remove unexpected warning directive. + +2021-05-10 Pat Haugen + + * gcc.target/powerpc/fold-vec-insert-float-p9.c: Adjust counts. + * gcc.target/powerpc/vec-rlmi-rlnm.c: Likewise. + +2021-05-10 Christophe Lyon + + * gcc.target/arm/simd/mve-vmul-scalar-1.c: New. + +2021-05-10 Christophe Lyon + + * gcc.target/arm/simd/mve-vsub-scalar-1.c: New test. + +2021-05-10 H.J. Lu + + PR tree-optimization/42587 + * gcc.dg/optimize-bswapsi-6.c: New test. + +2021-05-10 Richard Biener + + PR testsuite/100452 + * g++.dg/vect/slp-pr99971.cc: Align data. + +2021-05-10 Richard Biener + + PR tree-optimization/100492 + * gcc.dg/torture/pr100492.c: New testcase. + +2021-05-10 Richard Biener + + PR middle-end/100464 + PR c++/100468 + * gcc.dg/pr100464.c: New testcase. + * g++.dg/tree-ssa/array-temp1.C: Adjust. + +2021-05-10 Richard Biener + + PR tree-optimization/100434 + * gcc.dg/tree-ssa/ssa-dse-43.c: New testcase. + +2021-05-10 Alex Coplan + + PR target/99960 + * gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_s64.c: + Update now that we're (correctly) using full 128-bit vector + loads/stores. + * gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_u64.c: + Likewise. + * gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_z_s64.c: + Likewise. + * gcc.target/arm/mve/intrinsics/vldrdq_gather_base_wb_z_u64.c: + Likewise. + * gcc.target/arm/mve/intrinsics/vuninitializedq_int.c: Likewise. + * gcc.target/arm/mve/intrinsics/vuninitializedq_int1.c: + Likewise. + 2021-05-08 Paul Thomas PR fortran/46991 -- cgit v1.1 From e7a9f085ffd34b0d7bc4b803c182b41494f609aa Mon Sep 17 00:00:00 2001 From: Patrick Palka Date: Mon, 10 May 2021 22:33:04 -0400 Subject: c++: fn parm pack expansion inside constraint [PR100138] This PR is about CTAD but the underlying problems are more general; CTAD is a good trigger for them because of the necessary substitution into constraints that deduction guide generation entails. In the testcase below, when generating the implicit deduction guide for the constrained constructor template for A, we substitute the generic flattening map 'tsubst_args' into the constructor's constraints. During this substitution, tsubst_pack_expansion returns a rebuilt pack expansion for sizeof...(xs), but doesn't carry over the PACK_EXPANSION_LOCAL_P (and PACK_EXPANSION_SIZEOF_P) flag from the original tree to the rebuilt one. The flag is otherwise unset on the original tree but gets set for the rebuilt tree from make_pack_expansion since at_function_scope_p() is true (we're inside main). This leads to a crash during satisfaction when substituting into the pack expansion because we don't have local_specializations set up (and it'd be set up for us if PACK_EXPANSION_LOCAL_P is unset) Similarly, tsubst_constraint needs to set cp_unevaluated so that the substitution performed therein doesn't rely on local_specializations. This avoids a crash during CTAD for C below. gcc/cp/ChangeLog: PR c++/100138 * constraint.cc (tsubst_constraint): Set up cp_unevaluated. (satisfy_atom): Set up iloc_sentinel before calling cxx_constant_value. * pt.c (tsubst_pack_expansion): When returning a rebuilt pack expansion, carry over PACK_EXPANSION_LOCAL_P and PACK_EXPANSION_SIZEOF_P from the original pack expansion. gcc/testsuite/ChangeLog: PR c++/100138 * g++.dg/cpp2a/concepts-ctad4.C: New test. --- gcc/testsuite/g++.dg/cpp2a/concepts-ctad4.C | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp2a/concepts-ctad4.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-ctad4.C b/gcc/testsuite/g++.dg/cpp2a/concepts-ctad4.C new file mode 100644 index 0000000..4f04cb3 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/concepts-ctad4.C @@ -0,0 +1,25 @@ +// PR c++/100138 +// { dg-do compile { target c++20 } } + +template +struct A { + A(T, auto... xs) requires (sizeof...(xs) != 0); +}; + +constexpr bool f(...) { return true; } + +template +struct B { + B(T, auto... xs) requires (f(xs...)); // { dg-error "constant expression" } +}; + +template +struct C { + C(T, auto x) requires (f(x)); // { dg-error "constant expression" } +}; + +int main() { + A x{1, 2}; // { dg-bogus "" } + B y{1, 2}; // { dg-error "deduction|no match" } + C z{1, 2}; // { dg-error "deduction|no match" } +} -- cgit v1.1 From 6ab1176667734bd6de20833f8d263c03a418c452 Mon Sep 17 00:00:00 2001 From: Patrick Palka Date: Mon, 10 May 2021 22:38:34 -0400 Subject: c++: dependent operator expression lookup [PR51577] This unconditionally enables the maybe_save_operator_binding mechanism for all function templates, so that when resolving a dependent operator expression from a function template we ignore later-declared namespace-scope bindings that weren't visible at template definition time. This patch additionally makes the mechanism apply to dependent comma and compound-assignment operator expressions. Note that this doesn't fix the testcases in PR83035 or PR99692 because there the dependent operator expressions aren't at function scope. I'm not sure how adapt this mechanism for these testcases, since although we'll in both testcases have a TEMPLATE_DECL to associate the lookup result with, at instantiation time we won't have an appropriate binding level to push to. gcc/cp/ChangeLog: PR c++/51577 * name-lookup.c (maybe_save_operator_binding): Unconditionally enable for all function templates, not just generic lambdas. Handle compound-assignment operator expressions. * typeck.c (build_x_compound_expr): Call maybe_save_operator_binding in the type-dependent case. (build_x_modify_expr): Likewise. Move declaration of 'op' closer to its first use. gcc/testsuite/ChangeLog: PR c++/51577 * g++.dg/lookup/operator-3.C: New test. --- gcc/testsuite/g++.dg/lookup/operator-3.C | 109 +++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 gcc/testsuite/g++.dg/lookup/operator-3.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/lookup/operator-3.C b/gcc/testsuite/g++.dg/lookup/operator-3.C new file mode 100644 index 0000000..bc5eb3d --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/operator-3.C @@ -0,0 +1,109 @@ +// PR c++/51577 + +template void f (T x) { + +x; // { dg-error "no match" } + -x; // { dg-error "no match" } + *x; // { dg-error "no match" } + ~x; // { dg-error "no match" } + &x; + !x; // { dg-error "no match" } + ++x; // { dg-error "no match" } + --x; // { dg-error "no match" } + x++; // { dg-error "declared for postfix" } + x--; // { dg-error "declared for postfix" } + + x->*x; // { dg-error "no match" } + x / x; // { dg-error "no match" } + x * x; // { dg-error "no match" } + x + x; // { dg-error "no match" } + x - x; // { dg-error "no match" } + x % x; // { dg-error "no match" } + x & x; // { dg-error "no match" } + x | x; // { dg-error "no match" } + x ^ x; // { dg-error "no match" } + x << x; // { dg-error "no match" } + x >> x; // { dg-error "no match" } + x && x; // { dg-error "no match" } + x || x; // { dg-error "no match" } + x, x; + + x == x; // { dg-error "no match" } + x != x; // { dg-error "no match" } + x < x; // { dg-error "no match" } + x > x; // { dg-error "no match" } + x <= x; // { dg-error "no match" } + x >= x; // { dg-error "no match" } +#if __cplusplus > 201703L + x <=> x; // { dg-error "no match" "" { target c++20 } } +#endif + + x += x; // { dg-error "no match" } + x -= x; // { dg-error "no match" } + x *= x; // { dg-error "no match" } + x /= x; // { dg-error "no match" } + x %= x; // { dg-error "no match" } + x |= x; // { dg-error "no match" } + x ^= x; // { dg-error "no match" } + x <<= x; // { dg-error "no match" } + x >>= x; // { dg-error "no match" } +} + +namespace N { struct A { }; } + +void operator+(N::A); +void operator-(N::A); +void operator*(N::A); +void operator~(N::A); +#if __cplusplus >= 201103L +void operator&(N::A) = delete; +#else +void operator&(N::A); +#endif +void operator!(N::A); +void operator++(N::A); +void operator--(N::A); +void operator++(N::A, int); +void operator--(N::A, int); + +void operator->*(N::A, N::A); +void operator/(N::A, N::A); +void operator*(N::A, N::A); +void operator+(N::A, N::A); +void operator-(N::A, N::A); +void operator%(N::A, N::A); +void operator&(N::A, N::A); +void operator|(N::A, N::A); +void operator^(N::A, N::A); +void operator<<(N::A, N::A); +void operator>>(N::A, N::A); +void operator&&(N::A, N::A); +void operator||(N::A, N::A); +#if __cplusplus >= 201103L +void operator,(N::A, N::A) = delete; +#else +void operator,(N::A, N::A); +#endif + +void operator==(N::A, N::A); +void operator!=(N::A, N::A); +void operator<(N::A, N::A); +void operator>(N::A, N::A); +void operator<=(N::A, N::A); +void operator>=(N::A, N::A); +#if __cplusplus > 201703L +void operator<=>(N::A, N::A); +#endif + +void operator+=(N::A, N::A); +void operator-=(N::A, N::A); +void operator*=(N::A, N::A); +void operator/=(N::A, N::A); +void operator%=(N::A, N::A); +void operator|=(N::A, N::A); +void operator^=(N::A, N::A); +void operator<<=(N::A, N::A); +void operator>>=(N::A, N::A); + +int main() { + f(N::A()); +} -- cgit v1.1 From cf43636a74a028daf2024b33d1915274a2ff9655 Mon Sep 17 00:00:00 2001 From: Robin Dapp Date: Tue, 11 May 2021 09:50:44 +0200 Subject: testsuite/s390: Fix risbg-ll-3.c f2_cconly test. Instead of selecting bits 62 to (wraparound) 59 from r2 and inserting them into r3, we select bits 60 to 62 from r3 and insert them into r2 nowadays. Adjust the test accordingly. gcc/testsuite/ChangeLog: * gcc.target/s390/risbg-ll-3.c: Change match pattern. --- gcc/testsuite/gcc.target/s390/risbg-ll-3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/s390/risbg-ll-3.c b/gcc/testsuite/gcc.target/s390/risbg-ll-3.c index 90d37f2..864b0d6 100644 --- a/gcc/testsuite/gcc.target/s390/risbg-ll-3.c +++ b/gcc/testsuite/gcc.target/s390/risbg-ll-3.c @@ -37,7 +37,7 @@ i64 f2 (i64 v_a, i64 v_b) void f2_bar (); void f2_cconly (i64 v_a, i64 v_b) { -/* { dg-final { scan-assembler "f2_cconly:\n\trisbg\t%r3,%r2,63,59,0\n\tber\t%r14\n\tjg\tf2_bar\n" { target { lp64 } } } } */ +/* { dg-final { scan-assembler "f2_cconly:\n\trisbg\t%r2,%r3,60,62,0\n\tber\t%r14\n\tjg\tf2_bar\n" { target { lp64 } } } } */ /* { dg-final { scan-assembler "f2_cconly:\n\trisbgn\t%r3,%r2,0,0\\\+32-1,64-0-32\n\trisbg\t%r3,%r5,60,62,0\n\tber\t%r14\n\tjg\tf2_bar\n" { target { ! lp64 } } } } */ if ((v_a & -15) | (v_b & 14)) f2_bar(); -- cgit v1.1 From ca8e8301180fa71de1a76769fc038df2ab85dfeb Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 11 May 2021 10:58:35 +0200 Subject: middle-end/100509 - avoid folding constant to aggregate type When folding a constant initializer looking through aliases to incompatible types can lead to us trying to fold a constant to an aggregate type which can't work. Simply avoid trying to constant fold non-register typed symbols. 2021-05-11 Richard Biener PR middle-end/100509 * gimple-fold.c (fold_gimple_assign): Only call get_symbol_constant_value on register type symbols. * gcc.dg/pr100509.c: New testcase. --- gcc/testsuite/gcc.dg/pr100509.c | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr100509.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/pr100509.c b/gcc/testsuite/gcc.dg/pr100509.c new file mode 100644 index 0000000..9405e2a --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr100509.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-O" } */ + +struct X { + int a; +}; +const int a = 0; +static struct X A __attribute__((alias("a"))); +void foo() { struct X b = A; } -- cgit v1.1 From 28de75d27685b2735612d264bb96f39001f4d836 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Tue, 11 May 2021 12:17:33 +0100 Subject: aarch64: A couple of mul_laneq tweaks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch removes the duplication between the mul_laneq3 and the older mul-lane patterns. The older patterns were previously divided into two based on whether the indexed operand had the same mode as the other operands or whether it had the opposite length from the other operands (64-bit vs. 128-bit). However, it seemed easier to divide them instead based on whether the indexed operand was 64-bit or 128-bit, since that maps directly to the arm_neon.h “q†conventions. Also, it looks like the older patterns were missing cases for V8HF<->V4HF combinations, which meant that vmul_laneq_f16 and vmulq_lane_f16 didn't produce single instructions. There was a typo in the V2SF entry for VCONQ, but in practice no patterns were using that entry until now. The test passes for both endiannesses, but endianness does change the mapping between regexps and functions. gcc/ * config/aarch64/iterators.md (VMUL_CHANGE_NLANES): Delete. (VMULD): New iterator. (VCOND): Handle V4HF and V8HF. (VCONQ): Fix entry for V2SF. * config/aarch64/aarch64-simd.md (mul_lane3): Use VMULD instead of VMUL. Use a 64-bit vector mode for the indexed operand. (*aarch64_mul3_elt_): Merge with... (mul_laneq3): ...this define_insn. Use VMUL instead of VDQSF. Use a 128-bit vector mode for the indexed operand. Use stype for the scheduling type. gcc/testsuite/ * gcc.target/aarch64/fmul_lane_1.c: New test. --- gcc/testsuite/gcc.target/aarch64/fmul_lane_1.c | 59 ++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 gcc/testsuite/gcc.target/aarch64/fmul_lane_1.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/aarch64/fmul_lane_1.c b/gcc/testsuite/gcc.target/aarch64/fmul_lane_1.c new file mode 100644 index 0000000..a2b5758 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/fmul_lane_1.c @@ -0,0 +1,59 @@ +/* { dg-options "-O" } */ + +#pragma GCC target "+simd+fp16" + +__Float16x4_t +f1 (__Float16x4_t x, __Float16x4_t y) +{ + return x * y[0]; +} + +__Float16x4_t +f2 (__Float16x4_t x, __Float16x4_t y) +{ + return x * y[3]; +} + +__Float16x4_t +f3 (__Float16x4_t x, __Float16x8_t y) +{ + return x * y[0]; +} + +__Float16x4_t +f4 (__Float16x4_t x, __Float16x8_t y) +{ + return x * y[7]; +} + +__Float16x8_t +f5 (__Float16x8_t x, __Float16x4_t y) +{ + return x * y[0]; +} + +__Float16x8_t +f6 (__Float16x8_t x, __Float16x4_t y) +{ + return x * y[3]; +} + +__Float16x8_t +f7 (__Float16x8_t x, __Float16x8_t y) +{ + return x * y[0]; +} + +__Float16x8_t +f8 (__Float16x8_t x, __Float16x8_t y) +{ + return x * y[7]; +} + +/* { dg-final { scan-assembler-times {\tfmul\tv0.4h, v0.4h, v1.h\[0\]} 2 } } */ +/* { dg-final { scan-assembler-times {\tfmul\tv0.4h, v0.4h, v1.h\[3\]} 1 } } */ +/* { dg-final { scan-assembler-times {\tfmul\tv0.4h, v0.4h, v1.h\[7\]} 1 } } */ + +/* { dg-final { scan-assembler-times {\tfmul\tv0.8h, v0.8h, v1.h\[0\]} 2 } } */ +/* { dg-final { scan-assembler-times {\tfmul\tv0.8h, v0.8h, v1.h\[3\]} 1 } } */ +/* { dg-final { scan-assembler-times {\tfmul\tv0.8h, v0.8h, v1.h\[7\]} 1 } } */ -- cgit v1.1 From 2ac1f0eb3887335b7a7e845812956fa436e72a91 Mon Sep 17 00:00:00 2001 From: Alex Coplan Date: Tue, 11 May 2021 13:11:09 +0100 Subject: arm: Avoid emitting bogus CFA adjusts for CMSE nonsecure calls [PR99725] The PR shows us attaching REG_CFA_ADJUST_CFA notes to stack pointer adjustments emitted in cmse_nonsecure_call_inline_register_clear (when -march=armv8.1-m.main). However, the stack pointer is not guaranteed to be the CFA reg. If we're at -O0 or we have -fno-omit-frame-pointer, then the frame pointer will be used as the CFA reg, and these notes on the sp adjustments will lead to ICEs in dwarf2out_frame_debug_adjust_cfa. This patch avoids emitting these notes if the current function has a frame pointer. gcc/ChangeLog: PR target/99725 * config/arm/arm.c (cmse_nonsecure_call_inline_register_clear): Avoid emitting CFA adjusts on the sp if we have the fp. gcc/testsuite/ChangeLog: PR target/99725 * gcc.target/arm/cmse/pr99725.c: New test. --- gcc/testsuite/gcc.target/arm/cmse/pr99725.c | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 gcc/testsuite/gcc.target/arm/cmse/pr99725.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/arm/cmse/pr99725.c b/gcc/testsuite/gcc.target/arm/cmse/pr99725.c new file mode 100644 index 0000000..284da18 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/cmse/pr99725.c @@ -0,0 +1,5 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-mcmse -g" } */ +typedef int __attribute__((cmse_nonsecure_call)) (*t)(); +t f; +void g() { f(); } -- cgit v1.1 From 900b1c27b963c8244c7547943d4a8d03dfacc6f4 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Thu, 11 Mar 2021 16:13:24 +0100 Subject: Remove BRIG front-end. gcc/ada/ChangeLog: * gcc-interface/ada-tree.h (BUILT_IN_LIKELY): Use builtins from COROUTINES. (BUILT_IN_UNLIKELY): Likewise. gcc/ChangeLog: * builtins.def (DEF_HSAIL_BUILTIN): Remove. (DEF_HSAIL_ATOMIC_BUILTIN): Likewise. (DEF_HSAIL_SAT_BUILTIN): Likewise. (DEF_HSAIL_INTR_BUILTIN): Likewise. (DEF_HSAIL_CVT_ZEROI_SAT_BUILTIN): Likewise. * doc/frontends.texi: Remove BRIG. * doc/install.texi: Likewise. * doc/invoke.texi: Likewise. * doc/standards.texi: Likewise. * brig-builtins.def: Removed. * brig/ChangeLog: Removed. * brig/Make-lang.in: Removed. * brig/brig-builtins.h: Removed. * brig/brig-c.h: Removed. * brig/brig-lang.c: Removed. * brig/brigfrontend/brig-arg-block-handler.cc: Removed. * brig/brigfrontend/brig-atomic-inst-handler.cc: Removed. * brig/brigfrontend/brig-basic-inst-handler.cc: Removed. * brig/brigfrontend/brig-branch-inst-handler.cc: Removed. * brig/brigfrontend/brig-cmp-inst-handler.cc: Removed. * brig/brigfrontend/brig-code-entry-handler.cc: Removed. * brig/brigfrontend/brig-code-entry-handler.h: Removed. * brig/brigfrontend/brig-comment-handler.cc: Removed. * brig/brigfrontend/brig-control-handler.cc: Removed. * brig/brigfrontend/brig-copy-move-inst-handler.cc: Removed. * brig/brigfrontend/brig-cvt-inst-handler.cc: Removed. * brig/brigfrontend/brig-fbarrier-handler.cc: Removed. * brig/brigfrontend/brig-function-handler.cc: Removed. * brig/brigfrontend/brig-function.cc: Removed. * brig/brigfrontend/brig-function.h: Removed. * brig/brigfrontend/brig-inst-mod-handler.cc: Removed. * brig/brigfrontend/brig-label-handler.cc: Removed. * brig/brigfrontend/brig-lane-inst-handler.cc: Removed. * brig/brigfrontend/brig-machine.c: Removed. * brig/brigfrontend/brig-machine.h: Removed. * brig/brigfrontend/brig-mem-inst-handler.cc: Removed. * brig/brigfrontend/brig-module-handler.cc: Removed. * brig/brigfrontend/brig-queue-inst-handler.cc: Removed. * brig/brigfrontend/brig-seg-inst-handler.cc: Removed. * brig/brigfrontend/brig-signal-inst-handler.cc: Removed. * brig/brigfrontend/brig-to-generic.cc: Removed. * brig/brigfrontend/brig-to-generic.h: Removed. * brig/brigfrontend/brig-util.cc: Removed. * brig/brigfrontend/brig-util.h: Removed. * brig/brigfrontend/brig-variable-handler.cc: Removed. * brig/brigfrontend/hsa-brig-format.h: Removed. * brig/brigfrontend/phsa.h: Removed. * brig/brigspec.c: Removed. * brig/config-lang.in: Removed. * brig/gccbrig.texi: Removed. * brig/lang-specs.h: Removed. * brig/lang.opt: Removed. gcc/testsuite/ChangeLog: * gfortran.dg/goacc/pr78027.f90: Remove -Wno-hsa option. * brig.dg/README: Removed. * brig.dg/dg.exp: Removed. * brig.dg/test/gimple/alloca.hsail: Removed. * brig.dg/test/gimple/atomics.hsail: Removed. * brig.dg/test/gimple/branches.hsail: Removed. * brig.dg/test/gimple/fbarrier.hsail: Removed. * brig.dg/test/gimple/function_calls.hsail: Removed. * brig.dg/test/gimple/internal-casts.hsail: Removed. * brig.dg/test/gimple/kernarg.hsail: Removed. * brig.dg/test/gimple/mem.hsail: Removed. * brig.dg/test/gimple/mulhi.hsail: Removed. * brig.dg/test/gimple/packed.hsail: Removed. * brig.dg/test/gimple/priv-array-offset-access.hsail: Removed. * brig.dg/test/gimple/smoke_test.hsail: Removed. * brig.dg/test/gimple/variables.hsail: Removed. * brig.dg/test/gimple/vector.hsail: Removed. * lib/brig-dg.exp: Removed. * lib/brig.exp: Removed. --- gcc/testsuite/brig.dg/README | 12 -- gcc/testsuite/brig.dg/dg.exp | 31 ----- gcc/testsuite/brig.dg/test/gimple/alloca.hsail | 37 ------ gcc/testsuite/brig.dg/test/gimple/atomics.hsail | 33 ----- gcc/testsuite/brig.dg/test/gimple/branches.hsail | 58 -------- gcc/testsuite/brig.dg/test/gimple/fbarrier.hsail | 74 ----------- .../brig.dg/test/gimple/function_calls.hsail | 59 --------- .../brig.dg/test/gimple/internal-casts.hsail | 146 --------------------- gcc/testsuite/brig.dg/test/gimple/kernarg.hsail | 25 ---- gcc/testsuite/brig.dg/test/gimple/mem.hsail | 39 ------ gcc/testsuite/brig.dg/test/gimple/mulhi.hsail | 33 ----- gcc/testsuite/brig.dg/test/gimple/packed.hsail | 76 ----------- .../test/gimple/priv-array-offset-access.hsail | 87 ------------ gcc/testsuite/brig.dg/test/gimple/smoke_test.hsail | 91 ------------- gcc/testsuite/brig.dg/test/gimple/variables.hsail | 125 ------------------ gcc/testsuite/brig.dg/test/gimple/vector.hsail | 57 -------- gcc/testsuite/gfortran.dg/goacc/pr78027.f90 | 4 - gcc/testsuite/lib/brig-dg.exp | 29 ---- gcc/testsuite/lib/brig.exp | 40 ------ 19 files changed, 1056 deletions(-) delete mode 100644 gcc/testsuite/brig.dg/README delete mode 100644 gcc/testsuite/brig.dg/dg.exp delete mode 100644 gcc/testsuite/brig.dg/test/gimple/alloca.hsail delete mode 100644 gcc/testsuite/brig.dg/test/gimple/atomics.hsail delete mode 100644 gcc/testsuite/brig.dg/test/gimple/branches.hsail delete mode 100644 gcc/testsuite/brig.dg/test/gimple/fbarrier.hsail delete mode 100644 gcc/testsuite/brig.dg/test/gimple/function_calls.hsail delete mode 100644 gcc/testsuite/brig.dg/test/gimple/internal-casts.hsail delete mode 100644 gcc/testsuite/brig.dg/test/gimple/kernarg.hsail delete mode 100644 gcc/testsuite/brig.dg/test/gimple/mem.hsail delete mode 100644 gcc/testsuite/brig.dg/test/gimple/mulhi.hsail delete mode 100644 gcc/testsuite/brig.dg/test/gimple/packed.hsail delete mode 100644 gcc/testsuite/brig.dg/test/gimple/priv-array-offset-access.hsail delete mode 100644 gcc/testsuite/brig.dg/test/gimple/smoke_test.hsail delete mode 100644 gcc/testsuite/brig.dg/test/gimple/variables.hsail delete mode 100644 gcc/testsuite/brig.dg/test/gimple/vector.hsail delete mode 100644 gcc/testsuite/lib/brig-dg.exp delete mode 100644 gcc/testsuite/lib/brig.exp (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/brig.dg/README b/gcc/testsuite/brig.dg/README deleted file mode 100644 index 2ad5b24..0000000 --- a/gcc/testsuite/brig.dg/README +++ /dev/null @@ -1,12 +0,0 @@ -BRIG (HSAIL) frontend test cases --------------------------------- - -The suite consists of "smoke tests" that test several features of -the compilation and regression tests, but is not an exhaustive test -suite for all HSAIL instructions. The HSA PRM conformance suite -is supposed to be used for that. - -HSAILasm is required for converting the text HSAIL files to BRIGs -which the compiler consumes. It can be built from -https://github.com/HSAFoundation/HSAIL-Tools - diff --git a/gcc/testsuite/brig.dg/dg.exp b/gcc/testsuite/brig.dg/dg.exp deleted file mode 100644 index 6441092..0000000 --- a/gcc/testsuite/brig.dg/dg.exp +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright (C) 2009-2021 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GCC; see the file COPYING3. If not see -# . - -# GCC testsuite that uses the `dg.exp' driver. - -load_lib brig-dg.exp - -# Initialize `dg'. -dg-init - -if [expr [llength [auto_execok HSAILasm]] > 0] { - dg-runtest [find $srcdir/$subdir *.hsail] "" "" -} else { - unsupported "All BRIG FE tests require HSAILasm in PATH." -} - -# All done. -dg-finish diff --git a/gcc/testsuite/brig.dg/test/gimple/alloca.hsail b/gcc/testsuite/brig.dg/test/gimple/alloca.hsail deleted file mode 100644 index 479ab72..0000000 --- a/gcc/testsuite/brig.dg/test/gimple/alloca.hsail +++ /dev/null @@ -1,37 +0,0 @@ -module &module:1:0:$full:$large:$default; - -/* Tests for alloca. */ - -/* { dg-do compile } */ -/* { dg-options "-fdump-tree-gimple" } */ - -prog function &subfunction(arg_u32 %return_value)() { - alloca_align(1)_u32 $s2, 256; - st_arg_u32 $s2, [%return_value]; - ret; -}; - -prog kernel &kernel(kernarg_u64 %input_ptr, kernarg_u64 %output_ptr) -{ - ld_kernarg_u64 $d0, [%input_ptr]; - ld_global_u32 $s0, [$d0]; - - alloca_align(256)_u32 $s1, 16; - { - arg_u32 %return_value; - call &subfunction(%return_value)(); - ld_arg_u32 $s1, [%return_value]; - } - ld_kernarg_u64 $d1, [%output_ptr]; - st_global_u32 $s1, [$d0]; -}; - -/* { dg-final { scan-tree-dump "s2 = __builtin___hsail_alloca \\\(256, 1, __context\\\);" "gimple" } } */ - -/* { dg-final { scan-tree-dump "s1 = __builtin___hsail_alloca \\\(16, 256, __context\\\);" "gimple" } } */ - - -/* Both functions should have an alloca frame push and pop. */ -/* { dg-final { scan-tree-dump-times "__builtin___hsail_alloca_push_frame \\\(__context\\\);" 2 "gimple" } } */ - -/* { dg-final { scan-tree-dump-times "__builtin___hsail_alloca_pop_frame \\\(__context\\\);" 2 "gimple" } } */ diff --git a/gcc/testsuite/brig.dg/test/gimple/atomics.hsail b/gcc/testsuite/brig.dg/test/gimple/atomics.hsail deleted file mode 100644 index b877a66..0000000 --- a/gcc/testsuite/brig.dg/test/gimple/atomics.hsail +++ /dev/null @@ -1,33 +0,0 @@ -module &module:1:0:$full:$large:$default; - -/* Test for atomic instructions. */ - -/* { dg-do compile } */ -/* { dg-options "-fdump-tree-original" } */ - -prog kernel &Kernel(kernarg_u64 %input_ptr, kernarg_u64 %output_ptr) -{ - ld_kernarg_u64 $d0, [%input_ptr]; - - atomic_ld_global_rlx_system_b32 $s0, [$d0]; - atomic_add_global_rlx_system_u32 $s1, [$d0 + 4], $s0; - - ld_kernarg_u64 $d0, [%output_ptr]; - atomicnoret_st_global_rlx_system_b32 [$d0], $s2; - - atomicnoret_min_global_rlx_system_u32 [$d0 + 4], $s1; - - ret; -}; - -/* The atomic loads are implemented by casting to an atomic pointer. */ -/* { dg-final { scan-tree-dump "s0 = VIEW_CONVERT_EXPR\\\(\\\*\\\(atomic unsigned int \\\*\\\)" "original"} } */ - -/* The atomic add should call a gcc builtin. */ -/* { dg-final { scan-tree-dump "= __sync_fetch_and_add_4 \\\(" "original"} } */ - -/* The atomic stores are implemented by casting to an atomic pointer. */ -/* { dg-final { scan-tree-dump "\\\*\\\(atomic unsigned int \\\*\\\) d0 = s2;" "original"} } */ - -/* The atomic min is implemented by a custom builtin. */ -/* { dg-final { scan-tree-dump "builtin_out.\[0-9\]+ = __builtin___hsail_atomic_min_u32 \\\(" "original"} } */ diff --git a/gcc/testsuite/brig.dg/test/gimple/branches.hsail b/gcc/testsuite/brig.dg/test/gimple/branches.hsail deleted file mode 100644 index 081fde3..0000000 --- a/gcc/testsuite/brig.dg/test/gimple/branches.hsail +++ /dev/null @@ -1,58 +0,0 @@ -module &module:1:0:$full:$large:$default; - -/* Test different style of branches. */ - -/* { dg-do compile } */ -/* { dg-options "-fdump-tree-gimple" } */ - -prog kernel &Kernel(kernarg_u64 %input_ptr, kernarg_u64 %output_ptr) -{ - ld_kernarg_u64 $d0, [%input_ptr]; - ld_global_u64 $d1, [$d0]; - ld_global_u64 $d2, [$d0 + 8]; - - ld_global_u32 $s0, [$d0 + 16]; - ld_global_u32 $s1, [$d0 + 20]; - - sbr_width(all)_u32 $s1 [@case0, @case1, @case2]; -@case0: - st_global_u64 0, [$d0]; - br @out; -@case1: - st_global_u64 1, [$d0]; - br @out; -@case2: - st_global_u64 2, [$d0]; -@out: - cmp_eq_u32_u32 $s2, $s1, $s0; - cvt_b1_u32 $c0, $s2; - - cbr_width(all)_b1 $c0, @true_branch; -@false_branch: - st_global_u64 $d1, [$d0]; - -@true_branch: - ld_kernarg_u64 $d0, [%output_ptr]; - - st_global_u32 $s2, [$d0 + 8]; - br @skip; - st_global_u32 $s3, [$d0 + 12]; - -@skip: - ret; -}; - -/* sbr is converted to a switch */ -/* { dg-final { scan-tree-dump "switch \\\(s1\\\) , case 0: , case 1: , case 2: >" "gimple"} } */ - -/* br @out converted to gotos */ -/* { dg-final { scan-tree-dump-times "goto @out" 2 "gimple"} } */ - -/* the comparison instruction */ -/* { dg-final { scan-tree-dump "c0 = s2 != 0;" "gimple" } } */ - -/* cbr to an if clause */ -/* { dg-final { scan-tree-dump "if \\\(c0 != 0\\\) goto @true_branch; else goto ;" "gimple" } } */ - -/* br @skip converted to a goto */ -/* { dg-final { scan-tree-dump "goto @skip" "gimple"} } */ diff --git a/gcc/testsuite/brig.dg/test/gimple/fbarrier.hsail b/gcc/testsuite/brig.dg/test/gimple/fbarrier.hsail deleted file mode 100644 index 9efe027..0000000 --- a/gcc/testsuite/brig.dg/test/gimple/fbarrier.hsail +++ /dev/null @@ -1,74 +0,0 @@ -module &module:1:0:$full:$large:$default; - -/* Tests for fbarrier. */ - -/* { dg-do compile } */ -/* { dg-options "-fdump-tree-gimple" } */ - -fbarrier &fb_module_scope; - -prog function &subfunction(arg_u32 %return_value)() { - - workitemflatabsid_u32 $s3; - cvt_b1_u32 $c1, $s3; - cbr_width(all)_b1 $c1, @skip_fbar; - waitfbar &fb_module_scope; -@skip_fbar: - - st_arg_u32 $s3, [%return_value]; - ret; -}; - -prog kernel &kernel(kernarg_u64 %input_ptr, kernarg_u64 %output_ptr) -{ - fbarrier %fb_func_scope; - - ld_kernarg_u64 $d0, [%input_ptr]; - ld_global_u32 $s0, [$d0]; - - workitemflatabsid_u32 $s1; - cvt_b1_u32 $c1, $s1; - cbr_width(all)_b1 $c1, @skip_init; - - initfbar &fb_module_scope; - initfbar %fb_func_scope; - - joinfbar &fb_module_scope; - -@skip_init: - barrier_width(all); - - joinfbar %fb_func_scope; - - { - arg_u32 %return_value; - call &subfunction(%return_value)(); - ld_arg_u32 $s1, [%return_value]; - } - arrivefbar %fb_func_scope; - - ld_kernarg_u64 $d1, [%output_ptr]; - st_global_u32 $s1, [$d0]; - - workitemflatabsid_u32 $s1; - cvt_b1_u32 $c0, $s1; - cbr_width(all)_b1 $c0, @skip_fini; - - releasefbar &fb_module_scope; - releasefbar %fb_func_scope; - -@skip_fini: - -}; -/* fbarriers are allocated from the group memory in the order of - appearance. The current implementation allocates 32B per fbarrier. */ - -/* { dg-final { scan-tree-dump "__hsail_waitfbar \\\(0, __context\\\);" "gimple"} } */ -/* { dg-final { scan-tree-dump "__hsail_initfbar \\\(0, __context\\\);" "gimple"} } */ -/* { dg-final { scan-tree-dump "__hsail_initfbar \\\(__group_local_offset, __context\\\);" "gimple"} } */ -/* { dg-final { scan-tree-dump "__hsail_joinfbar \\\(0, __context\\\);" "gimple"} } */ -/* { dg-final { scan-tree-dump "@skip_init:\[\n ]+__builtin___hsail_barrier \\\(__context\\\);\[\n ]+__builtin___hsail_joinfbar \\\(__group_local_offset, __context\\\);" "gimple"} } */ - -/* { dg-final { scan-tree-dump "__hsail_arrivefbar \\\(__group_local_offset, __context\\\);" "gimple"} } */ - -/* { dg-final { scan-tree-dump "__hsail_releasefbar \\\(0, __context\\\);\[\n ]+__builtin___hsail_releasefbar \\\(__group_local_offset, __context\\\);" "gimple"} } */ diff --git a/gcc/testsuite/brig.dg/test/gimple/function_calls.hsail b/gcc/testsuite/brig.dg/test/gimple/function_calls.hsail deleted file mode 100644 index 50f7906..0000000 --- a/gcc/testsuite/brig.dg/test/gimple/function_calls.hsail +++ /dev/null @@ -1,59 +0,0 @@ -module &module:1:0:$full:$large:$default; - -/* Function calls and argument passing. */ - -/* { dg-do compile } */ -/* { dg-options "-fdump-tree-gimple" } */ - -prog function &subfunction(arg_u32 %return_value)(arg_f32 %float_arg, arg_f64 %double_arg, arg_f16 %half_arg) { - ld_arg_f32 $s0, [%float_arg]; - cvt_u32_f32 $s0, $s0; - - ld_arg_f64 $d0, [%double_arg]; - cvt_u32_f64 $s1, $d0; - - ld_arg_f16 $s2, [%half_arg]; - cvt_u32_f16 $s2, $s2; - - add_u32 $s3, $s0, $s1; - add_u32 $s3, $s3, $s2; - - st_arg_u32 $s3, [%return_value]; - ret; -}; - -prog kernel &kernel(kernarg_u64 %input_ptr, kernarg_u64 %output_ptr) -{ - ld_kernarg_u64 $d0, [%input_ptr]; - ld_global_u32 $s0, [$d0]; - { - arg_f32 %float_arg; - arg_f64 %double_arg; - arg_f16 %half_arg; - arg_u32 %return_value; - - st_arg_f32 12.0f, [%float_arg]; - st_arg_f64 640.0d, [%double_arg]; - st_arg_f16 12.0h, [%half_arg]; - - call &subfunction(%return_value)(%float_arg, %double_arg, %half_arg); - - ld_arg_u32 $s1, [%return_value]; - } - ld_kernarg_u64 $d1, [%output_ptr]; - st_global_u32 $s1, [$d0]; -}; - -/* The generated function call should have the incoming arguments and three hidden arguments. */ - -/* { dg-final { scan-tree-dump "_\[0-9\]+ = subfunction \\\(_kernel.float_arg.\[_0-9\]+, _kernel.double_arg.\[_0-9\]+, _kernel.half_arg.\[_0-9\]+, __context, __group_base_addr, group_local_offset.*, __private_base_addr\\\);" "gimple"} } */ - -/* The callee should refer directly to the scalar arguments when it reads them. */ -/* { dg-final { scan-tree-dump "= float_arg;" "gimple"} } */ -/* { dg-final { scan-tree-dump "= double_arg;" "gimple"} } */ -/* { dg-final { scan-tree-dump "= half_arg;" "gimple"} } */ - -/* The return value is stored to a temporary before returned. */ -/* { dg-final { scan-tree-dump "_retvalue_temp = s3;" "gimple"} } */ -/* { dg-final { scan-tree-dump "D.\[0-9\]+ = _retvalue_temp;" "gimple"} } */ -/* { dg-final { scan-tree-dump "return D.\[0-9\]+;" "gimple"} } */ diff --git a/gcc/testsuite/brig.dg/test/gimple/internal-casts.hsail b/gcc/testsuite/brig.dg/test/gimple/internal-casts.hsail deleted file mode 100644 index 52673c9..0000000 --- a/gcc/testsuite/brig.dg/test/gimple/internal-casts.hsail +++ /dev/null @@ -1,146 +0,0 @@ -module &module:1:0:$full:$large:$default; - -/* Test for casting from/to representation of HSA registers. */ - -/* HSA registers are untyped but in gccbrig they are presented as */ -/* variables with a type selected by analysis. Currently, each */ -/* register variable, per function, has a type as it is used at */ -/* most. Therefore, register variable can be nearly any type. The */ -/* tests makes sure the generic/tree expressions have the right casts */ -/* from/to the register variables. */ - - -/* { dg-do compile } */ -/* { dg-options "-fdump-tree-original" } */ - -prog kernel &Kernel(kernarg_u64 %input_ptr, kernarg_u64 %output_ptr) -{ - private_u64 %foo; - private_u64 %bar; - private_b128 %baz; - - ld_kernarg_u64 $d0, [%input_ptr]; - ld_global_u32 $s0, [$d0]; - - /* Trick gccbrig to set wanted type for the registers. */ - -/* $s0 is selected as float... */ -/* { dg-final { scan-tree-dump " s0;" "original"} } */ -/* ..., therefore, there should not be any casts. */ -/* { dg-final { scan-tree-dump "s10 = s0 \\\+ s0;" "original"} } */ - - add_f32 $s10, $s0, $s0; - add_f32 $s10, $s0, $s0; - add_f32 $s10, $s0, $s0; - add_f32 $s10, $s0, $s0; - add_f32 $s10, $s0, $s0; - -/* Expression with other type, a cast is needed. */ -/* { dg-final { scan-tree-dump "s1 = VIEW_CONVERT_EXPR.s0. \\\+ 123;" "original"} } */ - - add_u32 $s1, $s0, 123; - -/* { dg-final { scan-tree-dump "unsigned int s1;" "original"} } */ - - add_u32 $s10, $s1, 0; - add_u32 $s10, $s1, 0; - add_u32 $s10, $s1, 0; - add_u32 $s10, $s1, 0; - add_u32 $s10, $s1, 0; - -/* { dg-final { scan-tree-dump "s0 = VIEW_CONVERT_EXPR<>.s1.;" "original"} } */ - - mov_b32 $s0, $s1; - -/* Rig the election for $d0 to be double. */ -/* { dg-final { scan-tree-dump " d0;" "original"} } */ -/* { dg-final { scan-tree-dump "d10 = d0 \\\+ d0;" "original"} } */ - - add_f64 $d10, $d0, $d0; - add_f64 $d10, $d0, $d0; - add_f64 $d10, $d0, $d0; - add_f64 $d10, $d0, $d0; - add_f64 $d10, $d0, $d0; - -/* Make $s2 to be vector type. */ -/* { dg-final { scan-tree-dump "vector.4. unsigned char s2;" "original"} } */ -/* { dg-final { scan-tree-dump "s2 = VIEW_CONVERT_EXPR\\\(s1\\\) \\\+ VIEW_CONVERT_EXPR\\\(s1\\\);" "original"} } */ - - add_pp_u8x4 $s2, $s1, $s1; - -/* { dg-final { scan-tree-dump "s20 = s2 \\\+ s2;" "original"} } */ - - add_pp_u8x4 $s20, $s2, $s2; - add_pp_u8x4 $s20, $s2, $s2; - add_pp_u8x4 $s20, $s2, $s2; - add_pp_u8x4 $s20, $s2, $s2; - -/* { dg-final { scan-tree-dump "d0 = VIEW_CONVERT_EXPR<>.{VIEW_CONVERT_EXPR.s0., VIEW_CONVERT_EXPR.s2.}.;" "original"} } */ - - combine_v2_b64_b32 $d0, ($s0, $s2); - -/* { dg-final { scan-tree-dump "s2 = VIEW_CONVERT_EXPR.BIT_FIELD_REF .;" "original"} } */ -/* { dg-final { scan-tree-dump "s1 = BIT_FIELD_REF ;" "original"} } */ - - expand_v2_b32_b64 ($s2, $s1), $d0; - -/* { dg-final { scan-tree-dump "s0 = VIEW_CONVERT_EXPR<>\\\(.*VIEW_CONVERT_EXPR.s0\[\)\]*;" "original"} } */ - - cvt_s16_s8 $s0, $s0; - -/* { dg-final { scan-tree-dump "c0 = .*VIEW_CONVERT_EXPR<>.s2..* != 0;" "original"} } */ - - cvt_b1_f32 $c0, $s2; - -/* { dg-final { scan-tree-dump ".*__private_base_addr.* = .*\\\(unsigned char\\\) VIEW_CONVERT_EXPR\\\(s0\\\)\[\)\]*;" "original"} } */ - - st_private_u8 $s0, [%foo]; - -/* { dg-final { scan-tree-dump ".*__private_base_addr.* = .*\\\(unsigned short\\\) VIEW_CONVERT_EXPR\\\(s2\\\)\[\)\]*;" "original"} } */ - - st_private_u16 $s2, [%bar]; - -/* { dg-final { scan-tree-dump "mem_read.\[0-9\]* = \\\*\\\(signed char \\\*\\\) \\\(__private_base_addr .*\\\);\[ \n\]*s2 = VIEW_CONVERT_EXPR\\\(\\\(signed int\\\) mem_read.\[0-9\]*\\\);" "original"} } */ - - ld_private_s8 $s2, [%foo]; - -/* { dg-final { scan-tree-dump "mem_read.\[0-9\]* = \\\*\\\(signed short \\\*\\\) \\\(__private_base_addr .*\\\);\[ \n\]*s0 = VIEW_CONVERT_EXPR<>\\\(\\\(signed int\\\) mem_read.\[0-9\]*\\\);" "original"} } */ - - ld_private_s16 $s0, [%bar]; - -/* { dg-final { scan-tree-dump "\\\*\\\( \\\*\\\) \\\(__private_base_addr.*\\\) \\\+ 0 = s0;" "original"} } */ -/* { dg-final { scan-tree-dump "\\\*\\\( \\\*\\\) \\\(__private_base_addr.*\\\) \\\+ 4 = VIEW_CONVERT_EXPR<>\\\(s1\\\);" "original"} } */ -/* { dg-final { scan-tree-dump "\\\*\\\( \\\*\\\) \\\(__private_base_addr.*\\\) \\\+ 8 = VIEW_CONVERT_EXPR<>\\\(s2\\\);" "original"} } */ - - st_v3_private_f32 ($s0, $s1, $s2), [%baz]; - -/* { dg-final { scan-tree-dump "mem_read.\[0-9\]* = \\\*\\\(signed short \\\*\\\) \\\(__private_base_addr.*\\\) \\\+ 0;\[ \n\]*s0 = VIEW_CONVERT_EXPR<>\\\(\\\(signed int\\\) mem_read.\[0-9\]*\\\);" "original"} } */ -/* { dg-final { scan-tree-dump "mem_read.\[0-9\]* = \\\*\\\(signed short \\\*\\\) \\\(__private_base_addr.*\\\) \\\+ 2;\[ \n\]*s1 = VIEW_CONVERT_EXPR\\\(\\\(signed int\\\) mem_read.\[0-9\]*\\\);" "original"} } */ -/* { dg-final { scan-tree-dump "mem_read.\[0-9\]* = \\\*\\\(signed short \\\*\\\) \\\(__private_base_addr.*\\\) \\\+ 4;\[ \n\]*s2 = VIEW_CONVERT_EXPR\\\(\\\(signed int\\\) mem_read.\[0-9\]*\\\);" "original"} } */ - - ld_v3_private_s16 ($s0, $s1, $s2), [%baz]; - -/* { dg-final { scan-tree-dump "s5 = .*VIEW_CONVERT_EXPR\\\(s0\\\) == VIEW_CONVERT_EXPR\\\(s2\\\)\\\) .*;" "original"} } */ - - cmp_eq_s32_u32 $s5, $s0, $s2; - -/* { dg-final { scan-tree-dump "s6 = VIEW_CONVERT_EXPR<>\\\(.*VIEW_CONVERT_EXPR\\\(s0\\\).*VIEW_CONVERT_EXPR\\\(s2\\\).*;" "original"} } */ - - cmp_eq_pp_u16x2_u16x2 $s6, $s0, $s2; - -/* { dg-final { scan-tree-dump " s60;" "original"} } */ - - add_f32 $s60, $s6, $s6; - add_f32 $s60, $s6, $s6; - add_f32 $s60, $s6, $s6; - add_f32 $s60, $s6, $s6; - - ld_kernarg_u64 $d0, [%output_ptr]; - st_global_u32 $s0, [$d0]; - - ret; -}; - - - - diff --git a/gcc/testsuite/brig.dg/test/gimple/kernarg.hsail b/gcc/testsuite/brig.dg/test/gimple/kernarg.hsail deleted file mode 100644 index 7f30919..0000000 --- a/gcc/testsuite/brig.dg/test/gimple/kernarg.hsail +++ /dev/null @@ -1,25 +0,0 @@ -module &module:1:0:$full:$large:$default; - -/* Tests for kernarg addressing modes. */ - -/* { dg-do compile } */ -/* { dg-options "-fdump-tree-original" } */ - -prog kernel &Kernel(kernarg_u64 %input[4], kernarg_u64 %output_ptr, kernarg_u64 %i) -{ - ld_kernarg_u64 $d0, [%i]; - ld_kernarg_u64 $d0, [%input][$d0 + 1]; - - ld_kernarg_u64 $d1, [%output_ptr]; - st_global_u64 $d0, [$d1]; - - ret; -}; - -/* [%i] */ -/* { dg-final { scan-tree-dump " = \\\*\\\(unsigned long \\\*\\\) \\\(__args \\\+ 40\\\);" "original"} } */ - -/* [%input][$d0 + 1] */ -/* { dg-final { scan-tree-dump "\\\*\\\(unsigned long \\\*\\\) \\\(\\\(VIEW_CONVERT_EXPR\\\(\\\(unsigned long\\\) __args\\\) \\\+ \\\(unsigned long\\\) d0\\\) \\\+ 1\\\);" "original"} } */ - - diff --git a/gcc/testsuite/brig.dg/test/gimple/mem.hsail b/gcc/testsuite/brig.dg/test/gimple/mem.hsail deleted file mode 100644 index 75835a1..0000000 --- a/gcc/testsuite/brig.dg/test/gimple/mem.hsail +++ /dev/null @@ -1,39 +0,0 @@ -module &module:1:0:$full:$large:$default; - -/* Tests for load/store addressing modes. */ - -/* { dg-do compile } */ -/* { dg-options "-fdump-tree-original" } */ - -prog kernel &Kernel(kernarg_u64 %input_ptr, kernarg_u64 %input_ptr2, kernarg_u64 %output_ptr) -{ - global_u32 %global_array[4]; - - ld_kernarg_u64 $d0, [%input_ptr]; - ld_kernarg_u64 $d2, [%input_ptr2]; - ld_global_u32 $s0, [$d0]; - ld_global_u64 $d1, [$d2 + 4]; - - ld_global_u32 $s2, [%global_array][$d1 + 4]; - - ld_kernarg_u64 $d0, [%output_ptr]; - st_global_u32 $s0, [$d0]; - st_global_u32 $s1, [$d0 + 4]; - st_global_u32 $s2, [$d0 + 8]; - - ret; -}; - -/* %input_ptr, %input_ptr2 and %output_ptr accesses should generate offsets to the __args array */ -/* { dg-final { scan-tree-dump "__args;\[\n \]+d0 =" "original"} } */ -/* { dg-final { scan-tree-dump "\\\(__args \\\+ 8\\\);\[\n \]+d2 =" "original"} } */ -/* { dg-final { scan-tree-dump "\\\(__args \\\+ 16\\\);\[\n \]+d0 =" "original"} } */ - -/* ld_global_u32 $s0, [$d0] */ -/* { dg-final { scan-tree-dump "\\\*\\\(unsigned int \\\*\\\) d0;\[\n \]+s0 =" "original"} } */ - -/* ld_global_u64 $d1, [$d2 + 4] pointer arithmetics*/ -/* { dg-final { scan-tree-dump "d2 \\\+ 4\\\);\[\n \]+d1 = " "original"} } */ - -/* ld_global_u32 $s2, [%global_array][$d1 + 4]; is the most complex form */ -/* { dg-final { scan-tree-dump "\\\(unsigned long\\\) &_Kernel.global_array\\\) \\\+ \\\(unsigned long\\\) d1\\\) \\\+ 4" "original" } } */ diff --git a/gcc/testsuite/brig.dg/test/gimple/mulhi.hsail b/gcc/testsuite/brig.dg/test/gimple/mulhi.hsail deleted file mode 100644 index acdced9..0000000 --- a/gcc/testsuite/brig.dg/test/gimple/mulhi.hsail +++ /dev/null @@ -1,33 +0,0 @@ -module &module:1:0:$full:$large:$default; - -/* Test high part multiplies. */ - -/* { dg-do compile } */ -/* { dg-options "-fdump-tree-gimple" } */ - -prog kernel &Kernel(kernarg_u64 %input_ptr, kernarg_u64 %output_ptr) -{ - ld_kernarg_u64 $d0, [%input_ptr]; - ld_global_u64 $d1, [$d0]; - ld_global_u64 $d2, [$d0 + 8]; - - ld_global_u32 $s0, [$d0 + 16]; - ld_global_u32 $s1, [$d0 + 20]; - - mulhi_s32 $s2, $s0, $s1; - mulhi_s64 $d2, $d1, $d2; - - mad24hi_s32 $s3, $s0, $s1, $s2; - mul24hi_s32 $s3, $s3, $s1; - - ld_kernarg_u64 $d0, [%output_ptr]; - st_global_u64 $d1, [$d0]; - st_global_u32 $s2, [$d0 + 8]; - st_global_u32 $s3, [$d0 + 12]; - - ret; -}; - -/* All of the hipart mults areImplemented using MULT_HIGHPART_EXPR (h*). */ -/* { dg-final { scan-tree-dump-times " h\\\* " 4 "gimple"} } */ - diff --git a/gcc/testsuite/brig.dg/test/gimple/packed.hsail b/gcc/testsuite/brig.dg/test/gimple/packed.hsail deleted file mode 100644 index 1e2bb53..0000000 --- a/gcc/testsuite/brig.dg/test/gimple/packed.hsail +++ /dev/null @@ -1,76 +0,0 @@ -module &module:1:0:$full:$large:$default; - -/* Test for different cases of packed instruction controls. */ - -/* { dg-do compile } */ -/* { dg-options "-fdump-tree-gimple -fdump-tree-original" } */ - -prog kernel &Kernel(kernarg_u64 %input_ptr, kernarg_u64 %output_ptr) -{ - ld_kernarg_u64 $d0, [%input_ptr]; - ld_global_b128 $q0, [$d0]; - - add_pp_u8x16 $q1, $q0, u8x16(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); - - /* Broadcast the 15 as it's the lowest element (pos 0) in the resulting vector. */ - add_ps_u8x16 $q2, $q1, u8x16(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); - - /* Broadcast the lowest element of q1. */ - add_sp_u8x16 $q3, $q1, $q2; - - /* Perform a scalar computation with the lowest element of both inputs and store it to the lowest element of dest. */ - add_ss_u8x16 $q4, $q2, $q3; - - /* Saturating arithmetics variations. */ - add_pp_sat_u8x16 $q5, $q4, u8x16(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); - - /* Broadcast the 15 as it's the lowest element (pos 0) in the resulting vector. */ - add_ps_sat_u8x16 $q6, $q5, u8x16(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); - - /* Broadcast the lowest element of q1. */ - add_sp_sat_u8x16 $q7, $q6, $q5; - - /* Perform a scalar computation with the lowest element of both inputs and store it to the lowest element of dest. */ - add_ss_sat_u8x16 $q8, $q7, $q6; - - /* Single operand vector computation. */ - neg_p_s16x8 $q9, $q8; - - ld_kernarg_u64 $d0, [%output_ptr]; - st_global_b128 $q8, [$d0]; - - ret; -}; - -/* The b128 load is done using uint128_t*. */ -/* { dg-final { scan-tree-dump "q0 = VIEW_CONVERT_EXPR\\\(mem_read.\[0-9\]+\\\);" "original"} } */ - -/* Before arithmetics, the uint128_t is casted to a vector datatype. */ -/* { dg-final { scan-tree-dump "\\\(q0\\\) \\\+ \\\{" "original"} } */ - -/* The u8x16 constant is generated to an array with elements in reverse order */ -/* in comparison to the HSAIL syntax. */ -/* { dg-final { scan-tree-dump "\\\+ { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }" "original"} } */ - -/* Broadcasted the constant vector's lowest element and summed it up in the next line. */ -/* { dg-final { scan-tree-dump "= { 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15 };\[\n \]+\[a-z0-9_\]+ = \[a-z0-9_\]+ \\\+ \[a-z0-9_\]+;" "gimple"} } */ - -/* Broadcasted the registers lowest element via a VEC_PERM_EXPR that has an all-zeros mask. */ -/* { dg-final { scan-tree-dump "VEC_PERM_EXPR <\[a-z0-9_\]+, \[a-z0-9_\]+, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }>;" "gimple" } } */ - -/* For the add_ss we assume performing the computation over the whole vector is cheaper than */ -/* extracting the scalar and performing a scalar operation. This aims to stay in the vector -/* datapath as long as possible. */ -/* { dg-final { scan-tree-dump "new_output.\[0-9\]+ = q2 \\\+ q3;" "gimple" } } */ - -/* Insert the lowest element of the result to the lowest element of the result register. */ -/* { dg-final { scan-tree-dump "= VEC_PERM_EXPR ;" "gimple" } } */ - -/* FIXME */ -/* { dg-final { scan-tree-dump "q4 = \(VIEW_CONVERT_EXPR\\\()?s_output.\[0-9\]+\(_\[0-9\]+\)*\\\)?;" "gimple" } } */ - -/* The saturating arithmetics are (curently) implemented using scalar builtin calls. */ -/* { dg-final { scan-tree-dump-times "= __builtin___hsail_sat_add_u8" 64 "gimple" } } */ - -/* A single operand vector instr (neg.) */ -/* { dg-final { scan-tree-dump "= VIEW_CONVERT_EXPR\\\(\(s_output.\[0-9\]+_\[0-9\]+|q8\)\\\);\[\n \]+q9 = -_\[0-9\]+;\[\n \]+" "gimple" } } */ diff --git a/gcc/testsuite/brig.dg/test/gimple/priv-array-offset-access.hsail b/gcc/testsuite/brig.dg/test/gimple/priv-array-offset-access.hsail deleted file mode 100644 index b20704b..0000000 --- a/gcc/testsuite/brig.dg/test/gimple/priv-array-offset-access.hsail +++ /dev/null @@ -1,87 +0,0 @@ -module &__llvm_hsail_module:1:0:$full:$large:$near; - -/* Regression test for a private array access case which used to assert. */ - -/* { dg-do compile } */ -/* { dg-options "-fdump-tree-gimple" } */ - -decl prog function &vec_sum()( - arg_u32 %a, - arg_u32 %b, - arg_u32 %res, - arg_u32 %N); - -prog function &vec_sum()( - arg_u32 %a, - arg_u32 %b, - arg_u32 %res, - arg_u32 %N) -{ - - ld_arg_align(4)_u32 $s0, [%N]; - ld_arg_align(4)_u32 $s1, [%res]; - ld_arg_align(4)_u32 $s2, [%b]; - ld_arg_align(4)_u32 $s3, [%a]; - cmp_le_b1_s32 $c0, $s0, 0; - cbr_b1 $c0, @BB0_2; -@BB0_1: - ld_private_align(4)_u32 $s4, [$s3]; - ld_private_align(4)_u32 $s5, [$s2]; - add_u32 $s4, $s5, $s4; - st_private_align(4)_u32 $s4, [$s1]; - add_u32 $s1, $s1, 4; - add_u32 $s2, $s2, 4; - add_u32 $s3, $s3, 4; - add_u32 $s0, $s0, 4294967295; - cmp_ne_b1_s32 $c0, $s0, 0; - cbr_b1 $c0, @BB0_1; -@BB0_2: - ret; -}; - -prog kernel &test( - kernarg_u64 %in, - kernarg_u64 %out) -{ - - align(4) private_u8 %__privateStack[1200]; - mov_b64 $d1, 0; -/* This used to crash when gcc asserts enabled: */ - lda_private_u32 $s0, [%__privateStack][400]; - lda_private_u32 $s1, [%__privateStack]; - ld_kernarg_align(8)_width(all)_u64 $d0, [%out]; - ld_kernarg_align(8)_width(all)_u64 $d2, [%in]; -@BB1_1: - add_u64 $d3, $d2, $d1; - ld_global_align(4)_u32 $s2, [$d3]; - st_private_align(4)_u32 $s2, [$s0]; - st_private_align(4)_u32 $s2, [$s1]; - add_u32 $s1, $s1, 4; - add_u32 $s0, $s0, 4; - add_u64 $d1, $d1, 4; - cmp_ne_b1_s64 $c0, $d1, 400; - cbr_b1 $c0, @BB1_1; - mov_b32 $s1, 0; - lda_private_u32 $s0, [%__privateStack][800]; -@BB1_3: - ld_private_align(4)_u32 $s2, [%__privateStack][$s1]; - ld_private_align(4)_u32 $s3, [%__privateStack][$s1+400]; - add_u32 $s2, $s3, $s2; - st_private_align(4)_u32 $s2, [%__privateStack][$s1+800]; - add_u32 $s1, $s1, 4; - cmp_ne_b1_s32 $c0, $s1, 400; - cbr_b1 $c0, @BB1_3; - mov_b64 $d1, 0; -@BB1_5: - add_u64 $d2, $d0, $d1; - ld_private_align(4)_u32 $s1, [$s0]; - st_global_align(4)_u32 $s1, [$d2]; - add_u32 $s0, $s0, 4; - add_u64 $d1, $d1, 4; - cmp_ne_b1_s64 $c0, $d1, 400; - cbr_b1 $c0, @BB1_5; - ret; -}; - -/* br @skip converted to a goto */ -/* { dg-final { scan-tree-dump "= \\\(void \\\*\\\) priv_var_offset" "gimple"} } */ diff --git a/gcc/testsuite/brig.dg/test/gimple/smoke_test.hsail b/gcc/testsuite/brig.dg/test/gimple/smoke_test.hsail deleted file mode 100644 index 6e23263..0000000 --- a/gcc/testsuite/brig.dg/test/gimple/smoke_test.hsail +++ /dev/null @@ -1,91 +0,0 @@ -module &module:1:0:$full:$large:$default; - -/* A basic smoke test. */ - -/* { dg-do compile } */ -/* { dg-options "-fdump-tree-gimple" } */ - -prog kernel &Kernel(kernarg_u64 %input_ptr, kernarg_u64 %output_ptr) -{ - ld_kernarg_u64 $d0, [%input_ptr]; - ld_global_u32 $s0, [$d0]; - ld_global_u32 $s1, [$d0 + 4]; - - add_u32 $s2, $s0, $s1; - add_u32 $s3, $s0, 4294967295; - - ld_kernarg_u64 $d0, [%output_ptr]; - st_global_u32 $s2, [$d0]; - st_global_u32 $s3, [$d0 + 4]; - - ret; -}; - -prog kernel &KernelWithBarrier(kernarg_u64 %input_ptr, kernarg_u64 %output_ptr) -{ - ld_kernarg_u64 $d0, [%input_ptr]; - ld_global_u32 $s0, [$d0]; - ld_global_u32 $s1, [$d0 + 4]; - - add_u32 $s2, $s0, $s1; - - barrier_width(all); - - add_u32 $s3, $s0, 4294967295; - - ld_kernarg_u64 $d0, [%output_ptr]; - st_global_u32 $s2, [$d0]; - st_global_u32 $s3, [$d0 + 4]; - - ret; -}; - -/* The kernel function itself should have a fingerprint as follows */ -/* _Kernel (const unsigned char * restrict __args, void * restrict __context, unsigned char * restrict __group_base_addr, unsigned int __group_local_offset, unsigned char * restrict __private_base_addr) */ -/* { dg-final { scan-tree-dump "_Kernel \\\(const unsigned char \\\* restrict __args, void \\\* restrict __context, unsigned char \\\* restrict __group_base_addr, unsigned int __group_local_offset, unsigned char \\\* restrict __private_base_addr\\\)" "gimple"} } */ - -/* ld_kernarg: mem_read.0 = MEM[(unsigned long *)__args]; */ -/* { dg-final { scan-tree-dump "mem_read.\[0-9\] = MEM\\\[\\\(unsigned long \\\*\\\)__args\\\];" "gimple"} } */ - -/* The latter ld_global_u32 should be visible as a pointer dereference (after pointer arithmetics on a temporary var): */ -/* mem_read.2 = *D.1691; */ -/* { dg-final { scan-tree-dump "mem_read.\[0-9\]+ = \\\*\[_0-9\]+;" "gimple"} } */ - -/* add_u32s should generate +operators */ -/* { dg-final { scan-tree-dump "s2 = s0 \\\+ s1;" "gimple"} } */ -/* { dg-final { scan-tree-dump "s3 = s0 \\\+ 4294967295;" "gimple"} } */ - -/* The latter st_global_u32 should be visible as a pointer dereference (after pointer arithmetics on a temporary var): */ -/* *D.1694 = s3; */ -/* { dg-final { scan-tree-dump "\\\*\[_0-9\]+ = s3;" "gimple"} } */ - -/* The return inside the kernel should be generated to a goto to the end of the kernel. */ -/* goto __kernel_exit; */ -/* __kernel_exit: */ -/* { dg-final { scan-tree-dump "goto __kernel_exit;" "gimple"} } */ -/* { dg-final { scan-tree-dump "__kernel_exit:" "gimple"} } */ - -/* Expecting a work item loop because there are no barrier calls. */ -/* { dg-final { scan-tree-dump "if \\\(__local_x < __cur_wg_size_x\\\) goto __wi_loop_x; else goto" "gimple"} } */ -/* { dg-final { scan-tree-dump "if \\\(__local_y < __cur_wg_size_y\\\) goto __wi_loop_y; else goto" "gimple"} } */ -/* { dg-final { scan-tree-dump "if \\\(__local_z < __cur_wg_size_z\\\) goto __wi_loop_z; else goto" "gimple"} } */ - -/* The launcher should call __hsail_launch_wg_function in this case: */ -/* Kernel (void * restrict __context, unsigned char * restrict __group_base_addr) */ -/* { dg-final { scan-tree-dump "Kernel \\\(void \\\* restrict __context, unsigned char \\\* restrict __group_base_addr\\\)" "gimple"} } */ -/* { dg-final { scan-tree-dump "__hsail_launch_wg_function \\\(_Kernel, __context, __group_base_addr, group_local_offset.*\\\);" "gimple"} }*/ - -/* The kernel should have the magic metadata section injected to the ELF. */ -/* TODO: this should be disabled in case not outputting to an ELF. */ -/* Currently ELF is assumed by the brig frontend. Do not check for the context */ -/* as it is likely to change. */ -/* { dg-final { scan-tree-dump "\\\.pushsection phsa\\\.desc\\\.Kernel" "gimple"} }*/ - -/* The kernel with the barrier call should have the barrier builtin call in between the two summations. */ -/* { dg-final { scan-tree-dump "s2 = s0 \\\+ s1;\[\n \]+__builtin___hsail_barrier \\\(__context\\\);\[\n \]+s3 = s0 \\\+ 4294967295;" "gimple"} } */ - -/* The kernel with the barrier call's launcher function should call the thread-spawning function. */ -/* { dg-final { scan-tree-dump "__hsail_launch_kernel \\\(_KernelWithBarrier, __context, __group_base_addr, group_local_offset.*\\\);" "gimple" } } */ - - - diff --git a/gcc/testsuite/brig.dg/test/gimple/variables.hsail b/gcc/testsuite/brig.dg/test/gimple/variables.hsail deleted file mode 100644 index 5fd96c1..0000000 --- a/gcc/testsuite/brig.dg/test/gimple/variables.hsail +++ /dev/null @@ -1,125 +0,0 @@ -module &module:1:0:$full:$large:$default; - -/* Tests for different variable scopes and address spaces. */ - -/* { dg-do compile } */ -/* { dg-options "-fdump-tree-gimple -fdump-tree-original" } */ - -prog align(256) private_u32 &prog_private; -private_u32 &mod_private; - -prog group_u32 &prog_group; -group_u32 &mod_group; - -prog global_u32 &prog_global; -global_u32 &mod_global; - -decl prog global_u32 &prog_global_host_def; - -prog readonly_u32 &prog_readonly; -readonly_u32 &mod_readonly; - -prog function &subfunction(arg_u32 %return_value)(arg_u32 %arg) { - - private_u32 %func_private; - group_u32 %func_group; - align(256) global_u32 %func_global; - readonly_u32 %func_readonly; - - ld_private_u32 $s200, [%func_private]; - st_private_u32 $s200, [&prog_private]; - -/* { dg-final { scan-tree-dump "__group_base_addr \\\+ \\\(0 \\\+" "original" } } */ - ld_group_u32 $s203, [%func_group]; - -/* { dg-final { scan-tree-dump "__group_base_addr \\\+ 0" "original" } } */ - st_group_u32 $s203, [&prog_group]; - - ld_global_u32 $s204, [%func_global]; - st_global_u32 $s204, [&prog_global]; - - ld_readonly_u32 $s205, [%func_readonly]; - st_global_u32 $s205, [%func_global]; - - st_arg_u32 $s2, [%return_value]; - ret; -}; - -prog kernel &kernel(kernarg_u64 %input_ptr, kernarg_u64 %output_ptr) -{ - private_u32 %kern_private; - group_u32 %kern_group; - global_u32 %kern_global; - readonly_u32 %kern_readonly; - - ld_kernarg_u64 $d0, [%input_ptr]; - ld_global_u32 $s0, [$d0]; - - ld_private_u32 $s2, [&prog_private]; - st_private_u32 $s2, [%kern_private]; - ld_private_u32 $s3, [&mod_private]; - st_private_u32 $s3, [&prog_private]; - - ld_group_u32 $s4, [&prog_group]; - st_group_u32 $s4, [%kern_group]; - ld_group_u32 $s5, [&mod_group]; - st_group_u32 $s5, [&prog_group]; - - ld_global_u32 $s6, [&prog_global]; - st_global_u32 $s6, [%kern_global]; - ld_global_u32 $s7, [&mod_global]; - st_global_u32 $s7, [&prog_global]; - - ld_readonly_u32 $s8, [&prog_readonly]; - st_global_u32 $s8, [%kern_global]; - ld_readonly_u32 $s9, [&mod_readonly]; - st_global_u32 $s9, [&prog_global]; - - ld_readonly_u32 $s10, [%kern_readonly]; - st_global_u32 $s10, [%kern_global]; - ld_readonly_u32 $s11, [%kern_readonly]; - st_global_u32 $s11, [&prog_global_host_def]; - - { - arg_u32 %arg; - arg_u32 %return_value; - st_arg_u32 $s1, [%arg]; - call &subfunction(%return_value)(%arg); - ld_arg_u32 $s1, [%return_value]; - } - ld_kernarg_u64 $d1, [%output_ptr]; - st_global_u32 $s1, [$d0]; -}; - -/* Private variable offsets assigned in the order of their appearance */ -/* - prog_private @0 (align 256) -> until 254 to ensure all WIs - mod_private @256 have their chunks aligned - func_private @260 - kern_private @264 -*/ - -/* Group variable offsets assigned in the order of their appearance */ -/* - prog_group @0 (2) - mod_group @4 (4) - func_group @8 (1) - kern_group @12 (3) -*/ - -/* The "mangling" of the global and readonly vars. */ -/* { dg-final { scan-tree-dump "\[ \]*prog_global = s204;" "gimple" } } */ - -/* { dg-final { scan-tree-dump "\.module.mod_global;" "gimple" } } */ - -/* Host defined variables need indirect access as the address is - known only at run time. */ -/* { dg-final { scan-tree-dump "\\\*\\\__phsa.host_def.prog_global_host_def.\[0-9\]+_\[0-9\]+ = s11;" "gimple" } } */ - -/* { dg-final { scan-tree-dump "\.subfunction.func_global;" "gimple" } } */ -/* { dg-final { scan-tree-dump "\.subfunction.func_readonly;" "gimple" } } */ - -/* { dg-final { scan-tree-dump "kernel.kern_global" "gimple" } } */ -/* { dg-final { scan-tree-dump "kernel.kern_readonly" "gimple" } } */ - - diff --git a/gcc/testsuite/brig.dg/test/gimple/vector.hsail b/gcc/testsuite/brig.dg/test/gimple/vector.hsail deleted file mode 100644 index 7529333..0000000 --- a/gcc/testsuite/brig.dg/test/gimple/vector.hsail +++ /dev/null @@ -1,57 +0,0 @@ -module &module:1:0:$full:$large:$default; - -/* A test for vector operands. */ - -/* { dg-do compile } */ -/* { dg-options "-fdump-tree-original" } */ - -prog kernel &Kernel(kernarg_u64 %input_ptr, kernarg_u64 %output_ptr) -{ - ld_kernarg_u64 $d0, [%input_ptr]; - ld_v2_global_f32 ($s0, $s1), [$d0]; - ld_v3_global_f32 ($s2, $s3, $s4), [$d0 + 8]; - ld_v4_global_f32 ($s5, $s6, $s7, $s8), [$d0 + 20]; - - add_f32 $s9, $s0, $s1; - combine_v2_b64_b32 $d2, ($s1, $s0); - combine_v2_b64_b32 $d3, ($s2, $s3); - - add_pp_f32x2 $d4, $d2, $d3; - - expand_v2_b32_b64 ($s0, $s3), $d4; - - ld_kernarg_u64 $d1, [%output_ptr]; - st_v2_global_f32 ($s0, $s1), [$d1]; - st_v3_global_f32 ($s2, $s3, $s4), [$d1 + 8]; - st_v4_global_f32 ($s5, $s6, $s7, $s8), [$d1 + 20]; - - ret; -}; - -/* The v2 load is done via casting to a vector datatype ptr. */ -/* { dg-final { scan-tree-dump " = MEM\\\[\\\(vector\\\(2\\\) \\\*\\\)" "original"} } */ - -/* The v3 load is scalarized (at the moment) due to gcc requiring 2's exponent wide vectors. */ -/* { dg-final { scan-tree-dump "s0 = .*BIT_FIELD_REF \\\)?;\[\n ]+s1 = .*BIT_FIELD_REF \\\)?;" "original"} } */ - -/* The v4 load is done via casting to a vector datatype ptr. */ -/* { dg-final { scan-tree-dump " = MEM\\\[\\\(vector\\\(4\\\) \\\*\\\)" "original"} } */ - -/* The combines are generated to vector constructors. */ -/* { dg-final { scan-tree-dump "{.*s1\\\)?, .*s0\\\)?}" "original"} } */ -/* { dg-final { scan-tree-dump "{.*s2\\\)?, .*s3\\\)?}" "original"} } */ - -/* Expands to BIT_FIELD_REFs. */ -/* { dg-final { scan-tree-dump "s0 = \(VIEW_CONVERT_EXPR.*\\\(\)?BIT_FIELD_REF \\\)?;" "original"} } */ -/* { dg-final { scan-tree-dump "s3 = \(VIEW_CONVERT_EXPR.*\\\(\)?BIT_FIELD_REF \\\)?;" "original"} } */ - -/* The v1 store is done via casting to a vector datatype ptr and constructing a vector from the inputs. */ -/* { dg-final { scan-tree-dump "MEM\\\[\\\(vector\\\(2\\\) \\\*\\\)\\\( \\\*\\\) d1\\\] = " "original"} } */ - -/* The v3 store is scalarized (at the moment) due to gcc requiring 2's exponent wide vectors. */ -/* { dg-final { scan-tree-dump "\\\*\\\( \\\*\\\) \\\(\\\(sizetype\\\) d1 \\\+ 8\\\) \\\+ 0 = VIEW_CONVERT_EXPR<>\\\(s2\\\);" "original"} } */ -/* { dg-final { scan-tree-dump "\\\*\\\( \\\*\\\) \\\(\\\(sizetype\\\) d1 \\\+ 8\\\) \\\+ 4 = VIEW_CONVERT_EXPR<>\\\(s3\\\);" "original"} } */ -/* { dg-final { scan-tree-dump "\\\*\\\( \\\*\\\) \\\(\\\(sizetype\\\) d1 \\\+ 8\\\) \\\+ 8 = VIEW_CONVERT_EXPR<>\\\(s4\\\);" "original"} } */ - -/* The v4 store is done via casting to a vector datatype and constructing a vector from the inputs. */ -/* { dg-final { scan-tree-dump "MEM\\\[\\\(vector\\\(4\\\) \\\*\\\)\\\( \\\*\\\) \\\(\\\(sizetype\\\) d1 \\\+ 20\\\)\\\] = {VIEW_CONVERT_EXPR<>\\\(s5\\\), VIEW_CONVERT_EXPR<>\\\(s6\\\), VIEW_CONVERT_EXPR<>\\\(s7\\\), VIEW_CONVERT_EXPR<>\\\(s8\\\)};" "original"} } */ diff --git a/gcc/testsuite/gfortran.dg/goacc/pr78027.f90 b/gcc/testsuite/gfortran.dg/goacc/pr78027.f90 index cf13ff7..415e3a1 100644 --- a/gcc/testsuite/gfortran.dg/goacc/pr78027.f90 +++ b/gcc/testsuite/gfortran.dg/goacc/pr78027.f90 @@ -1,9 +1,5 @@ ! { dg-additional-options "-fopenmp -O2 -fdump-ipa-icf" } -! f951: warning: could not emit HSAIL for the function [-Whsa] -! f951: note: HSA does not support functions with variadic arguments (or unknown return type): 'GOACC_parallel_keyed' -! { dg-additional-options "-Wno-hsa" } - real function f() !$omp declare target(f) f = 1. diff --git a/gcc/testsuite/lib/brig-dg.exp b/gcc/testsuite/lib/brig-dg.exp deleted file mode 100644 index 41c55f9..0000000 --- a/gcc/testsuite/lib/brig-dg.exp +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright (C) 2009-2021 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GCC; see the file COPYING3. If not see -# . - -load_lib gcc-dg.exp - -# Define brig callbacks for dg.exp. - -proc brig-dg-test { prog do_what extra_tool_flags } { - set result \ - [gcc-dg-test-1 brig_target_compile $prog $do_what $extra_tool_flags] - - set comp_output [lindex $result 0] - set output_file [lindex $result 1] - - return [list $comp_output $output_file] -} diff --git a/gcc/testsuite/lib/brig.exp b/gcc/testsuite/lib/brig.exp deleted file mode 100644 index d82cd88..0000000 --- a/gcc/testsuite/lib/brig.exp +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright (C) 2009-2021 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GCC; see the file COPYING3. If not see -# . - -load_lib prune.exp -load_lib gcc-defs.exp -load_lib timeout.exp -load_lib target-libpath.exp -# -# brig_target_compile -- compile a HSAIL input to BRIG using HSAILasm and then -# compile the BRIG to target ISA using gcc - -proc brig_target_compile { source dest type options } { - global tmpdir - global testname_with_flags - if { [file extension $source] == ".hsail" } { - # We cannot assume all inputs are .hsail as the dg machinery - # calls this for a some c files to check linker plugin support or - # similar. - set brig_source ${tmpdir}/[file rootname [file tail ${source}]].brig - exec HSAILasm $source -o ${brig_source} - set source ${brig_source} - # Change the testname the .brig. - set testname_with_flags [file tail $source] - } - return [target_compile $source $dest $type $options] -} - -- cgit v1.1 From 010d4a5047166037b316ed22331f3d99742f1f1d Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 11 May 2021 09:53:20 -0400 Subject: c++: ICE casting class to vector [PR100517] My recent change to reject calling rvalue() with an argument of class type crashes on this testcase, where we use rvalue() on what we expect to be an argument of integer or vector type. Fixed by checking first. gcc/cp/ChangeLog: PR c++/100517 * typeck.c (build_reinterpret_cast_1): Check intype on cast to vector. gcc/testsuite/ChangeLog: PR c++/100517 * g++.dg/ext/vector41.C: New test. --- gcc/testsuite/g++.dg/ext/vector41.C | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 gcc/testsuite/g++.dg/ext/vector41.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/ext/vector41.C b/gcc/testsuite/g++.dg/ext/vector41.C new file mode 100644 index 0000000..bfc3bb6 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/vector41.C @@ -0,0 +1,12 @@ +// PR c++/100517 +// { dg-options "" } + +typedef int __v2si __attribute__ ((__vector_size__ (8))); + +struct S { }; + +void +f (S s) +{ + (void) reinterpret_cast<__v2si> (s); // { dg-error "" } +} -- cgit v1.1 From 5ea40269a77a3754dd0f610f7c09b1a372e3c7f7 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Tue, 11 May 2021 14:25:55 +0000 Subject: preprocessor: Enable digit separators for C2X C2X adds digit separators, as in C++. Enable them accordingly in libcpp and c-lex.c. Some basic tests are added that digit separators behave as expected for C2X and are properly disabled for C11; further test coverage is included in the existing g++.dg/cpp1y/digit-sep*.C tests. Bootstrapped with no regressions for x86_64-pc-linux-gnu. gcc/c-family/ * c-lex.c (interpret_float): Handle digit separators for C2X. libcpp/ * init.c (lang_defaults): Enable digit separators for GNUC2X and STDC2X. gcc/testsuite/ * gcc.dg/c11-digit-separators-1.c, gcc.dg/c2x-digit-separators-1.c, gcc.dg/c2x-digit-separators-2.c: New tests. --- gcc/testsuite/gcc.dg/c11-digit-separators-1.c | 7 +++++ gcc/testsuite/gcc.dg/c2x-digit-separators-1.c | 39 +++++++++++++++++++++++++++ gcc/testsuite/gcc.dg/c2x-digit-separators-2.c | 25 +++++++++++++++++ 3 files changed, 71 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/c11-digit-separators-1.c create mode 100644 gcc/testsuite/gcc.dg/c2x-digit-separators-1.c create mode 100644 gcc/testsuite/gcc.dg/c2x-digit-separators-2.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/c11-digit-separators-1.c b/gcc/testsuite/gcc.dg/c11-digit-separators-1.c new file mode 100644 index 0000000..fc83226 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c11-digit-separators-1.c @@ -0,0 +1,7 @@ +/* Test C2x digit separators not in C11. */ +/* { dg-do compile } */ +/* { dg-options "-std=c11 -pedantic-errors" } */ + +#define m(x) 0 + +_Static_assert (m(1'2)+(3'4) == 0, "digit separators"); diff --git a/gcc/testsuite/gcc.dg/c2x-digit-separators-1.c b/gcc/testsuite/gcc.dg/c2x-digit-separators-1.c new file mode 100644 index 0000000..6eadf2e --- /dev/null +++ b/gcc/testsuite/gcc.dg/c2x-digit-separators-1.c @@ -0,0 +1,39 @@ +/* Test C2x digit separators. Valid usages. */ +/* { dg-do run } */ +/* { dg-options "-std=c2x -pedantic-errors" } */ + +_Static_assert (123'45'6 == 123456); +_Static_assert (0'123 == 0123); +_Static_assert (0x1'23 == 0x123); + +#define m(x) 0 + +_Static_assert (m(1'2)+(3'4) == 34); + +_Static_assert (0x0'e-0xe == 0); + +#define a0 '.' - +#define acat(x) a ## x +_Static_assert (acat (0'.') == 0); + +#define c0(x) 0 +#define b0 c0 ( +#define bcat(x) b ## x +_Static_assert (bcat (0'\u00c0')) == 0); + +extern void exit (int); +extern void abort (void); + +int +main (void) +{ + if (314'159e-0'5f != 3.14159f) + abort (); + exit (0); +} + +#line 0'123 +_Static_assert (__LINE__ == 123); + +#line 4'56'7'8'9 +_Static_assert (__LINE__ == 456789); diff --git a/gcc/testsuite/gcc.dg/c2x-digit-separators-2.c b/gcc/testsuite/gcc.dg/c2x-digit-separators-2.c new file mode 100644 index 0000000..d72f8ad --- /dev/null +++ b/gcc/testsuite/gcc.dg/c2x-digit-separators-2.c @@ -0,0 +1,25 @@ +/* Test C2x digit separators. Invalid usages. */ +/* { dg-do compile } */ +/* { dg-options "-std=c2x -pedantic-errors" } */ + +void +tf (void) +{ + int i; + i = 1''2; /* { dg-error "adjacent digit separators" } */ + i = 0x'0; /* { dg-error "digit separator after base indicator" } */ + i = 0X'1; /* { dg-error "digit separator after base indicator" } */ + i = 0b'0; /* { dg-error "digit separator after base indicator" } */ + i = 0B'1; /* { dg-error "digit separator after base indicator" } */ + i = 1'u; /* { dg-error "digit separator outside digit sequence" } */ + float f = 1.2e-3'f; /* { dg-error "digit separator outside digit sequence" } */ + i = 1'2'3'; /* { dg-error "12:missing terminating" } */ + ; + double d; + d = 1'.2'3e-4; /* { dg-warning "multi-character" } */ + /* { dg-error "expected" "parse error" { target *-*-* } .-1 } */ + d = 1.2''3; /* { dg-error "adjacent digit separators" } */ + d = 1.23e-4''5; /* { dg-error "adjacent digit separators" } */ + d = 1.2'3e-4'5'; /* { dg-error "17:missing terminating" } */ + /* { dg-error "expected" "parse error" { target *-*-* } .-1 } */ +} -- cgit v1.1 From 21dfb22920ce32fcf336eac4513fa44de28819e0 Mon Sep 17 00:00:00 2001 From: Stefan Schulze Frielinghaus Date: Tue, 11 May 2021 19:33:37 +0200 Subject: testsuite: Fix input operands of gcc.dg/guality/pr43077-1.c The type of the output operands *p and *q of the extended asm statement of function foo is unsigned long whereas the type of the corresponding input operands is int. This results, e.g. on IBM Z, in the case that the immediates 2 and 3 are written into registers in SI mode and read in DI mode resulting in wrong values. Fixed by lifting the input operands to type long. gcc/testsuite/ChangeLog: * gcc.dg/guality/pr43077-1.c: Align types of output and input operands by lifting immediates to type long. --- gcc/testsuite/gcc.dg/guality/pr43077-1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/guality/pr43077-1.c b/gcc/testsuite/gcc.dg/guality/pr43077-1.c index 39bd26a..2d93762 100644 --- a/gcc/testsuite/gcc.dg/guality/pr43077-1.c +++ b/gcc/testsuite/gcc.dg/guality/pr43077-1.c @@ -24,7 +24,7 @@ int __attribute__((noinline)) foo (unsigned long *p, unsigned long *q) { int ret; - asm volatile ("" : "=r" (ret), "=r" (*p), "=r" (*q) : "0" (1), "1" (2), "2" (3)); + asm volatile ("" : "=r" (ret), "=r" (*p), "=r" (*q) : "0" (1), "1" (2l), "2" (3l)); return ret; } -- cgit v1.1 From 3e3fdf3d5217e5a2d075ca399b557b2e886dcd18 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Tue, 11 May 2021 18:54:32 +0000 Subject: preprocessor: Fix cpp_avoid_paste for digit separators The libcpp function cpp_avoid_paste is used to insert whitespace in preprocessed output where needed to avoid two consecutive preprocessing tokens, that logically (e.g. when stringized) do not have whitespace between them, from being incorrectly lexed as one when the preprocessed input is reread by a compiler. This fails to allow for digit separators, so meaning that invalid code, that has a CPP_NUMBER (from a macro expansion) followed by a character literal, can result in preprocessed output with a valid use of digit separators, so that required syntax errors do not occur when compiling with -save-temps. Fix this by handling that case in cpp_avoid_paste (as with other cases in cpp_avoid_paste, this doesn't try to check whether the language version in use supports digit separators; it's always OK to have unnecessary whitespace in preprocessed output). Note: there are other cases, with various kinds of wide character or string literal following a CPP_NUMBER, where spurious pasting of preprocessing tokens can occur but the sequence of tokens remains invalid both before and after that pasting. Maybe cpp_avoid_paste should also handle those cases (and similar cases after a CPP_NAME), to ensure the sequence of preprocessing tokens in preprocessed output is exactly right, whether or not it affects whether syntax errors occur. This patch only addresses the case with digit separators where invalid code can fail to be diagnosed without the space inserted. Bootstrapped with no regressions for x86_64-pc-linux-gnu. libcpp/ * lex.c (cpp_avoid_paste): Do not allow pasting CPP_NUMBER with CPP_CHAR. gcc/testsuite/ * g++.dg/cpp1y/digit-sep-paste.C, gcc.dg/c2x-digit-separators-3.c: New tests. --- gcc/testsuite/g++.dg/cpp1y/digit-sep-paste.C | 11 +++++++++++ gcc/testsuite/gcc.dg/c2x-digit-separators-3.c | 12 ++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1y/digit-sep-paste.C create mode 100644 gcc/testsuite/gcc.dg/c2x-digit-separators-3.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp1y/digit-sep-paste.C b/gcc/testsuite/g++.dg/cpp1y/digit-sep-paste.C new file mode 100644 index 0000000..41fb967 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/digit-sep-paste.C @@ -0,0 +1,11 @@ +// Test token pasting with digit separators avoided for preprocessed output. +// { dg-do compile { target c++14 } } +// { dg-options "-save-temps" } + +#define ZERO 0 + +int +f () +{ + return ZERO'0'0; /* { dg-error "expected" } */ +} diff --git a/gcc/testsuite/gcc.dg/c2x-digit-separators-3.c b/gcc/testsuite/gcc.dg/c2x-digit-separators-3.c new file mode 100644 index 0000000..cddb88f --- /dev/null +++ b/gcc/testsuite/gcc.dg/c2x-digit-separators-3.c @@ -0,0 +1,12 @@ +/* Test C2x digit separators. Test token pasting avoided for preprocessed + output. */ +/* { dg-do compile } */ +/* { dg-options "-std=c2x -save-temps" } */ + +#define ZERO 0 + +int +f (void) +{ + return ZERO'0'0; /* { dg-error "expected" } */ +} -- cgit v1.1 From 71d38ec80008afdbb9a059253407d80598b765c0 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Tue, 11 May 2021 23:54:01 +0000 Subject: preprocessor: Support C2X #elifdef, #elifndef C2X adds #elifdef and #elifndef preprocessor directives; these have also been proposed for C++. Implement these directives in libcpp accordingly. In this implementation, #elifdef and #elifndef are treated as non-directives for any language version other than c2x and gnu2x (if the feature is accepted for C++, it can trivially be enabled for relevant C++ versions). In strict conformance modes for prior language versions, this is required, as illustrated by the c11-elifdef-1.c test added. Bootstrapped with no regressions for x86_64-pc-linux-gnu. libcpp/ * include/cpplib.h (struct cpp_options): Add elifdef. * init.c (struct lang_flags): Add elifdef. (lang_defaults): Update to include elifdef initializers. (cpp_set_lang): Set elifdef for pfile based on language. * directives.c (STDC2X, ELIFDEF): New macros. (EXTENSION): Increase value to 3. (DIRECTIVE_TABLE): Add #elifdef and #elifndef. (_cpp_handle_directive): Do not treat ELIFDEF directives as directives for language versions without the #elifdef feature. (do_elif): Handle #elifdef and #elifndef. (do_elifdef, do_elifndef): New functions. gcc/testsuite/ * gcc.dg/cpp/c11-elifdef-1.c, gcc.dg/cpp/c2x-elifdef-1.c, gcc.dg/cpp/c2x-elifdef-2.c: New tests. --- gcc/testsuite/gcc.dg/cpp/c11-elifdef-1.c | 16 ++++++++ gcc/testsuite/gcc.dg/cpp/c2x-elifdef-1.c | 57 +++++++++++++++++++++++++++++ gcc/testsuite/gcc.dg/cpp/c2x-elifdef-2.c | 63 ++++++++++++++++++++++++++++++++ 3 files changed, 136 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/cpp/c11-elifdef-1.c create mode 100644 gcc/testsuite/gcc.dg/cpp/c2x-elifdef-1.c create mode 100644 gcc/testsuite/gcc.dg/cpp/c2x-elifdef-2.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/cpp/c11-elifdef-1.c b/gcc/testsuite/gcc.dg/cpp/c11-elifdef-1.c new file mode 100644 index 0000000..2d5809a --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/c11-elifdef-1.c @@ -0,0 +1,16 @@ +/* Test #elifdef and #elifndef not in C11. */ +/* { dg-do preprocess } */ +/* { dg-options "-std=c11 -pedantic-errors" } */ + +#define A +#undef B + +#if 0 +#elifdef A +#error "#elifdef A applied" +#endif + +#if 0 +#elifndef B +#error "#elifndef B applied" +#endif diff --git a/gcc/testsuite/gcc.dg/cpp/c2x-elifdef-1.c b/gcc/testsuite/gcc.dg/cpp/c2x-elifdef-1.c new file mode 100644 index 0000000..b23e311 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/c2x-elifdef-1.c @@ -0,0 +1,57 @@ +/* Test #elifdef and #elifndef in C2x. */ +/* { dg-do preprocess } */ +/* { dg-options "-std=c2x -pedantic-errors" } */ + +#define A +#undef B + +#if 0 +#elifdef A +#define M1 1 +#endif + +#if M1 != 1 +#error "#elifdef A did not apply" +#endif + +#if 0 +#elifdef B +#error "#elifdef B applied" +#endif + +#if 0 +#elifndef A +#error "#elifndef A applied" +#endif + +#if 0 +#elifndef B +#define M2 2 +#endif + +#if M2 != 2 +#error "#elifndef B did not apply" +#endif + +#if 0 +#elifdef A +#else +#error "#elifdef A did not apply" +#endif + +#if 0 +#elifndef B +#else +#error "#elifndef B did not apply" +#endif + +/* As with #elif, the syntax of the new directives is relaxed after a + non-skipped group. */ + +#if 1 +#elifdef x * y +#endif + +#if 1 +#elifndef ! +#endif diff --git a/gcc/testsuite/gcc.dg/cpp/c2x-elifdef-2.c b/gcc/testsuite/gcc.dg/cpp/c2x-elifdef-2.c new file mode 100644 index 0000000..9132832 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/c2x-elifdef-2.c @@ -0,0 +1,63 @@ +/* Test #elifdef and #elifndef in C2x: erroneous usages. */ +/* { dg-do preprocess } */ +/* { dg-options "-std=c2x -pedantic-errors" } */ + +#define A +#undef B + +#elifdef A /* { dg-error "#elifdef without #if" } */ +#elifdef B /* { dg-error "#elifdef without #if" } */ +#elifndef A /* { dg-error "#elifndef without #if" } */ +#elifndef B /* { dg-error "#elifndef without #if" } */ + +#if 1 /* { dg-error "-:began here" } */ +#else +#elifdef A /* { dg-error "#elifdef after #else" } */ +#endif + +#if 1 /* { dg-error "-:began here" } */ +#else +#elifdef B /* { dg-error "#elifdef after #else" } */ +#endif + +#if 1 /* { dg-error "-:began here" } */ +#else +#elifndef A /* { dg-error "#elifndef after #else" } */ +#endif + +#if 1 /* { dg-error "-:began here" } */ +#else +#elifndef B /* { dg-error "#elifndef after #else" } */ +#endif + +#if 0 +#elifdef A = /* { dg-error "extra tokens at end of #elifdef directive" } */ +#endif + +#if 0 +#elifdef B = /* { dg-error "extra tokens at end of #elifdef directive" } */ +#endif + +#if 0 +#elifndef A = /* { dg-error "extra tokens at end of #elifndef directive" } */ +#endif + +#if 0 +#elifndef B = /* { dg-error "extra tokens at end of #elifndef directive" } */ +#endif + +#if 0 +#elifdef /* { dg-error "no macro name given in #elifdef directive" } */ +#endif + +#if 0 +#elifndef /* { dg-error "no macro name given in #elifndef directive" } */ +#endif + +#if 0 +#elifdef , /* { dg-error "macro names must be identifiers" } */ +#endif + +#if 0 +#elifndef , /* { dg-error "macro names must be identifiers" } */ +#endif -- cgit v1.1 From b1f7fd8a2a5558da1e101de11bb1cdba081ce010 Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Wed, 12 May 2021 08:11:18 +0200 Subject: i386: Implement FP vector compares for V2SFmode [PR98218] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implement FP vector compares for V2SFmode for TARGET_MMX_WITH_SSE. 2021-05-12 UroÅ¡ Bizjak gcc/ PR target/98218 * config/i386/i386-expand.c (ix86_expand_sse_movcc): Handle V2SF mode. * config/i386/mmx.md (MMXMODE124): New mode iterator. (V2FI): Ditto. (mmxintvecmode): New mode attribute. (mmxintvecmodelower): Ditto. (*mmx_maskcmpv2sf3_comm): New insn pattern. (*mmx_maskcmpv2sf3): Ditto. (vec_cmpv2sfv2si): New expander. (vcondv2si): Ditto. (mmx_vlendvps): New insn pattern. (vcond): Also handle V2SFmode. (vcondu): Ditto. (vcond_mask_): Ditto. gcc/testsuite/ PR target/98218 * g++.target/i386/pr98218-1.C: Ditto. * gcc.target/i386/pr98218-4.c: New test. * gcc.target/i386/pr98218-1.c: Correct PR number. * gcc.target/i386/pr98218-1a.c: Ditto. * gcc.target/i386/pr98218-2.c: Ditto. * gcc.target/i386/pr98218-2a.c: Ditto. * gcc.target/i386/pr98218-3.c: Ditto. * gcc.target/i386/pr98218-3a.c: Ditto. --- gcc/testsuite/g++.target/i386/pr98218-1.C | 20 ++++++++++++++++++++ gcc/testsuite/gcc.target/i386/pr98218-1.c | 2 +- gcc/testsuite/gcc.target/i386/pr98218-1a.c | 2 +- gcc/testsuite/gcc.target/i386/pr98218-2.c | 2 +- gcc/testsuite/gcc.target/i386/pr98218-2a.c | 2 +- gcc/testsuite/gcc.target/i386/pr98218-3.c | 2 +- gcc/testsuite/gcc.target/i386/pr98218-3a.c | 2 +- gcc/testsuite/gcc.target/i386/pr98218-4.c | 16 ++++++++++++++++ 8 files changed, 42 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/g++.target/i386/pr98218-1.C create mode 100644 gcc/testsuite/gcc.target/i386/pr98218-4.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.target/i386/pr98218-1.C b/gcc/testsuite/g++.target/i386/pr98218-1.C new file mode 100644 index 0000000..61ea4bf --- /dev/null +++ b/gcc/testsuite/g++.target/i386/pr98218-1.C @@ -0,0 +1,20 @@ +/* PR target/98218 */ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-O2 -msse2" } */ + +typedef unsigned int __attribute__((__vector_size__ (8))) v64u32; +typedef int __attribute__((__vector_size__ (8))) v64s32; +typedef float __attribute__((__vector_size__ (8))) v64f32; + +v64u32 au, bu; +v64s32 as, bs; +v64f32 af, bf; + +v64u32 tu (v64f32 a, v64f32 b) { return (a > b) ? au : bu; } +v64s32 ts (v64f32 a, v64f32 b) { return (a > b) ? as : bs; } +v64f32 fu (v64u32 a, v64u32 b) { return (a > b) ? af : bf; } +v64f32 fs (v64s32 a, v64s32 b) { return (a > b) ? af : bf; } +v64f32 ff (v64f32 a, v64f32 b) { return (a > b) ? af : bf; } + +/* { dg-final { scan-assembler-times "cmpltps" 3 } } */ +/* { dg-final { scan-assembler-times "pcmpgtd" 2 } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr98218-1.c b/gcc/testsuite/gcc.target/i386/pr98218-1.c index 48407da..9d6602c 100644 --- a/gcc/testsuite/gcc.target/i386/pr98218-1.c +++ b/gcc/testsuite/gcc.target/i386/pr98218-1.c @@ -1,4 +1,4 @@ -/* PR target/98522 */ +/* PR target/98218 */ /* { dg-do compile { target { ! ia32 } } } */ /* { dg-options "-O2 -msse2" } */ diff --git a/gcc/testsuite/gcc.target/i386/pr98218-1a.c b/gcc/testsuite/gcc.target/i386/pr98218-1a.c index 3470c87..2610438 100644 --- a/gcc/testsuite/gcc.target/i386/pr98218-1a.c +++ b/gcc/testsuite/gcc.target/i386/pr98218-1a.c @@ -1,4 +1,4 @@ -/* PR target/98522 */ +/* PR target/98218 */ /* { dg-do compile { target { ! ia32 } } } */ /* { dg-options "-O2 -ftree-vectorize -msse2" } */ diff --git a/gcc/testsuite/gcc.target/i386/pr98218-2.c b/gcc/testsuite/gcc.target/i386/pr98218-2.c index 0b71612..948bf4f 100644 --- a/gcc/testsuite/gcc.target/i386/pr98218-2.c +++ b/gcc/testsuite/gcc.target/i386/pr98218-2.c @@ -1,4 +1,4 @@ -/* PR target/98522 */ +/* PR target/98218 */ /* { dg-do compile { target { ! ia32 } } } */ /* { dg-options "-O2 -msse2" } */ diff --git a/gcc/testsuite/gcc.target/i386/pr98218-2a.c b/gcc/testsuite/gcc.target/i386/pr98218-2a.c index 6afd0a4..73c7226 100644 --- a/gcc/testsuite/gcc.target/i386/pr98218-2a.c +++ b/gcc/testsuite/gcc.target/i386/pr98218-2a.c @@ -1,4 +1,4 @@ -/* PR target/98522 */ +/* PR target/98218 */ /* { dg-do compile { target { ! ia32 } } } */ /* { dg-options "-O2 -ftree-vectorize -msse2" } */ diff --git a/gcc/testsuite/gcc.target/i386/pr98218-3.c b/gcc/testsuite/gcc.target/i386/pr98218-3.c index 83a8c29..1b40d0ce 100644 --- a/gcc/testsuite/gcc.target/i386/pr98218-3.c +++ b/gcc/testsuite/gcc.target/i386/pr98218-3.c @@ -1,4 +1,4 @@ -/* PR target/98522 */ +/* PR target/98218 */ /* { dg-do compile { target { ! ia32 } } } */ /* { dg-options "-O2 -msse2" } */ diff --git a/gcc/testsuite/gcc.target/i386/pr98218-3a.c b/gcc/testsuite/gcc.target/i386/pr98218-3a.c index 272d54e..cf1d497 100644 --- a/gcc/testsuite/gcc.target/i386/pr98218-3a.c +++ b/gcc/testsuite/gcc.target/i386/pr98218-3a.c @@ -1,4 +1,4 @@ -/* PR target/98522 */ +/* PR target/98218 */ /* { dg-do compile { target { ! ia32 } } } */ /* { dg-options "-O2 -ftree-vectorize -msse2" } */ diff --git a/gcc/testsuite/gcc.target/i386/pr98218-4.c b/gcc/testsuite/gcc.target/i386/pr98218-4.c new file mode 100644 index 0000000..647bdb1 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr98218-4.c @@ -0,0 +1,16 @@ +/* PR target/98218 */ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-O2 -msse2" } */ + +typedef unsigned int __attribute__((__vector_size__ (8))) v64u32; +typedef int __attribute__((__vector_size__ (8))) v64s32; +typedef float __attribute__((__vector_size__ (8))) v64f32; + +v64u32 tu (v64f32 a, v64f32 b) { return a > b; } +v64s32 ts (v64f32 a, v64f32 b) { return a > b; } +v64f32 fu (v64u32 a, v64u32 b) { return a > b; } +v64f32 fs (v64s32 a, v64s32 b) { return a > b; } +v64f32 ff (v64f32 a, v64f32 b) { return a > b; } + +/* { dg-final { scan-assembler-times "cmpltps" 3 } } */ +/* { dg-final { scan-assembler-times "pcmpgtd" 2 } } */ -- cgit v1.1 From f5f1838435400b837c8677c53a611e2dc6d56442 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 12 May 2021 09:46:03 +0200 Subject: match.pd: Optimize (x & y) == x into (x & ~y) == 0 [PR94589] > Somewhere in RTL (_M_value&1)==_M_value is turned into (_M_value&-2)==0, > that could be worth doing already in GIMPLE. Apparently it is /* Simplify eq/ne (and/ior x y) x/y) for targets with a BICS instruction or constant folding if x/y is a constant. */ if ((code == EQ || code == NE) && (op0code == AND || op0code == IOR) && !side_effects_p (op1) && op1 != CONST0_RTX (cmp_mode)) { /* Both (eq/ne (and x y) x) and (eq/ne (ior x y) y) simplify to (eq/ne (and (not y) x) 0). */ ... /* Both (eq/ne (and x y) y) and (eq/ne (ior x y) x) simplify to (eq/ne (and (not x) y) 0). */ Yes, doing that on GIMPLE for the case where the not argument is constant would simplify the phiopt follow-up (it would be single imm use then). On Thu, May 06, 2021 at 09:42:41PM +0200, Marc Glisse wrote: > We can probably do it in 2 steps, first something like > > (for cmp (eq ne) > (simplify > (cmp (bit_and:c @0 @1) @0) > (cmp (@0 (bit_not! @1)) { build_zero_cst (TREE_TYPE (@0)); }))) > > to get rid of the double use, and then simplify X&C==0 to X<=~C if C is a > mask 111...000 (I thought we already had a function to detect such masks, or > the 000...111, but I can't find them anymore). Ok, here is the first step then. 2021-05-12 Jakub Jelinek Marc Glisse PR tree-optimization/94589 * match.pd ((X & Y) == X -> (X & ~Y) == 0, (X | Y) == Y -> (X & ~Y) == 0): New GIMPLE simplifications. * gcc.dg/tree-ssa/pr94589-1.c: New test. --- gcc/testsuite/gcc.dg/tree-ssa/pr94589-1.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr94589-1.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr94589-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr94589-1.c new file mode 100644 index 0000000..7e1aaaa --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr94589-1.c @@ -0,0 +1,21 @@ +/* PR tree-optimization/94589 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +int +foo (int x) +{ + return (x & 23) == x; +/* { dg-final { scan-tree-dump " & -24;" "optimized" } } */ +/* { dg-final { scan-tree-dump-not " & 23;" "optimized" } } */ +/* { dg-final { scan-tree-dump " == 0" "optimized" } } */ +} + +int +bar (int x) +{ + return (x | 137) != 137; +/* { dg-final { scan-tree-dump " & -138;" "optimized" } } */ +/* { dg-final { scan-tree-dump-not " \\| 137;" "optimized" } } */ +/* { dg-final { scan-tree-dump " != 0" "optimized" } } */ +} -- cgit v1.1 From 19040050aa2c8ee890fc58dda48639fc91bf0af0 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 12 May 2021 10:38:35 +0200 Subject: expand: Don't reuse DEBUG_EXPRs with vector type if they have different modes [PR100508] The inliner doesn't remap DEBUG_EXPR_DECLs, so the same decls can appear in multiple functions. Furthermore, expansion reuses corresponding DEBUG_EXPRs too, so they again can be reused in multiple functions. Neither of that is a major problem, DEBUG_EXPRs are just magic value holders and what value they stand for is independent in each function and driven by what debug stmts or DEBUG_INSNs they are bound to. Except for DEBUG_EXPR*s with vector types, TYPE_MODE can be either BLKmode or some vector mode depending on whether current function's enabled ISAs support that vector mode or not. On the following testcase, we expand it first in foo function without AVX2 enabled and so the DEBUG_EXPR is BLKmode, but later the same DEBUG_EXPR_DECL is used in a simd clone with AVX2 enabled and expansion ICEs because of a mode mismatch. The following patch fixes that by forcing recreation of a DEBUG_EXPR if there is a mode mismatch for vector typed DEBUG_EXPR_DECL, DEBUG_EXPRs will be still reused in between functions otherwise and within the same function the mode should be always the same. 2021-05-12 Jakub Jelinek PR middle-end/100508 * cfgexpand.c (expand_debug_expr): For DEBUG_EXPR_DECL with vector type, don't reuse DECL_RTL if it has different mode, instead force creation of a new DEBUG_EXPR. * gcc.dg/gomp/pr100508.c: New test. --- gcc/testsuite/gcc.dg/gomp/pr100508.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/gomp/pr100508.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/gomp/pr100508.c b/gcc/testsuite/gcc.dg/gomp/pr100508.c new file mode 100644 index 0000000..c3fa2fc --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/pr100508.c @@ -0,0 +1,14 @@ +/* PR middle-end/100508 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -g -fopenmp-simd" } */ + +typedef int __attribute__((__vector_size__(32))) V; +V j; + +#pragma omp declare simd +int +foo (void) +{ + V m = j; + return 0; +} -- cgit v1.1 From 037e36611108283a729d94a8ae15962995742886 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 12 May 2021 08:51:03 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 99 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 75e235b..fd12630 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,102 @@ +2021-05-12 Jakub Jelinek + + PR middle-end/100508 + * gcc.dg/gomp/pr100508.c: New test. + +2021-05-12 Jakub Jelinek + Marc Glisse + + PR tree-optimization/94589 + * gcc.dg/tree-ssa/pr94589-1.c: New test. + +2021-05-12 UroÅ¡ Bizjak + + PR target/98218 + * g++.target/i386/pr98218-1.C: Ditto. + * gcc.target/i386/pr98218-4.c: New test. + * gcc.target/i386/pr98218-1.c: Correct PR number. + * gcc.target/i386/pr98218-1a.c: Ditto. + * gcc.target/i386/pr98218-2.c: Ditto. + * gcc.target/i386/pr98218-2a.c: Ditto. + * gcc.target/i386/pr98218-3.c: Ditto. + * gcc.target/i386/pr98218-3a.c: Ditto. + +2021-05-11 Joseph Myers + + * gcc.dg/cpp/c11-elifdef-1.c, gcc.dg/cpp/c2x-elifdef-1.c, + gcc.dg/cpp/c2x-elifdef-2.c: New tests. + +2021-05-11 Joseph Myers + + * g++.dg/cpp1y/digit-sep-paste.C, gcc.dg/c2x-digit-separators-3.c: + New tests. + +2021-05-11 Stefan Schulze Frielinghaus + + * gcc.dg/guality/pr43077-1.c: Align types of output and input + operands by lifting immediates to type long. + +2021-05-11 Joseph Myers + + * gcc.dg/c11-digit-separators-1.c, + gcc.dg/c2x-digit-separators-1.c, gcc.dg/c2x-digit-separators-2.c: + New tests. + +2021-05-11 Jason Merrill + + PR c++/100517 + * g++.dg/ext/vector41.C: New test. + +2021-05-11 Martin Liska + + * gfortran.dg/goacc/pr78027.f90: Remove -Wno-hsa option. + * brig.dg/README: Removed. + * brig.dg/dg.exp: Removed. + * brig.dg/test/gimple/alloca.hsail: Removed. + * brig.dg/test/gimple/atomics.hsail: Removed. + * brig.dg/test/gimple/branches.hsail: Removed. + * brig.dg/test/gimple/fbarrier.hsail: Removed. + * brig.dg/test/gimple/function_calls.hsail: Removed. + * brig.dg/test/gimple/internal-casts.hsail: Removed. + * brig.dg/test/gimple/kernarg.hsail: Removed. + * brig.dg/test/gimple/mem.hsail: Removed. + * brig.dg/test/gimple/mulhi.hsail: Removed. + * brig.dg/test/gimple/packed.hsail: Removed. + * brig.dg/test/gimple/priv-array-offset-access.hsail: Removed. + * brig.dg/test/gimple/smoke_test.hsail: Removed. + * brig.dg/test/gimple/variables.hsail: Removed. + * brig.dg/test/gimple/vector.hsail: Removed. + * lib/brig-dg.exp: Removed. + * lib/brig.exp: Removed. + +2021-05-11 Alex Coplan + + PR target/99725 + * gcc.target/arm/cmse/pr99725.c: New test. + +2021-05-11 Richard Sandiford + + * gcc.target/aarch64/fmul_lane_1.c: New test. + +2021-05-11 Richard Biener + + PR middle-end/100509 + * gcc.dg/pr100509.c: New testcase. + +2021-05-11 Robin Dapp + + * gcc.target/s390/risbg-ll-3.c: Change match pattern. + +2021-05-11 Patrick Palka + + PR c++/51577 + * g++.dg/lookup/operator-3.C: New test. + +2021-05-11 Patrick Palka + + PR c++/100138 + * g++.dg/cpp2a/concepts-ctad4.C: New test. + 2021-05-10 Eric Botcazou * gnat.dg/specs/opt5.ads: New test. -- cgit v1.1 From 1ecd1e6c894fbdbc10fdcfee419922b24e1115ee Mon Sep 17 00:00:00 2001 From: Bernd Edlinger Date: Tue, 11 May 2021 17:55:18 +0200 Subject: Fix ICE in output_rnglists, at dwarf2out.c:12294 In this testcase the compile unit consists of a single text section with a single embedded DECL_IGNORED_P function. So we have a kind of multi-range text section here. To avoid an ICE in output_rnglists we need to make sure that have_multiple_function_sections is set to true. This is a regression from e69ac020372 ("Add line debug info for virtual thunks") 2021-05-12 Bernd Edlinger PR debug/100515 * dwarf2out.c (dwarf2out_finish): Set have_multiple_function_sections with multi-range text_section. * gcc.dg/debug/dwarf2/pr100515.c: New testcase. --- gcc/testsuite/gcc.dg/debug/dwarf2/pr100515.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/debug/dwarf2/pr100515.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/pr100515.c b/gcc/testsuite/gcc.dg/debug/dwarf2/pr100515.c new file mode 100644 index 0000000..7c72fcd --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/pr100515.c @@ -0,0 +1,19 @@ +/* PR debug/100515 */ +/* { dg-do compile } */ +/* { dg-options "-g -O2 -fopenmp" } */ + +void +foo (int x) +{ +#pragma omp taskloop + for (int i = 0; i < x; i++) + ; +} + +void +bar (int x) +{ +#pragma omp taskloop + for (int i = 0; i < x; i++) + ; +} -- cgit v1.1 From cd36bbb2281ada10b5e1df143ecf64b88cdb8119 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 11 May 2021 14:59:59 +0200 Subject: tree-optimization/100519 - avoid reassociating asm goto defs This splits can_associate_p into checks for SSA defs and checks for the type so it can be called from is_reassociable_op to catch cases not catched by the earlier fix. 2021-05-11 Richard Biener PR tree-optimization/100519 * tree-ssa-reassoc.c (can_associate_p): Split into... (can_associate_op_p): ... this (can_associate_type_p): ... and this. (is_reassociable_op): Call can_associate_op_p. (break_up_subtract_bb): Call the appropriate predicates. (reassociate_bb): Likewise. * gcc.dg/torture/pr100519.c: New testcase. --- gcc/testsuite/gcc.dg/torture/pr100519.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/torture/pr100519.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/torture/pr100519.c b/gcc/testsuite/gcc.dg/torture/pr100519.c new file mode 100644 index 0000000..faf6e24 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr100519.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-additional-options "--param tree-reassoc-width=2" } */ + +unsigned int foo_a1, foo_a2; + +unsigned int foo() +{ + unsigned int v0, x; + asm goto("" : "=r"(x) : : : lab); +lab: + v0 += x + x; + return v0 + x + foo_a1 + foo_a2; +} -- cgit v1.1 From 8da3b309d8fb3ddec0b42218ca6762967b402dc3 Mon Sep 17 00:00:00 2001 From: liuhongt Date: Wed, 7 Apr 2021 09:58:54 +0800 Subject: i386: Optimize vpblendvb on inverted mask register to vpblendvb on swapping the order of operand 1 and operand 2. [PR target/99908] - vpcmpeqd %ymm3, %ymm3, %ymm3 - vpandn %ymm3, %ymm2, %ymm2 - vpblendvb %ymm2, %ymm1, %ymm0, %ymm0 + vpblendvb %ymm2, %ymm0, %ymm1, %ymm0 gcc/ChangeLog: PR target/99908 * config/i386/sse.md (_pblendvb): Add splitters for pblendvb of NOT mask register. gcc/testsuite/ChangeLog: PR target/99908 * gcc.target/i386/avx2-pr99908.c: New test. * gcc.target/i386/sse4_1-pr99908.c: New test. --- gcc/testsuite/gcc.target/i386/avx2-pr99908.c | 25 +++++++++++++++++++++++++ gcc/testsuite/gcc.target/i386/sse4_1-pr99908.c | 23 +++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/avx2-pr99908.c create mode 100644 gcc/testsuite/gcc.target/i386/sse4_1-pr99908.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/i386/avx2-pr99908.c b/gcc/testsuite/gcc.target/i386/avx2-pr99908.c new file mode 100644 index 0000000..2775f3b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx2-pr99908.c @@ -0,0 +1,25 @@ +/* PR target/99908 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -mavx2 -masm=att" } */ +/* { dg-final { scan-assembler-times "\tvpblendvb\t" 2 } } */ +/* { dg-final { scan-assembler-not "\tvpcmpeq" } } */ +/* { dg-final { scan-assembler-not "\tvpandn" } } */ + +#include + +__m256i +f1 (__m256i a, __m256i b, __m256i mask) +{ + return _mm256_blendv_epi8(a, b, + _mm256_andnot_si256(mask, _mm256_set1_epi8(255))); +} + +__m256i +f2 (__v32qi x, __v32qi a, __v32qi b) +{ + x ^= (__v32qi) { -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1 }; + return _mm256_blendv_epi8 ((__m256i) a, (__m256i) b, (__m256i) x); +} diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-pr99908.c b/gcc/testsuite/gcc.target/i386/sse4_1-pr99908.c new file mode 100644 index 0000000..c13e730 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/sse4_1-pr99908.c @@ -0,0 +1,23 @@ +/* PR target/99908 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -msse4.1 -mno-avx -masm=att" } */ +/* { dg-final { scan-assembler-times "\tpblendvb\t" 2 } } */ +/* { dg-final { scan-assembler-not "\tpcmpeq" } } */ +/* { dg-final { scan-assembler-not "\tpandn" } } */ + +#include + +__m128i +f1 (__m128i a, __m128i b, __m128i mask) +{ + return _mm_blendv_epi8(a, b, + _mm_andnot_si128(mask, _mm_set1_epi8(255))); +} + +__m128i +f2 (__v16qi x, __v16qi a, __v16qi b) +{ + x ^= (__v16qi) { -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1 }; + return _mm_blendv_epi8 ((__m128i) a, (__m128i) b, (__m128i) x); +} -- cgit v1.1 From fc186594e3ee86a57841442e96306dddfd8eb85d Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Wed, 12 May 2021 14:03:36 +0200 Subject: lto-wrapper: silent warnings in tests Silents the following warning: lto-wrapper: warning: using serial compilation of 2 LTRANS jobs gcc/testsuite/ChangeLog: * lib/lto.exp: When running tests without jobserver, one can see the following warning for tests that use 1to1 partitioning. --- gcc/testsuite/lib/lto.exp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/lib/lto.exp b/gcc/testsuite/lib/lto.exp index 94a81ff..77919e8 100644 --- a/gcc/testsuite/lib/lto.exp +++ b/gcc/testsuite/lib/lto.exp @@ -159,6 +159,9 @@ proc lto_prune_warns { text } { regsub -all "(^|\n)\[ \t\]*\[\(\]file \[^\n\]* value=\[^\n\]*; file \[^\n\]* value=\[^\n\]*\[)\];" $text "" text regsub -all "(^|\n)\[ \t\]*\[^\n\]* definition taken" $text "" text + # Ignore missing jobserver for tests that do more than 1 LTRANS unit + regsub -all "(^|\n)\[^\n\]*: warning: using serial compilation of \[^\n\]*" $text "" text + # Ignore informational notes. regsub -all "(^|\n)\[^\n\]*: note: \[^\n\]*" $text "" text -- cgit v1.1 From c6b664e2c4c127025e076d8b584abe0976694629 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 12 May 2021 15:14:35 +0200 Subject: libcpp: Fix up -fdirectives-only preprocessing of includes not ending with newline [PR100392] If a header doesn't end with a new-line, with -fdirectives-only we right now preprocess it as int i = 1;# 2 "pr100392.c" 2 i.e. the line directive isn't on the next line, which means we fail to parse it when compiling. GCC 10 and earlier libcpp/directives-only.c had for this: if (!pfile->state.skipping && cur != base) { /* If the file was not newline terminated, add rlimit, which is guaranteed to point to a newline, to the end of our range. */ if (cur[-1] != '\n') { cur++; CPP_INCREMENT_LINE (pfile, 0); lines++; } cb->print_lines (lines, base, cur - base); } and we have the assertion /* Files always end in a newline or carriage return. We rely on this for character peeking safety. */ gcc_assert (buffer->rlimit[0] == '\n' || buffer->rlimit[0] == '\r'); So, this patch just does readd the more less same thing, so that we emit a newline after the inline even when it wasn't there before. 2021-05-12 Jakub Jelinek PR preprocessor/100392 * lex.c (cpp_directive_only_process): If buffer doesn't end with '\n', add buffer->rlimit[0] character to the printed range and CPP_INCREMENT_LINE and increment line_count. * gcc.dg/cpp/pr100392.c: New test. * gcc.dg/cpp/pr100392.h: New file. --- gcc/testsuite/gcc.dg/cpp/pr100392.c | 5 +++++ gcc/testsuite/gcc.dg/cpp/pr100392.h | 4 ++++ 2 files changed, 9 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/cpp/pr100392.c create mode 100644 gcc/testsuite/gcc.dg/cpp/pr100392.h (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/cpp/pr100392.c b/gcc/testsuite/gcc.dg/cpp/pr100392.c new file mode 100644 index 0000000..670ad2b --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/pr100392.c @@ -0,0 +1,5 @@ +/* PR preprocessor/100392 */ +/* { dg-do compile } */ +/* { dg-options "-save-temps -fdirectives-only" } */ + +#include "pr100392.h" diff --git a/gcc/testsuite/gcc.dg/cpp/pr100392.h b/gcc/testsuite/gcc.dg/cpp/pr100392.h new file mode 100644 index 0000000..340bc92 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/pr100392.h @@ -0,0 +1,4 @@ +/* PR preprocessor/100392 */ + +/* No newline after ; below. */ +int i = 1; \ No newline at end of file -- cgit v1.1 From 097fde5e7514e909f2e8472be2e008d0cab2260d Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 12 May 2021 15:39:52 +0200 Subject: tree-optimization/100566 - fix another predication issue in VN This amends the fix for PR100053 where I failed to amend all edge tests in dominated_by_p_w_unex. 2021-05-12 Richard Biener PR tree-optimization/100566 * tree-ssa-sccvn.c (dominated_by_p_w_unex): Properly handle allow_back for all edge queries. * gcc.dg/torture/pr100566.c: New testcase. --- gcc/testsuite/gcc.dg/torture/pr100566.c | 36 +++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/torture/pr100566.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/torture/pr100566.c b/gcc/testsuite/gcc.dg/torture/pr100566.c new file mode 100644 index 0000000..ed85691 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr100566.c @@ -0,0 +1,36 @@ +/* { dg-do run } */ + +volatile int s, c; + +__attribute__((noipa)) void +foo (void) +{ + if (c++ > 1) + __builtin_abort (); +} + +__attribute__((noipa)) int +bar (void) +{ + int i = 0, j = s; + if (j == 0) + goto lab; + for (i = 0; i < j; i++) + { + lab: + foo (); + if (!j) + goto lab; + } + return 0; +} + +int +main () +{ + s = 1; + bar (); + if (c != 1) + __builtin_abort (); + return 0; +} -- cgit v1.1 From fa6894ec9ce25f5aff10ec176212383f5c88b1ec Mon Sep 17 00:00:00 2001 From: Marcel Vollweiler Date: Wed, 12 May 2021 09:31:58 -0700 Subject: OpenMP: Add support for 'close' in map clause gcc/c/ChangeLog: * c-parser.c (c_parser_omp_clause_map): Support map-type-modifier 'close'. gcc/cp/ChangeLog: * parser.c (cp_parser_omp_clause_map): Support map-type-modifier 'close'. gcc/testsuite/ChangeLog: * c-c++-common/gomp/map-6.c: New test. * c-c++-common/gomp/map-7.c: New test. --- gcc/testsuite/c-c++-common/gomp/map-6.c | 135 ++++++++++++++++++++++++++++++++ gcc/testsuite/c-c++-common/gomp/map-7.c | 20 +++++ 2 files changed, 155 insertions(+) create mode 100644 gcc/testsuite/c-c++-common/gomp/map-6.c create mode 100644 gcc/testsuite/c-c++-common/gomp/map-7.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/c-c++-common/gomp/map-6.c b/gcc/testsuite/c-c++-common/gomp/map-6.c new file mode 100644 index 0000000..6ee5971 --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/map-6.c @@ -0,0 +1,135 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-fdump-tree-original" } */ + +void +foo (void) +{ + /* Test to ensure that the close modifier is parsed and ignored in map clauses. */ + int a, b, b1, b2, b3, b4, b5, b6, b7; + + #pragma omp target map (a) + ; + + #pragma omp target map (to:a) + ; + + #pragma omp target map (a to: b) /* { dg-error "'#pragma omp target' with modifier other than 'always' or 'close'" } */ + ; + + #pragma omp target map (close, a to: b) /* { dg-error "'#pragma omp target' with modifier other than 'always' or 'close'" } */ + ; + + #pragma omp target map (close a) /* { dg-error "'close' undeclared" "" { target c } } */ + /* { dg-error "'close' has not been declared" "" { target c++ } .-1 } */ + /* { dg-error "expected '\\)' before 'a'" "" { target *-*-* } .-2 } */ + ; + + #pragma omp target map (always a) /* { dg-error "'always' undeclared" "" { target c } } */ + /* { dg-error "'always' has not been declared" "" { target c++ } .-1 } */ + /* { dg-error "expected '\\)' before 'a'" "" { target *-*-* } .-2 } */ + ; + + #pragma omp target map (close to:a) + ; + + #pragma omp target map (close, to:a) + ; + + #pragma omp target map (close delete:a) /* { dg-error "'#pragma omp target' with map-type other than 'to', 'from', 'tofrom' or 'alloc' on 'map' clause" } */ + ; + + #pragma omp target map (close always to:b1) + ; + + #pragma omp target map (close, always to:b2) + ; + + #pragma omp target map (close, always, to:b3) + ; + + #pragma omp target map (always close to:b4) + ; + + #pragma omp target map (always, close to:b5) + ; + + #pragma omp target map (always, close, to:b6) + ; + + #pragma omp target map (always, always, to:a) /* { dg-error "too many 'always' modifiers" } */ + ; + + #pragma omp target map (always always, to:a) /* { dg-error "too many 'always' modifiers" } */ + ; + + #pragma omp target map (always, always to:a) /* { dg-error "too many 'always' modifiers" } */ + ; + + #pragma omp target map (always always to:a) /* { dg-error "too many 'always' modifiers" } */ + ; + + #pragma omp target map (close, close, to:a) /* { dg-error "too many 'close' modifiers" } */ + ; + + #pragma omp target map (close close, to:a) /* { dg-error "too many 'close' modifiers" } */ + ; + + #pragma omp target map (close, close to:a) /* { dg-error "too many 'close' modifiers" } */ + ; + + #pragma omp target map (close close to:a) /* { dg-error "too many 'close' modifiers" } */ + ; + + #pragma omp target map (always to : a) map (close to : b) + ; + + int close = 0; + #pragma omp target map (close) + ; + + #pragma omp target map (close a) /* { dg-error "expected '\\)' before 'a'" } */ + ; + + int always = 0; + #pragma omp target map (always) + ; + + #pragma omp target map (always a) /* { dg-error "expected '\\)' before 'a'" } */ + ; + + #pragma omp target map (always, close) + ; + + #pragma omp target map (always, always) /* { dg-error "'always' appears more than once in map clauses" } */ + ; + + #pragma omp target map (always, always, close) /* { dg-error "'always' appears more than once in map clauses" } */ + ; + + #pragma omp target map (always, close, to: always, close, b7) + ; + + int to = 0; + #pragma omp target map (always, close, to) + ; + + #pragma omp target map (to, always, close) + { + to = always = close = 1; + } + if (to != 1 || always != 1 || close != 1) + __builtin_abort (); + ; +} + +/* { dg-final { scan-tree-dump-not "map\\(\[^\n\r)]*close\[^\n\r)]*to:" "original" } } */ + +/* { dg-final { scan-tree-dump-times "pragma omp target map\\(always,to:" 7 "original" } } */ + +/* { dg-final { scan-tree-dump "pragma omp target map\\(always,to:b1" "original" } } */ +/* { dg-final { scan-tree-dump "pragma omp target map\\(always,to:b2" "original" } } */ +/* { dg-final { scan-tree-dump "pragma omp target map\\(always,to:b3" "original" } } */ +/* { dg-final { scan-tree-dump "pragma omp target map\\(always,to:b4" "original" } } */ +/* { dg-final { scan-tree-dump "pragma omp target map\\(always,to:b5" "original" } } */ +/* { dg-final { scan-tree-dump "pragma omp target map\\(always,to:b6" "original" } } */ +/* { dg-final { scan-tree-dump "pragma omp target map\\(always,to:b7\\) map\\(always,to:close\\) map\\(always,to:always\\)" "original" } } */ diff --git a/gcc/testsuite/c-c++-common/gomp/map-7.c b/gcc/testsuite/c-c++-common/gomp/map-7.c new file mode 100644 index 0000000..3f1e972 --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/map-7.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ + +void +foo (void) +{ + /* Test to ensure that the close modifier is parsed and ignored in map clauses. */ + + #define N 1024 + int always[N]; + int close; + + #pragma omp target map(always[:N]) + ; + + #pragma omp target map(close, always[:N]) + ; + + #pragma omp target map(always[:N], close) + ; +} -- cgit v1.1 From 3a2b12bc5a7da7f0c5cf2ef4879d435a02feda8d Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Wed, 12 May 2021 11:19:13 -0400 Subject: c++: Disable -Wint-in-bool-context in instantiations This warning is of questionable value when it's emitted when instantiating a template, as in the following testcase. It could be silenced by writing hb(i) << 1 instead of 2 * hb(i) but that's unnecessary obfuscation. gcc/cp/ChangeLog: * pt.c (tsubst_copy_and_build): Add warn_int_in_bool_context sentinel. gcc/testsuite/ChangeLog: * g++.dg/warn/Wint-in-bool-context-2.C: New test. --- gcc/testsuite/g++.dg/warn/Wint-in-bool-context-2.C | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 gcc/testsuite/g++.dg/warn/Wint-in-bool-context-2.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/warn/Wint-in-bool-context-2.C b/gcc/testsuite/g++.dg/warn/Wint-in-bool-context-2.C new file mode 100644 index 0000000..6cb482d --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wint-in-bool-context-2.C @@ -0,0 +1,16 @@ +// { dg-do compile { target c++11 } } +// { dg-options "-Wint-in-bool-context" } + +unsigned hb(unsigned i) { return ~i; } + +template +void f(int i) +{ + auto l = [i]() { return T(2 * hb(i)); }; // { dg-bogus "in boolean context" } + (void) l; +} + +int main() +{ + f(0); +} -- cgit v1.1 From d902a1b57606536982a1001670f998de685eaf7c Mon Sep 17 00:00:00 2001 From: Aldy Hernandez Date: Wed, 12 May 2021 15:22:15 -0400 Subject: Skip out on processing __builtin_clz when varying. The previous changes to irange::constant_p return TRUE for VARYING, since VARYING has numerical end points like any other constant range. The problem is that some users of constant_p depended on constant_p excluding the full domain. The range handler for __builtin_clz, that is shared between ranger and vr_values, is one such user. This patch excludes varying_p(), to match the original behavior for clz. gcc/ChangeLog: PR c/100521 * gimple-range.cc (range_of_builtin_call): Skip out on processing __builtin_clz when varying. --- gcc/testsuite/gcc.dg/pr100521.c | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr100521.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/pr100521.c b/gcc/testsuite/gcc.dg/pr100521.c new file mode 100644 index 0000000..fd9f0db --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr100521.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +int +__builtin_clz (int a) +{ + return __builtin_clz(a); +} -- cgit v1.1 From db514f98a383b2ebdcfe74feb80f98f406cec174 Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Wed, 12 May 2021 15:57:34 -0600 Subject: Add test for PR middle-end/100571. gcc/testsuite: PR middle-end/100571 * gcc.dg/Wstringop-overflow-67.c: New test. --- gcc/testsuite/gcc.dg/Wstringop-overflow-67.c | 92 ++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/Wstringop-overflow-67.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-67.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-67.c new file mode 100644 index 0000000..7b8f3f0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-67.c @@ -0,0 +1,92 @@ +/* PR middle-end/100571 - bogus -Wstringop-overflow with VLA of elements + larger than byte + { dg-do compile } + { dg-options "-O2 -Wall" } */ + +__attribute__ ((access (read_only, 1, 2))) void fro (int *, int); +__attribute__ ((access (write_only, 1, 2))) void fwo (int *, int); +__attribute__ ((access (read_write, 1, 2))) void frw (int *, int); + +extern __SIZE_TYPE__ n; + +void alloca_ro (void) +{ + int *a = __builtin_alloca (n * sizeof *a); + a[0] = 0; + fro (a, n); +} + +void alloca_wo (void) +{ + int *a = __builtin_alloca (n * sizeof *a); + fwo (a, n); +} + +void alloca_rw (void) +{ + int *a = __builtin_alloca (n * sizeof *a); + a[0] = 0; + frw (a, n); +} + + +void calloc_ro (void) +{ + int *a = __builtin_calloc (n, sizeof *a); + fro (a, n); +} + +void calloc_wo (void) +{ + int *a = __builtin_calloc (n, sizeof *a); + fwo (a, n); +} + +void calloc_rw (void) +{ + int *a = __builtin_calloc (n, sizeof *a); + a[0] = 0; + frw (a, n); +} + + +void malloc_ro (void) +{ + int *a = __builtin_malloc (n * sizeof *a); + a[0] = 0; + fro (a, n); +} + +void malloc_wo (void) +{ + int *a = __builtin_malloc (n * sizeof *a); + fwo (a, n); +} + +void malloc_rw (void) +{ + int *a = __builtin_malloc (n * sizeof *a); + a[0] = 0; + frw (a, n); +} + + +void vla_ro (void) +{ + int a[n]; + a[0] = 0; + fro (a, n); +} + +void vla_wo (void) +{ + int a[n]; + fwo (a, n); +} + +void vla_rw (void) +{ + int a[n]; + a[0] = 0; + frw (a, n); +} -- cgit v1.1 From 0ff3a0f2b9d5cbea70d134cda2e74b674f8be9c9 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 13 May 2021 00:16:29 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 51 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fd12630..82ef74c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,54 @@ +2021-05-12 Martin Sebor + + PR middle-end/100571 + * gcc.dg/Wstringop-overflow-67.c: New test. + +2021-05-12 Aldy Hernandez + + PR c/100521 + * gcc.dg/pr100521.c: New file. + +2021-05-12 Marek Polacek + + * g++.dg/warn/Wint-in-bool-context-2.C: New test. + +2021-05-12 Marcel Vollweiler + + * c-c++-common/gomp/map-6.c: New test. + * c-c++-common/gomp/map-7.c: New test. + +2021-05-12 Richard Biener + + PR tree-optimization/100566 + * gcc.dg/torture/pr100566.c: New testcase. + +2021-05-12 Jakub Jelinek + + PR preprocessor/100392 + * gcc.dg/cpp/pr100392.c: New test. + * gcc.dg/cpp/pr100392.h: New file. + +2021-05-12 Martin Liska + + * lib/lto.exp: When running tests without jobserver, one can see + the following warning for tests that use 1to1 partitioning. + +2021-05-12 liuhongt + + PR target/99908 + * gcc.target/i386/avx2-pr99908.c: New test. + * gcc.target/i386/sse4_1-pr99908.c: New test. + +2021-05-12 Richard Biener + + PR tree-optimization/100519 + * gcc.dg/torture/pr100519.c: New testcase. + +2021-05-12 Bernd Edlinger + + PR debug/100515 + * gcc.dg/debug/dwarf2/pr100515.c: New testcase. + 2021-05-12 Jakub Jelinek PR middle-end/100508 -- cgit v1.1 From 94de7e225c1fda079052c3f0725c926437d56c94 Mon Sep 17 00:00:00 2001 From: liuhongt Date: Thu, 22 Apr 2021 15:33:16 +0800 Subject: Optimize __builtin_shuffle when it's used to zero the upper bits of the dest. [PR target/94680] If the second operand of __builtin_shuffle is const vector 0, and with specific mask, it can be optimized to movq/vmovps. .i.e. foo128: - vxorps %xmm1, %xmm1, %xmm1 - vmovlhps %xmm1, %xmm0, %xmm0 + vmovq %xmm0, %xmm0 foo256: - vxorps %xmm1, %xmm1, %xmm1 - vshuff32x4 $0, %ymm1, %ymm0, %ymm0 + vmovaps %xmm0, %xmm0 foo512: - vxorps %xmm1, %xmm1, %xmm1 - vshuff32x4 $68, %zmm1, %zmm0, %zmm0 + vmovaps %ymm0, %ymm0 gcc/ChangeLog: PR target/94680 * config/i386/sse.md (ssedoublevecmode): Add attribute for V64QI/V32HI/V16SI/V4DI. (ssehalfvecmode): Add attribute for V2DI/V2DF. (*vec_concatv4si_0): Extend to VI124_128. (*vec_concat_0): New pre-reload splitter. * config/i386/predicates.md (movq_parallel): New predicate. gcc/testsuite/ChangeLog: PR target/94680 * gcc.target/i386/avx-pr94680.c: New test. * gcc.target/i386/avx512f-pr94680.c: New test. * gcc.target/i386/sse2-pr94680.c: New test. --- gcc/testsuite/gcc.target/i386/avx-pr94680.c | 107 ++++++++++++++++++ gcc/testsuite/gcc.target/i386/avx512f-pr94680.c | 144 ++++++++++++++++++++++++ gcc/testsuite/gcc.target/i386/sse2-pr94680.c | 91 +++++++++++++++ 3 files changed, 342 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/avx-pr94680.c create mode 100644 gcc/testsuite/gcc.target/i386/avx512f-pr94680.c create mode 100644 gcc/testsuite/gcc.target/i386/sse2-pr94680.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/i386/avx-pr94680.c b/gcc/testsuite/gcc.target/i386/avx-pr94680.c new file mode 100644 index 0000000..a89e496 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx-pr94680.c @@ -0,0 +1,107 @@ +/* { dg-do compile } */ +/* { dg-options "-mavx -mno-avx512f -O2" } */ +/* { dg-final { scan-assembler-times {(?n)vmov[a-z0-9]*[ \t]*%xmm[0-9]} 12 } } */ +/* { dg-final { scan-assembler-not "pxor" } } */ + +typedef float v8sf __attribute__((vector_size(32))); +typedef double v4df __attribute__ ((vector_size (32))); +typedef long long v4di __attribute__((vector_size(32))); +typedef int v8si __attribute__((vector_size(32))); +typedef short v16hi __attribute__ ((vector_size (32))); +typedef char v32qi __attribute__ ((vector_size (32))); + +v4df +foo_v4df (v4df x) +{ + return __builtin_shuffle (x, (v4df) { 0, 0, 0, 0 }, (v4di) { 0, 1, 4, 5 }); +} + +v4df +foo_v4df_l (v4df x) +{ + return __builtin_shuffle ((v4df) { 0, 0, 0, 0 }, x, (v4di) { 4, 5, 1, 2 }); +} + +v4di +foo_v4di (v4di x) +{ + return __builtin_shuffle (x, (v4di) { 0, 0, 0, 0 }, (v4di) { 0, 1, 4, 7 }); +} + +v4di +foo_v4di_l (v4di x) +{ + return __builtin_shuffle ((v4di) { 0, 0, 0, 0 }, x, (v4di) { 4, 5, 3, 1 }); +} + +v8sf +foo_v8sf (v8sf x) +{ + return __builtin_shuffle ((v8sf) { 0, 0, 0, 0, 0, 0, 0, 0 }, x, + (v8si) { 8, 9, 10, 11, 0, 1, 2, 3 }); +} + +v8sf +foo_v8sf_l (v8sf x) +{ + return __builtin_shuffle (x, (v8sf) { 0, 0, 0, 0, 0, 0, 0, 0 }, + (v8si) { 0, 1, 2, 3, 8, 9, 10, 11 }); +} + +v8si +foo_v8si (v8si x) +{ + return __builtin_shuffle (x, (v8si) { 0, 0, 0, 0, 0, 0, 0, 0 }, + (v8si) { 0, 1, 2, 3, 13, 12, 11, 15 }); +} + +v8si +foo_v8si_l (v8si x) +{ + return __builtin_shuffle ((v8si) { 0, 0, 0, 0, 0, 0, 0, 0 }, x, + (v8si) { 8, 9, 10, 11, 7, 6, 5, 4 }); +} + +v16hi +foo_v16hi (v16hi x) +{ + return __builtin_shuffle (x, (v16hi) { 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 }, + (v16hi) { 0, 1, 2, 3, 4, 5, 6, 7, + 24, 17, 26, 19, 28, 21, 30, 23 }); +} + +v16hi +foo_v16hi_l (v16hi x) +{ + return __builtin_shuffle ((v16hi) { 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 }, x, + (v16hi) { 16, 17, 18, 20, 21, 22, 23, + 15, 0, 13, 2, 11, 4, 9, 6 }); +} + +v32qi +foo_v32qi (v32qi x) +{ + return __builtin_shuffle (x, (v32qi) { 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 }, + (v32qi) { 0, 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, + 32, 49, 34, 58, 36, 53, 38, 39, + 40, 60, 42, 43, 63, 45, 46, 47 }); +} + +v32qi +foo_v32qi_l (v32qi x) +{ + return __builtin_shuffle ((v32qi) { 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 }, x, + (v32qi) { 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, + 31, 0, 29, 2, 27, 4, 25, 6, + 23, 8, 21, 10, 19, 12, 17, 14 }); +} diff --git a/gcc/testsuite/gcc.target/i386/avx512f-pr94680.c b/gcc/testsuite/gcc.target/i386/avx512f-pr94680.c new file mode 100644 index 0000000..c27431a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512f-pr94680.c @@ -0,0 +1,144 @@ +/* { dg-do compile } */ +/* { dg-options "-mavx512bw -mavx512vbmi -O2" } */ +/* { dg-final { scan-assembler-times {(?n)vmov[a-z0-9]*[ \t]*%ymm[0-9]} 12} } */ +/* { dg-final { scan-assembler-not "pxor" } } */ + + +typedef float v16sf __attribute__((vector_size(64))); +typedef double v8df __attribute__ ((vector_size (64))); +typedef long long v8di __attribute__((vector_size(64))); +typedef int v16si __attribute__((vector_size(64))); +typedef short v32hi __attribute__ ((vector_size (64))); +typedef char v64qi __attribute__ ((vector_size (64))); + +v8df +foo_v8df (v8df x) +{ + return __builtin_shuffle (x, (v8df) { 0, 0, 0, 0, 0, 0, 0, 0 }, + (v8di) { 0, 1, 2, 3, 15, 14, 10, 11 }); +} + +v8df +foo_v8df_l (v8df x) +{ + return __builtin_shuffle ((v8df) { 0, 0, 0, 0, 0, 0, 0, 0 }, x, + (v8di) { 8, 9, 10, 11, 0, 1, 2, 3 }); +} + +v8di +foo_v8di (v8di x) +{ + return __builtin_shuffle (x, (v8di) { 0, 0, 0, 0, 0, 0, 0, 0 }, + (v8di) { 0, 1, 2, 3, 8, 9, 10, 11 }); +} + +v8di +foo_v8di_l (v8di x) +{ + return __builtin_shuffle ((v8di) { 0, 0, 0, 0, 0, 0, 0, 0 }, x, + (v8di) { 8, 9, 10, 11, 7, 6, 5, 4 }); +} + +v16sf +foo_v16sf (v16sf x) +{ + return __builtin_shuffle (x, (v16sf) { 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 }, + (v16si) { 0, 1, 2, 3, 4, 5, 6, 7, + 16, 17, 18, 19, 20, 21, 22, 23 }); +} + +v16sf +foo_v16sf_l (v16sf x) +{ + return __builtin_shuffle ((v16sf) { 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 }, x, + (v16si) { 16, 17, 18, 19, 20, 21, 22, 23, + 0, 15, 2, 13, 4, 11, 6, 9 }); +} + +v16si +foo_v16si (v16si x) +{ + return __builtin_shuffle (x, (v16si) { 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 }, + (v16si) { 0, 1, 2, 3, 4, 5, 6, 7, + 31, 30, 29, 28, 20, 21, 22, 23 }); +} + +v16si +foo_v16si_l (v16si x) +{ + return __builtin_shuffle ((v16si) { 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 }, x, + (v16si) { 16, 17, 18, 19, 20, 21, 22, 23, + 15, 0, 13, 2, 11, 4, 9, 6 }); +} + +v32hi +foo_v32hi (v32hi x) +{ + return __builtin_shuffle (x, (v32hi) { 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 }, + (v32hi) { 0, 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, + 63, 33, 61, 35, 59, 37, 57, 39, + 55, 41, 53, 43, 51, 45, 49, 47 }); +} + +v32hi +foo_v32hi_l (v32hi x) +{ + return __builtin_shuffle ((v32hi) { 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 }, x, + (v32hi) { 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, + 31, 0, 29, 2, 27, 4, 25, 6, + 23, 8, 21, 10, 19, 12, 17, 14 }); +} + +v64qi +foo_v64qi (v64qi x) +{ + return __builtin_shuffle (x, (v64qi) { 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 }, + (v64qi) {0, 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, + 64, 127, 66, 125, 68, 123, 70, 121, + 72, 119, 74, 117, 76, 115, 78, 113, + 80, 111, 82, 109, 84, 107, 86, 105, + 88, 103, 90, 101, 92, 99, 94, 97 }); +} + +v64qi +foo_v64qi_l (v64qi x) +{ + return __builtin_shuffle ((v64qi) { 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 }, x, + (v64qi) { 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, + 88, 89, 90, 91, 92, 93, 94, 95, + 0, 63, 2, 61, 4, 59, 6, 57, + 8, 55, 10, 53, 12, 51, 14, 49, + 16, 47, 18, 45, 20, 43, 22, 41, + 24, 39, 26, 37, 28, 35, 30, 33 }); +} diff --git a/gcc/testsuite/gcc.target/i386/sse2-pr94680.c b/gcc/testsuite/gcc.target/i386/sse2-pr94680.c new file mode 100644 index 0000000..7e0ff9f --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/sse2-pr94680.c @@ -0,0 +1,91 @@ +/* { dg-do compile } */ +/* { dg-options "-msse2 -mno-sse4.1 -O2" } */ +/* { dg-final { scan-assembler-times {(?n)(?:mov|psrldq).*%xmm[0-9]} 12 } } */ +/* { dg-final { scan-assembler-not "pxor" } } */ + +typedef float v4sf __attribute__((vector_size(16))); +typedef double v2df __attribute__ ((vector_size (16))); +typedef long long v2di __attribute__((vector_size(16))); +typedef int v4si __attribute__((vector_size(16))); +typedef short v8hi __attribute__ ((vector_size (16))); +typedef char v16qi __attribute__ ((vector_size (16))); + +v2df +foo_v2df (v2df x) +{ + return __builtin_shuffle (x, (v2df) { 0, 0 }, (v2di) {0, 2}); +} + +v2df +foo_v2df_l (v2df x) +{ + return __builtin_shuffle ((v2df) { 0, 0 }, x, (v2di) {3, 1}); +} + +v2di +foo_v2di (v2di x) +{ + return __builtin_shuffle (x, (v2di) { 0, 0 }, (v2di) {0, 3}); +} + +v2di +foo_v2di_l (v2di x) +{ + return __builtin_shuffle ((v2di) { 0, 0 }, x, (v2di) {3, 0}); +} + +v4sf +foo_v4sf (v4sf x) +{ + return __builtin_shuffle (x, (v4sf) { 0, 0, 0, 0 }, (v4si) {0, 1, 4, 5}); +} + +v4sf +foo_v4sf_l (v4sf x) +{ + return __builtin_shuffle ((v4sf) { 0, 0, 0, 0 }, x, (v4si) {4, 5, 3, 1}); +} + +v4si +foo_v4si (v4si x) +{ + return __builtin_shuffle (x, (v4si) { 0, 0, 0, 0 }, (v4si) {0, 1, 6, 7}); +} + +v4si +foo_v4si_l (v4si x) +{ + return __builtin_shuffle ((v4si) { 0, 0, 0, 0 }, x, (v4si) {4, 5, 1, 2}); +} + +v8hi +foo_v8hi (v8hi x) +{ + return __builtin_shuffle (x, (v8hi) { 0, 0, 0, 0, 0, 0, 0, 0 }, + (v8hi) { 0, 1, 2, 3, 8, 12, 10, 13 }); +} + +v8hi +foo_v8hi_l (v8hi x) +{ + return __builtin_shuffle ((v8hi) { 0, 0, 0, 0, 0, 0, 0, 0 }, x, + (v8hi) { 8, 9, 10, 11, 7, 6, 5, 4 }); +} + +v16qi +foo_v16qi (v16qi x) +{ + return __builtin_shuffle (x, (v16qi) { 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 }, + (v16qi) {0, 1, 2, 3, 4, 5, 6, 7, + 16, 24, 18, 26, 20, 28, 22, 30 }); +} + +v16qi +foo_v16qi_l (v16qi x) +{ + return __builtin_shuffle ((v16qi) { 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 }, x, + (v16qi) { 16, 17, 18, 19, 20, 21, 22, 23, + 15, 0, 13, 2, 11, 4, 9, 6 }); +} -- cgit v1.1 From 0ffdbc85d9a626fab175823421d53bc0e9564252 Mon Sep 17 00:00:00 2001 From: liuhongt Date: Thu, 13 May 2021 13:44:13 +0800 Subject: Fix typo in testcase. gcc/testsuite/ChangeLog: * gcc.target/i386/avx-pr94680.c: Fix typo in testcase. --- gcc/testsuite/gcc.target/i386/avx-pr94680.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/i386/avx-pr94680.c b/gcc/testsuite/gcc.target/i386/avx-pr94680.c index a89e496..cb5041b 100644 --- a/gcc/testsuite/gcc.target/i386/avx-pr94680.c +++ b/gcc/testsuite/gcc.target/i386/avx-pr94680.c @@ -76,7 +76,7 @@ foo_v16hi_l (v16hi x) { return __builtin_shuffle ((v16hi) { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, x, - (v16hi) { 16, 17, 18, 20, 21, 22, 23, + (v16hi) { 16, 17, 18, 19, 20, 21, 22, 23, 15, 0, 13, 2, 11, 4, 9, 6 }); } -- cgit v1.1 From 810afb0b5fbb9da1e0e51ee9607f275f14c17459 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Thu, 13 May 2021 09:23:30 +0200 Subject: testsuite: prune new LTO warning libgomp/ChangeLog: PR testsuite/100569 * testsuite/libgomp.c/omp-nested-3.c: Prune new LTO warning. * testsuite/libgomp.c/pr46032-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-clauses-kernels-ipa-pta.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-clauses-parallel-ipa-pta.c: Likewise. gcc/testsuite/ChangeLog: PR testsuite/100569 * gcc.dg/atomic/c11-atomic-exec-2.c: Prune new LTO warning. * gcc.dg/torture/pr94947-1.c: Likewise. --- gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-2.c | 1 + gcc/testsuite/gcc.dg/torture/pr94947-1.c | 1 + 2 files changed, 2 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-2.c b/gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-2.c index 9ee56b6..3e75096 100644 --- a/gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-2.c +++ b/gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-2.c @@ -2,6 +2,7 @@ assignment. */ /* { dg-do run } */ /* { dg-options "-std=c11 -pedantic-errors" } */ +/* { dg-prune-output "warning: using serial compilation" } */ extern void abort (void); extern void exit (int); diff --git a/gcc/testsuite/gcc.dg/torture/pr94947-1.c b/gcc/testsuite/gcc.dg/torture/pr94947-1.c index ab8b488..832e40d 100644 --- a/gcc/testsuite/gcc.dg/torture/pr94947-1.c +++ b/gcc/testsuite/gcc.dg/torture/pr94947-1.c @@ -1,6 +1,7 @@ /* { dg-do run } */ /* { dg-additional-sources "pr94947-2.c" } */ /* { dg-additional-options "-fipa-pta -flto-partition=1to1" } */ +/* { dg-prune-output "warning: using serial compilation" } */ extern void abort (); extern void baz (); -- cgit v1.1 From c3e02c2e442e6b0c298dbe769e0e3b120b5201b2 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Thu, 13 May 2021 09:32:50 +0200 Subject: Prune another new LTO warning gcc/testsuite/ PR testsuite/100569 * gnat.dg/lto21.adb: Prune new LTO warning. --- gcc/testsuite/gnat.dg/lto21.adb | 1 + 1 file changed, 1 insertion(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gnat.dg/lto21.adb b/gcc/testsuite/gnat.dg/lto21.adb index fe6fb273..f626697 100644 --- a/gcc/testsuite/gnat.dg/lto21.adb +++ b/gcc/testsuite/gnat.dg/lto21.adb @@ -1,5 +1,6 @@ -- { dg-do run } -- { dg-options "-O3 -flto" { target lto } } +-- { dg-prune-output "warning: using serial compilation" } with Lto21_Pkg1; with Lto21_Pkg2; use Lto21_Pkg2; -- cgit v1.1 From f1693741cb2b2db519bb82155a3c0880fd820ea3 Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Thu, 13 May 2021 11:09:53 +0200 Subject: i386: Fix up V2SFmode vcond* with -mxop [PR100581] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ix86_expand_sse_movcc has special TARGET_XOP handling and the recent addition of support of v*cond* patterns for V2SFmode results in ICEs because the expected pattern doesn't exist. We can handle it using 128-bit vpcmov (if we ignore the upper 64 bits like we ignore in other TARGET_MMX_WITH_SSE support). 2021-05-13 UroÅ¡ Bizjak gcc/ PR target/100581 * config/i386/i386-expand.c (ix86_expand_sse_movcc): Force mode sizes < 16 to a register when constructing vpcmov pattern. * config/i386/mmx.md (*xop_pcmov_): Use MMXMODE124 mode. gcc/testsuite/ PR target/100581 * g++.target/i386/pr100581.C: New test. --- gcc/testsuite/g++.target/i386/pr100581.C | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 gcc/testsuite/g++.target/i386/pr100581.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.target/i386/pr100581.C b/gcc/testsuite/g++.target/i386/pr100581.C new file mode 100644 index 0000000..37cc9f1 --- /dev/null +++ b/gcc/testsuite/g++.target/i386/pr100581.C @@ -0,0 +1,9 @@ +/* PR target/100581 */ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-O2 -mxop" } */ + +typedef float __attribute__((__vector_size__(8))) v64f32; + +v64f32 af, bf, ff_a, ff_b; + +v64f32 f() { return ff_a > ff_b ? af : bf; } -- cgit v1.1 From 829c4bea06600ea4201462f91ce6d76ca21fdb35 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 13 May 2021 12:14:14 +0200 Subject: ix86: Support V{2, 4}DImode arithmetic right shifts for SSE2+ [PR98856] As mentioned in the PR, we don't support arithmetic right V2DImode or V4DImode on x86 without -mavx512vl or -mxop. The ISAs indeed don't have {,v}psraq instructions until AVX512VL, but we actually can emulate it quite easily. One case is arithmetic >> 63, we can just emit {,v}pxor; {,v}pcmpgt for that for SSE4.2+, or for SSE2 psrad $31; pshufd $0xf5. Then arithmetic >> by constant > 32, that can be done with {,v}psrad $31 and {,v}psrad $(cst-32) and two operand permutation, arithmetic >> 32 can be done as {,v}psrad $31 and permutation of that and the original operand. Arithmetic >> by constant < 32 can be done as {,v}psrad $cst and {,v}psrlq $cst and two operand permutation. And arithmetic >> by variable scalar amount can be done as arithmetic >> 63, logical >> by the amount, << by (64 - amount of the >> 63 result; note that the vector << 64 result in 0) and oring together. I had to improve the permutation generation so that it actually handles the needed permutations (or handles them better). 2021-05-13 Jakub Jelinek PR tree-optimization/98856 * config/i386/i386.c (ix86_shift_rotate_cost): Add CODE argument. Expect V2DI and V4DI arithmetic right shifts to be emulated. (ix86_rtx_costs, ix86_add_stmt_cost): Adjust ix86_shift_rotate_cost caller. * config/i386/i386-expand.c (expand_vec_perm_2perm_interleave, expand_vec_perm_2perm_pblendv): New functions. (ix86_expand_vec_perm_const_1): Use them. * config/i386/sse.md (ashr3): Rename to ... (ashr3): ... this. (ashr3): New define_expand with VI248_AVX512BW iterator. (ashrv4di3): New define_expand. (ashrv2di3): Change condition to TARGET_SSE2, handle !TARGET_XOP and !TARGET_AVX512VL expansion. * gcc.target/i386/sse2-psraq-1.c: New test. * gcc.target/i386/sse4_2-psraq-1.c: New test. * gcc.target/i386/avx-psraq-1.c: New test. * gcc.target/i386/avx2-psraq-1.c: New test. * gcc.target/i386/avx-pr82370.c: Adjust expected number of vpsrad instructions. * gcc.target/i386/avx2-pr82370.c: Likewise. * gcc.target/i386/avx512f-pr82370.c: Likewise. * gcc.target/i386/avx512bw-pr82370.c: Likewise. * gcc.dg/torture/vshuf-4.inc: Add two further permutations. * gcc.dg/torture/vshuf-8.inc: Likewise. --- gcc/testsuite/gcc.dg/torture/vshuf-4.inc | 4 +- gcc/testsuite/gcc.dg/torture/vshuf-8.inc | 4 +- gcc/testsuite/gcc.target/i386/avx-pr82370.c | 2 +- gcc/testsuite/gcc.target/i386/avx-psraq-1.c | 13 ++++++ gcc/testsuite/gcc.target/i386/avx2-pr82370.c | 4 +- gcc/testsuite/gcc.target/i386/avx2-psraq-1.c | 51 +++++++++++++++++++++++ gcc/testsuite/gcc.target/i386/avx512bw-pr82370.c | 4 +- gcc/testsuite/gcc.target/i386/avx512f-pr82370.c | 4 +- gcc/testsuite/gcc.target/i386/sse2-psraq-1.c | 53 ++++++++++++++++++++++++ gcc/testsuite/gcc.target/i386/sse4_2-psraq-1.c | 13 ++++++ 10 files changed, 143 insertions(+), 9 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/avx-psraq-1.c create mode 100644 gcc/testsuite/gcc.target/i386/avx2-psraq-1.c create mode 100644 gcc/testsuite/gcc.target/i386/sse2-psraq-1.c create mode 100644 gcc/testsuite/gcc.target/i386/sse4_2-psraq-1.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/torture/vshuf-4.inc b/gcc/testsuite/gcc.dg/torture/vshuf-4.inc index d041b33..fb35df8 100644 --- a/gcc/testsuite/gcc.dg/torture/vshuf-4.inc +++ b/gcc/testsuite/gcc.dg/torture/vshuf-4.inc @@ -25,7 +25,9 @@ T (21, 2, 6, 3, 7) \ T (22, 1, 2, 3, 0) \ T (23, 2, 1, 0, 3) \ T (24, 2, 5, 6, 3) \ -T (25, 0, 1, 4, 5) +T (25, 0, 1, 4, 5) \ +T (26, 1, 5, 3, 7) \ +T (27, 0, 5, 2, 7) #define EXPTESTS \ T (116, 1, 2, 4, 3) \ T (117, 7, 3, 3, 0) \ diff --git a/gcc/testsuite/gcc.dg/torture/vshuf-8.inc b/gcc/testsuite/gcc.dg/torture/vshuf-8.inc index de358f3..d628039 100644 --- a/gcc/testsuite/gcc.dg/torture/vshuf-8.inc +++ b/gcc/testsuite/gcc.dg/torture/vshuf-8.inc @@ -27,7 +27,9 @@ T (23, 6, 5, 4, 3, 2, 1, 0, 7) \ T (24, 0, 1, 2, 3, 8, 9, 10, 11) \ T (25, 0, 1, 2, 3, 12, 13, 14, 15) \ T (26, 0, 1, 8, 9, 10, 11, 12, 13) \ -T (27, 0, 8, 9, 10, 11, 12, 13, 14) +T (27, 0, 8, 9, 10, 11, 12, 13, 14) \ +T (28, 1, 9, 3, 11, 5, 13, 7, 15) \ +T (29, 0, 9, 2, 11, 4, 13, 6, 15) #define EXPTESTS \ T (116, 9, 3, 9, 4, 7, 0, 0, 6) \ T (117, 4, 14, 12, 8, 9, 6, 0, 10) \ diff --git a/gcc/testsuite/gcc.target/i386/avx-pr82370.c b/gcc/testsuite/gcc.target/i386/avx-pr82370.c index 4dc8a5b..dc12dbf 100644 --- a/gcc/testsuite/gcc.target/i386/avx-pr82370.c +++ b/gcc/testsuite/gcc.target/i386/avx-pr82370.c @@ -4,7 +4,7 @@ /* { dg-final { scan-assembler-times "vpslld\[ \t]\+\\\$7, %xmm\[0-9]\+, %xmm\[0-9]\+" 3 } } */ /* { dg-final { scan-assembler-times "vpsllq\[ \t]\+\\\$7, %xmm\[0-9]\+, %xmm\[0-9]\+" 3 } } */ /* { dg-final { scan-assembler-times "vpsllw\[ \t]\+\\\$7, %xmm\[0-9]\+, %xmm\[0-9]\+" 3 } } */ -/* { dg-final { scan-assembler-times "vpsrad\[ \t]\+\\\$3, %xmm\[0-9]\+, %xmm\[0-9]\+" 3 } } */ +/* { dg-final { scan-assembler-times "vpsrad\[ \t]\+\\\$3, %xmm\[0-9]\+, %xmm\[0-9]\+" 6 } } */ /* { dg-final { scan-assembler-times "vpsraq\[ \t]\+\\\$3, %xmm\[0-9]\+, %xmm\[0-9]\+" 0 } } */ /* { dg-final { scan-assembler-times "vpsraw\[ \t]\+\\\$3, %xmm\[0-9]\+, %xmm\[0-9]\+" 3 } } */ /* { dg-final { scan-assembler-times "vpsrld\[ \t]\+\\\$5, %xmm\[0-9]\+, %xmm\[0-9]\+" 3 } } */ diff --git a/gcc/testsuite/gcc.target/i386/avx-psraq-1.c b/gcc/testsuite/gcc.target/i386/avx-psraq-1.c new file mode 100644 index 0000000..2722088 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx-psraq-1.c @@ -0,0 +1,13 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -mavx -mno-avx2" } */ +/* { dg-require-effective-target avx } */ + +#ifndef CHECK_H +#define CHECK_H "avx-check.h" +#endif + +#ifndef TEST +#define TEST avx_test +#endif + +#include "sse2-psraq-1.c" diff --git a/gcc/testsuite/gcc.target/i386/avx2-pr82370.c b/gcc/testsuite/gcc.target/i386/avx2-pr82370.c index 6609ebb..df3dfd8 100644 --- a/gcc/testsuite/gcc.target/i386/avx2-pr82370.c +++ b/gcc/testsuite/gcc.target/i386/avx2-pr82370.c @@ -4,7 +4,7 @@ /* { dg-final { scan-assembler-times "vpslld\[ \t]\+\\\$7, %xmm\[0-9]\+, %xmm\[0-9]\+" 1 } } */ /* { dg-final { scan-assembler-times "vpsllq\[ \t]\+\\\$7, %xmm\[0-9]\+, %xmm\[0-9]\+" 1 } } */ /* { dg-final { scan-assembler-times "vpsllw\[ \t]\+\\\$7, %xmm\[0-9]\+, %xmm\[0-9]\+" 1 } } */ -/* { dg-final { scan-assembler-times "vpsrad\[ \t]\+\\\$3, %xmm\[0-9]\+, %xmm\[0-9]\+" 1 } } */ +/* { dg-final { scan-assembler-times "vpsrad\[ \t]\+\\\$3, %xmm\[0-9]\+, %xmm\[0-9]\+" 2 } } */ /* { dg-final { scan-assembler-times "vpsraq\[ \t]\+\\\$3, %xmm\[0-9]\+, %xmm\[0-9]\+" 0 } } */ /* { dg-final { scan-assembler-times "vpsraw\[ \t]\+\\\$3, %xmm\[0-9]\+, %xmm\[0-9]\+" 1 } } */ /* { dg-final { scan-assembler-times "vpsrld\[ \t]\+\\\$5, %xmm\[0-9]\+, %xmm\[0-9]\+" 1 } } */ @@ -13,7 +13,7 @@ /* { dg-final { scan-assembler-times "vpslld\[ \t]\+\\\$7, %ymm\[0-9]\+, %ymm\[0-9]\+" 1 } } */ /* { dg-final { scan-assembler-times "vpsllq\[ \t]\+\\\$7, %ymm\[0-9]\+, %ymm\[0-9]\+" 1 } } */ /* { dg-final { scan-assembler-times "vpsllw\[ \t]\+\\\$7, %ymm\[0-9]\+, %ymm\[0-9]\+" 1 } } */ -/* { dg-final { scan-assembler-times "vpsrad\[ \t]\+\\\$3, %ymm\[0-9]\+, %ymm\[0-9]\+" 1 } } */ +/* { dg-final { scan-assembler-times "vpsrad\[ \t]\+\\\$3, %ymm\[0-9]\+, %ymm\[0-9]\+" 2 } } */ /* { dg-final { scan-assembler-times "vpsraq\[ \t]\+\\\$3, %ymm\[0-9]\+, %ymm\[0-9]\+" 0 } } */ /* { dg-final { scan-assembler-times "vpsraw\[ \t]\+\\\$3, %ymm\[0-9]\+, %ymm\[0-9]\+" 1 } } */ /* { dg-final { scan-assembler-times "vpsrld\[ \t]\+\\\$5, %ymm\[0-9]\+, %ymm\[0-9]\+" 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/avx2-psraq-1.c b/gcc/testsuite/gcc.target/i386/avx2-psraq-1.c new file mode 100644 index 0000000..e9051bf --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx2-psraq-1.c @@ -0,0 +1,51 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -mavx2 -mno-avx512f" } */ +/* { dg-require-effective-target avx2 } */ + +#ifndef CHECK_H +#define CHECK_H "avx2-check.h" +#endif + +#ifndef TEST +#define TEST avx2_test +#endif + +#include CHECK_H + +typedef long long V __attribute__((vector_size (32))); + +#define TESTN(N) \ +static V \ +__attribute__((noipa)) \ +test##N (V x) \ +{ \ + return x >> N; \ +} + +#define TESTS TESTN (63) TESTN (49) TESTN (32) TESTN (31) TESTN (18) +TESTS + +struct +{ + int n; + V (*fn) (V); +} tests[] = { +#undef TESTN +#define TESTN(N) { N, test##N }, + TESTS +}; + +static void +TEST (void) +{ + V a = (V) { 0xdeadbeefcafebabeULL, 0x123456789abcdef0ULL, + 0x173a74be8a95134cULL, 0x817bae35ac0ebf12ULL }; + int i; + for (i = 0; tests[i].n; i++) + { + V c = tests[i].fn (a); + if (c[0] != a[0] >> tests[i].n || c[1] != a[1] >> tests[i].n + || c[2] != a[2] >> tests[i].n || c[3] != a[3] >> tests[i].n) + abort (); + } +} diff --git a/gcc/testsuite/gcc.target/i386/avx512bw-pr82370.c b/gcc/testsuite/gcc.target/i386/avx512bw-pr82370.c index 174f499..12c3b27 100644 --- a/gcc/testsuite/gcc.target/i386/avx512bw-pr82370.c +++ b/gcc/testsuite/gcc.target/i386/avx512bw-pr82370.c @@ -4,7 +4,7 @@ /* { dg-final { scan-assembler-times "vpslld\[ \t]\+\\\$7, %xmm\[0-9]\+, %xmm\[0-9]\+" 1 } } */ /* { dg-final { scan-assembler-times "vpsllq\[ \t]\+\\\$7, %xmm\[0-9]\+, %xmm\[0-9]\+" 1 } } */ /* { dg-final { scan-assembler-times "vpsllw\[ \t]\+\\\$7, %xmm\[0-9]\+, %xmm\[0-9]\+" 1 } } */ -/* { dg-final { scan-assembler-times "vpsrad\[ \t]\+\\\$3, %xmm\[0-9]\+, %xmm\[0-9]\+" 1 } } */ +/* { dg-final { scan-assembler-times "vpsrad\[ \t]\+\\\$3, %xmm\[0-9]\+, %xmm\[0-9]\+" 2 } } */ /* { dg-final { scan-assembler-times "vpsraq\[ \t]\+\\\$3, %xmm\[0-9]\+, %xmm\[0-9]\+" 0 } } */ /* { dg-final { scan-assembler-times "vpsraw\[ \t]\+\\\$3, %xmm\[0-9]\+, %xmm\[0-9]\+" 1 } } */ /* { dg-final { scan-assembler-times "vpsrld\[ \t]\+\\\$5, %xmm\[0-9]\+, %xmm\[0-9]\+" 1 } } */ @@ -13,7 +13,7 @@ /* { dg-final { scan-assembler-times "vpslld\[ \t]\+\\\$7, %ymm\[0-9]\+, %ymm\[0-9]\+" 1 } } */ /* { dg-final { scan-assembler-times "vpsllq\[ \t]\+\\\$7, %ymm\[0-9]\+, %ymm\[0-9]\+" 1 } } */ /* { dg-final { scan-assembler-times "vpsllw\[ \t]\+\\\$7, %ymm\[0-9]\+, %ymm\[0-9]\+" 1 } } */ -/* { dg-final { scan-assembler-times "vpsrad\[ \t]\+\\\$3, %ymm\[0-9]\+, %ymm\[0-9]\+" 1 } } */ +/* { dg-final { scan-assembler-times "vpsrad\[ \t]\+\\\$3, %ymm\[0-9]\+, %ymm\[0-9]\+" 2 } } */ /* { dg-final { scan-assembler-times "vpsraq\[ \t]\+\\\$3, %ymm\[0-9]\+, %ymm\[0-9]\+" 0 } } */ /* { dg-final { scan-assembler-times "vpsraw\[ \t]\+\\\$3, %ymm\[0-9]\+, %ymm\[0-9]\+" 1 } } */ /* { dg-final { scan-assembler-times "vpsrld\[ \t]\+\\\$5, %ymm\[0-9]\+, %ymm\[0-9]\+" 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/avx512f-pr82370.c b/gcc/testsuite/gcc.target/i386/avx512f-pr82370.c index 20ad8dc..b179f9b 100644 --- a/gcc/testsuite/gcc.target/i386/avx512f-pr82370.c +++ b/gcc/testsuite/gcc.target/i386/avx512f-pr82370.c @@ -4,7 +4,7 @@ /* { dg-final { scan-assembler-times "vpslld\[ \t]\+\\\$7, %xmm\[0-9]\+, %xmm\[0-9]\+" 1 } } */ /* { dg-final { scan-assembler-times "vpsllq\[ \t]\+\\\$7, %xmm\[0-9]\+, %xmm\[0-9]\+" 1 } } */ /* { dg-final { scan-assembler-times "vpsllw\[ \t]\+\\\$7, %xmm\[0-9]\+, %xmm\[0-9]\+" 1 } } */ -/* { dg-final { scan-assembler-times "vpsrad\[ \t]\+\\\$3, %xmm\[0-9]\+, %xmm\[0-9]\+" 1 } } */ +/* { dg-final { scan-assembler-times "vpsrad\[ \t]\+\\\$3, %xmm\[0-9]\+, %xmm\[0-9]\+" 2 } } */ /* { dg-final { scan-assembler-times "vpsraq\[ \t]\+\\\$3, %xmm\[0-9]\+, %xmm\[0-9]\+" 0 } } */ /* { dg-final { scan-assembler-times "vpsraw\[ \t]\+\\\$3, %xmm\[0-9]\+, %xmm\[0-9]\+" 1 } } */ /* { dg-final { scan-assembler-times "vpsrld\[ \t]\+\\\$5, %xmm\[0-9]\+, %xmm\[0-9]\+" 1 } } */ @@ -13,7 +13,7 @@ /* { dg-final { scan-assembler-times "vpslld\[ \t]\+\\\$7, %ymm\[0-9]\+, %ymm\[0-9]\+" 1 } } */ /* { dg-final { scan-assembler-times "vpsllq\[ \t]\+\\\$7, %ymm\[0-9]\+, %ymm\[0-9]\+" 1 } } */ /* { dg-final { scan-assembler-times "vpsllw\[ \t]\+\\\$7, %ymm\[0-9]\+, %ymm\[0-9]\+" 3 } } */ -/* { dg-final { scan-assembler-times "vpsrad\[ \t]\+\\\$3, %ymm\[0-9]\+, %ymm\[0-9]\+" 1 } } */ +/* { dg-final { scan-assembler-times "vpsrad\[ \t]\+\\\$3, %ymm\[0-9]\+, %ymm\[0-9]\+" 2 } } */ /* { dg-final { scan-assembler-times "vpsraq\[ \t]\+\\\$3, %ymm\[0-9]\+, %ymm\[0-9]\+" 0 } } */ /* { dg-final { scan-assembler-times "vpsraw\[ \t]\+\\\$3, %ymm\[0-9]\+, %ymm\[0-9]\+" 3 } } */ /* { dg-final { scan-assembler-times "vpsrld\[ \t]\+\\\$5, %ymm\[0-9]\+, %ymm\[0-9]\+" 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/sse2-psraq-1.c b/gcc/testsuite/gcc.target/i386/sse2-psraq-1.c new file mode 100644 index 0000000..9a08ee4 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/sse2-psraq-1.c @@ -0,0 +1,53 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -msse2 -mno-sse3" } */ +/* { dg-require-effective-target sse2 } */ + +#ifndef CHECK_H +#define CHECK_H "sse2-check.h" +#endif + +#ifndef TEST +#define TEST sse2_test +#endif + +#include CHECK_H + +typedef long long V __attribute__((vector_size (16))); + +#define TESTN(N) \ +static V \ +__attribute__((noipa)) \ +test##N (V x) \ +{ \ + return x >> N; \ +} + +#define TESTS TESTN (63) TESTN (49) TESTN (32) TESTN (31) TESTN (18) +TESTS + +struct +{ + int n; + V (*fn) (V); +} tests[] = { +#undef TESTN +#define TESTN(N) { N, test##N }, + TESTS +}; + +static void +TEST (void) +{ + V a = (V) { 0xdeadbeefcafebabeULL, 0x123456789abcdef0ULL }; + V b = (V) { 0x173a74be8a95134cULL, 0x817bae35ac0ebf12ULL }; + int i; + for (i = 0; tests[i].n; i++) + { + V c = tests[i].fn (a); + if (c[0] != a[0] >> tests[i].n || c[1] != a[1] >> tests[i].n) + abort (); + c = tests[i].fn (b); + if (c[0] != b[0] >> tests[i].n || c[1] != b[1] >> tests[i].n) + abort (); + } +} diff --git a/gcc/testsuite/gcc.target/i386/sse4_2-psraq-1.c b/gcc/testsuite/gcc.target/i386/sse4_2-psraq-1.c new file mode 100644 index 0000000..947b623 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/sse4_2-psraq-1.c @@ -0,0 +1,13 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -msse4.2 -mno-avx" } */ +/* { dg-require-effective-target sse4 } */ + +#ifndef CHECK_H +#define CHECK_H "sse4_2-check.h" +#endif + +#ifndef TEST +#define TEST sse4_2_test +#endif + +#include "sse2-psraq-1.c" -- cgit v1.1 From a451598b2c02e1ca3c62fea272d73a9f31922252 Mon Sep 17 00:00:00 2001 From: Richard Earnshaw Date: Thu, 13 May 2021 11:42:58 +0100 Subject: arm: correctly handle inequality comparisons against max constants [PR100563] Normally we expect the gimple optimizers to fold away comparisons that are always true, but at some lower optimization levels this is not always the case, so the back-end has to be able to generate correct code in these cases. In this example, we have a comparison of the form (unsigned long long) op <= ~0ULL which, of course is always true. Normally, in the arm back-end we handle these expansions where the immediate cannot be handled directly by adding 1 to the constant and then adjusting the comparison operator: (unsigned long long) op < CONST + 1 but we cannot do that when the constant is already the largest value. Fortunately, we observe that the comparisons we need to handle this way are either always true or always false, so instead of forming a comparison against the maximum value, we can replace it with a comparison against the minimum value (which just happens to also be a constant we can handle. So op1 <= ~0ULL -> op1 >= 0U op1 > ~0ULL -> op1 < 0U op1 <= LONG_LONG_INT_MAX -> op1 >= (-LONG_LONG_INT_MAX - 1) op1 > LONG_LONG_INT_MAX -> op1 < (-LONG_LONG_INT_MAX - 1) gcc: PR target/100563 * config/arm/arm.c (arm_canonicalize_comparison): Correctly canonicalize DImode inequality comparisons against the maximum integral value. gcc/testsuite: * gcc.dg/pr100563.c: New test. --- gcc/testsuite/gcc.dg/pr100563.c | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr100563.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/pr100563.c b/gcc/testsuite/gcc.dg/pr100563.c new file mode 100644 index 0000000..812eb9e --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr100563.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-Og" } */ +unsigned long long e(void); +void f(int); +void a() { + short b = -1, c = (int)&b; + unsigned long long d = e(); + f(b >= d); +} -- cgit v1.1 From efd471a980662f113dad8de0c0ef8593d0d38419 Mon Sep 17 00:00:00 2001 From: Richard Earnshaw Date: Thu, 13 May 2021 14:52:05 +0100 Subject: testsuite: suppress cast warnings in pr100563.c [PR100563] Fix a warning when building on machines that don't have 32-bit pointers gcc/testsuite: PR target/100563 * gcc.dg/pr100563.c (dg-options): Add -wno-pointer-to-int-cast. --- gcc/testsuite/gcc.dg/pr100563.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/pr100563.c b/gcc/testsuite/gcc.dg/pr100563.c index 812eb9e..f6a5fcd 100644 --- a/gcc/testsuite/gcc.dg/pr100563.c +++ b/gcc/testsuite/gcc.dg/pr100563.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-Og" } */ +/* { dg-options "-Og -Wno-pointer-to-int-cast" } */ unsigned long long e(void); void f(int); void a() { -- cgit v1.1 From d80aeff0bf2f455e9099def756f612bfbcd2cb0d Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 13 May 2021 16:53:48 +0200 Subject: openmp: Add testcases to verify OpenMP 5.0 2.14 and OpenMP 5.1 2.17 rules [PR99928] In preparation of PR99928 patch review, I've prepared testcases with clauses that need more interesting handling on combined/composite constructs, in particular firstprivate, lastprivate, firstprivate+lastprivate, linear (explicit on non-iv, explicit on simd iv, implicit on simd iv, implicit on simd iv declared in the construct), reduction (scalars, array sections of array variables, array sections with pointer bases) and in_reduction. OpenMP 5.0 had the wording broken for reduction, the intended rule to use map(tofrom:) on target when combined with it was bound only on inscan modifier presence which makes no sense, as then inscan may not be used, this has been fixed in 5.1 and I'm just assuming 5.1 wording for that. There are various cases where e.g. from historical or optimization reasons GCC slightly deviates from the rules, but in most cases it is something that shouldn't be really observable, e.g. whether #pragma omp parallel for firstprivate(x) is handled as #pragma omp parallel shared(x) #pragma omp for firstprivate(x) or #pragma omp parallel firstprivate(x) #pragma omp for shouldn't be possible to distinguish in user code. I've added FIXMEs in the testcases about that, but maybe we just should keep it as is (alternative would be to do it in standard compliant way and transform into whatever we like after gimplification (e.g. early during omplower)). Some cases we for historical reasons implement even with clauses on constructs which in the standard don't accept them that way and then handling those magically in omp lowering/expansion, in particular e.g. #pragma omp parallel for firstprivate(x) lastprivate(x) we treat as #pragma omp parallel firstprivate(x) lastprivate(x) #pragma omp for even when lastprivate is not valid on parallel. Maybe one day we could change that if we make sure we don't regress generated code quality. I've also found a bug in OpenMP 5.0/5.1, #pragma omp parallel sections firstprivate(x) lastprivate(x) incorrectly says that it should be handled as #pragma omp parallel firstprivate(x) #pragma omp sections lastprivate(x) which when written that way results in error; filed as https://github.com/OpenMP/spec/issues/2758 to be fixed in OpenMP 5.2. GCC handles it the way it used to do and users expect, so nothing to fix on the GCC side. Also, we don't support yet in_reduction clause on target construct, which means the -11.c testcase can't include any tests about in_reduction handling on all the composite constructs that include target. The work found two kinds of bugs on the GCC side, one is the known thing that we implement still the 4.5 behavior and don't mark for lastprivate/linear/reduction the list item as map(tofrom:) as mentioned in PR99928. These cases are xfailed in the tests. And another one is with r21 and r28 in -{8,9,10}.c tests - we don't add reduction clause on teams for #pragma omp {target ,}teams distribute simd reduction(+:r) even when the spec says that teams shouldn't receive reduction only when combined with loop construct. In make check-gcc check-g++ RUNTESTFLAGS='--target_board=unix\{-m32,-m64\} gomp.exp=pr99928*' testing this shows: # of expected passes 5648 # of expected failures 872 and with Tobias' patch applied: # of expected passes 5648 # of unexpected successes 384 # of expected failures 488 2021-05-13 Jakub Jelinek PR middle-end/99928 * c-c++-common/gomp/pr99928-1.c: New test. * c-c++-common/gomp/pr99928-2.c: New test. * c-c++-common/gomp/pr99928-3.c: New test. * c-c++-common/gomp/pr99928-4.c: New test. * c-c++-common/gomp/pr99928-5.c: New test. * c-c++-common/gomp/pr99928-6.c: New test. * c-c++-common/gomp/pr99928-7.c: New test. * c-c++-common/gomp/pr99928-8.c: New test. * c-c++-common/gomp/pr99928-9.c: New test. * c-c++-common/gomp/pr99928-10.c: New test. * c-c++-common/gomp/pr99928-11.c: New test. --- gcc/testsuite/c-c++-common/gomp/pr99928-1.c | 206 ++++++++++++++++++++++++ gcc/testsuite/c-c++-common/gomp/pr99928-10.c | 231 +++++++++++++++++++++++++++ gcc/testsuite/c-c++-common/gomp/pr99928-11.c | 28 ++++ gcc/testsuite/c-c++-common/gomp/pr99928-2.c | 208 ++++++++++++++++++++++++ gcc/testsuite/c-c++-common/gomp/pr99928-3.c | 119 ++++++++++++++ gcc/testsuite/c-c++-common/gomp/pr99928-4.c | 76 +++++++++ gcc/testsuite/c-c++-common/gomp/pr99928-5.c | 107 +++++++++++++ gcc/testsuite/c-c++-common/gomp/pr99928-6.c | 107 +++++++++++++ gcc/testsuite/c-c++-common/gomp/pr99928-7.c | 103 ++++++++++++ gcc/testsuite/c-c++-common/gomp/pr99928-8.c | 219 +++++++++++++++++++++++++ gcc/testsuite/c-c++-common/gomp/pr99928-9.c | 219 +++++++++++++++++++++++++ 11 files changed, 1623 insertions(+) create mode 100644 gcc/testsuite/c-c++-common/gomp/pr99928-1.c create mode 100644 gcc/testsuite/c-c++-common/gomp/pr99928-10.c create mode 100644 gcc/testsuite/c-c++-common/gomp/pr99928-11.c create mode 100644 gcc/testsuite/c-c++-common/gomp/pr99928-2.c create mode 100644 gcc/testsuite/c-c++-common/gomp/pr99928-3.c create mode 100644 gcc/testsuite/c-c++-common/gomp/pr99928-4.c create mode 100644 gcc/testsuite/c-c++-common/gomp/pr99928-5.c create mode 100644 gcc/testsuite/c-c++-common/gomp/pr99928-6.c create mode 100644 gcc/testsuite/c-c++-common/gomp/pr99928-7.c create mode 100644 gcc/testsuite/c-c++-common/gomp/pr99928-8.c create mode 100644 gcc/testsuite/c-c++-common/gomp/pr99928-9.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/c-c++-common/gomp/pr99928-1.c b/gcc/testsuite/c-c++-common/gomp/pr99928-1.c new file mode 100644 index 0000000..37181fd --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr99928-1.c @@ -0,0 +1,206 @@ +/* PR middle-end/99928 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp -fdump-tree-gimple" } */ + +int f00, f01, f02, f03, f04, f05, f06, f07, f08, f09; +int f12, f13, f14, f15, f16, f17, f18, f19; +int f20, f21, f22, f23, f24, f25, f26, f27, f28, f29; + +void +foo (void) +{ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*firstprivate\\(f00\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f00\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(f00\\)" "gimple" } } *//* FIXME. */ + #pragma omp distribute parallel for firstprivate (f00) + for (int i = 0; i < 64; i++) + f00++; + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*firstprivate\\(f01\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f01\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(f01\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f01\\)" "gimple" } } */ + #pragma omp distribute parallel for simd firstprivate (f01) + for (int i = 0; i < 64; i++) + f01++; + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*firstprivate\\(f02\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f02\\)" "gimple" } } */ + #pragma omp distribute simd firstprivate (f02) + for (int i = 0; i < 64; i++) + f02++; +} + +void +bar (void) +{ + int f10 = 0, f11 = 0; + /* { dg-final { scan-tree-dump "omp for\[^\n\r]*firstprivate\\(f03\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f03\\)" "gimple" } } */ + #pragma omp for simd firstprivate (f03) + for (int i = 0; i < 64; i++) + f03++; + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*firstprivate\\(f04\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*firstprivate\\(f04\\)" "gimple" } } */ + #pragma omp master taskloop firstprivate (f04) + for (int i = 0; i < 64; i++) + f04++; + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*firstprivate\\(f05\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*firstprivate\\(f05\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f05\\)" "gimple" } } */ + #pragma omp master taskloop simd firstprivate (f05) + for (int i = 0; i < 64; i++) + f05++; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f06\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(f06\\)" "gimple" } } *//* FIXME. */ + #pragma omp parallel for firstprivate (f06) + for (int i = 0; i < 64; i++) + f06++; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f07\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(f07\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f07\\)" "gimple" } } */ + #pragma omp parallel for simd firstprivate (f07) + for (int i = 0; i < 64; i++) + f07++; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f08\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(f08\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f08\\)" "gimple" } } */ + #pragma omp parallel loop firstprivate (f08) + for (int i = 0; i < 64; i++) + f08++; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f09\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*firstprivate\\(f09\\)" "gimple" } } */ + #pragma omp parallel master firstprivate (f09) + f09++; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(f10\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*firstprivate\\(f10\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*firstprivate\\(f10\\)" "gimple" } } */ + #pragma omp parallel master taskloop firstprivate (f10) + for (int i = 0; i < 64; i++) + f10++; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(f11\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*firstprivate\\(f11\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*firstprivate\\(f11\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f11\\)" "gimple" } } */ + #pragma omp parallel master taskloop simd firstprivate (f11) + for (int i = 0; i < 64; i++) + f11++; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f12\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp sections\[^\n\r]*firstprivate\\(f12\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp section \[^\n\r]*firstprivate\\(f12\\)" "gimple" } } */ + #pragma omp parallel sections firstprivate (f12) + { + f12++; + #pragma omp section + f12++; + } + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*firstprivate\\(f13\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f13\\)" "gimple" } } */ + #pragma omp target parallel firstprivate (f13) + f13++; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*firstprivate\\(f14\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f14\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(f14\\)" "gimple" } } *//* FIXME. */ + #pragma omp target parallel for firstprivate (f14) + for (int i = 0; i < 64; i++) + f14++; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*firstprivate\\(f15\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f15\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(f15\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f15\\)" "gimple" } } */ + #pragma omp target parallel for simd firstprivate (f15) + for (int i = 0; i < 64; i++) + f15++; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*firstprivate\\(f16\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f16\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(f16\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f16\\)" "gimple" } } */ + #pragma omp target parallel loop firstprivate (f16) + for (int i = 0; i < 64; i++) + f16++; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*firstprivate\\(f17\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*firstprivate\\(f17\\)" "gimple" } } */ + #pragma omp target teams firstprivate (f17) + f17++; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*firstprivate\\(f18\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*firstprivate\\(f18\\)" "gimple" } } *//* FIXME: This should be on distribute instead. */ + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*firstprivate\\(f18\\)" "gimple" } } *//* FIXME. */ + #pragma omp target teams distribute firstprivate (f18) + for (int i = 0; i < 64; i++) + f18++; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*firstprivate\\(f19\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*firstprivate\\(f19\\)" "gimple" } } *//* FIXME: This should be on distribute instead. */ + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*firstprivate\\(f19\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f19\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(f19\\)" "gimple" } } *//* FIXME. */ + #pragma omp target teams distribute parallel for firstprivate (f19) + for (int i = 0; i < 64; i++) + f19++; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*firstprivate\\(f20\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*firstprivate\\(f20\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*firstprivate\\(f20\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f20\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(f20\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f20\\)" "gimple" } } */ + #pragma omp target teams distribute parallel for simd firstprivate (f20) + for (int i = 0; i < 64; i++) + f20++; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*firstprivate\\(f21\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*firstprivate\\(f21\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*firstprivate\\(f21\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f21\\)" "gimple" } } */ + #pragma omp target teams distribute simd firstprivate (f21) + for (int i = 0; i < 64; i++) + f21++; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*firstprivate\\(f22\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*firstprivate\\(f22\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*firstprivate\\(f22\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(f22\\)" "gimple" } } *//* NOTE: This is an implementation detail. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(f22\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f22\\)" "gimple" } } */ + #pragma omp target teams loop firstprivate (f22) + for (int i = 0; i < 64; i++) + f22++; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*firstprivate\\(f23\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f23\\)" "gimple" } } */ + #pragma omp target simd firstprivate (f23) + for (int i = 0; i < 64; i++) + f23++; + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*firstprivate\\(f24\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f24\\)" "gimple" } } */ + #pragma omp taskloop simd firstprivate (f24) + for (int i = 0; i < 64; i++) + f24++; + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*firstprivate\\(f25\\)" "gimple" } } *//* FIXME: This should be on distribute instead. */ + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*firstprivate\\(f25\\)" "gimple" } } *//* FIXME. */ + #pragma omp teams distribute firstprivate (f25) + for (int i = 0; i < 64; i++) + f25++; + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*firstprivate\\(f26\\)" "gimple" } } *//* FIXME: This should be on distribute instead. */ + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*firstprivate\\(f26\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f26\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(f26\\)" "gimple" } } *//* FIXME. */ + #pragma omp teams distribute parallel for firstprivate (f26) + for (int i = 0; i < 64; i++) + f26++; + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*firstprivate\\(f27\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*firstprivate\\(f27\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(f27\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(f27\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f27\\)" "gimple" } } */ + #pragma omp teams distribute parallel for simd firstprivate (f27) + for (int i = 0; i < 64; i++) + f27++; + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*firstprivate\\(f28\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*firstprivate\\(f28\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f28\\)" "gimple" } } */ + #pragma omp teams distribute simd firstprivate (f28) + for (int i = 0; i < 64; i++) + f28++; + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*firstprivate\\(f29\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*firstprivate\\(f29\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(f29\\)" "gimple" } } *//* NOTE: This is an implementation detail. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(f29\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(f29\\)" "gimple" } } */ + #pragma omp teams loop firstprivate (f29) + for (int i = 0; i < 64; i++) + f29++; +} diff --git a/gcc/testsuite/c-c++-common/gomp/pr99928-10.c b/gcc/testsuite/c-c++-common/gomp/pr99928-10.c new file mode 100644 index 0000000..4acff45 --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr99928-10.c @@ -0,0 +1,231 @@ +/* PR middle-end/99928 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp -fdump-tree-gimple" } */ + +int *r00, *r01, *r02, *r03, *r04, *r05; +int *r13, *r14, *r15, *r16, *r17, *r18, *r19; +int *r20, *r21, *r22, *r23, *r24; +int *baz (void); + +void +foo (void) +{ + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r00 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r00 \\+ 4" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r00 \\+ 4" "gimple" } } *//* FIXME. */ + #pragma omp distribute parallel for reduction(+:r00[1:2]) + for (int i = 0; i < 64; i++) + r00[1]++; + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r01 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r01 \\+ 4" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r01 \\+ 4" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r01 \\+ 4" "gimple" } } */ + #pragma omp distribute parallel for simd reduction(+:r01[1:3]) + for (int i = 0; i < 64; i++) + r01[1]++; + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r02 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r02 \\+ 4" "gimple" } } */ + #pragma omp distribute simd reduction(+:r02[1:4]) + for (int i = 0; i < 64; i++) + r02[1]++; +} + +void +bar (void) +{ + int *r06 = baz (), *r07 = baz (), *r08 = baz (), *r09 = baz (); + int *r10 = baz (), *r11 = baz (), *r12 = baz (); + int *r25 = baz (), *r26 = baz (), *r27 = baz (), *r28 = baz (), *r29 = baz (); + /* { dg-final { scan-tree-dump "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r03 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r03 \\+ 4" "gimple" } } */ + #pragma omp for simd reduction(+:r03[1:5]) + for (int i = 0; i < 64; i++) + r03[1]++; + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r04 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r04 \\+ 4" "gimple" } } */ + #pragma omp master taskloop reduction(+:r04[1:6]) + for (int i = 0; i < 64; i++) + r04[1]++; + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r05 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r05 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r05 \\+ 4" "gimple" } } */ + #pragma omp master taskloop simd reduction(+:r05[1:7]) + for (int i = 0; i < 64; i++) + r05[1]++; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r06 \\+ 4" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r06 \\+ 4" "gimple" } } *//* FIXME. */ + #pragma omp parallel for reduction(+:r06[1:8]) + for (int i = 0; i < 64; i++) + r06[1]++; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r07 \\+ 4" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r07 \\+ 4" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r07 \\+ 4" "gimple" } } */ + #pragma omp parallel for simd reduction(+:r07[1:9]) + for (int i = 0; i < 64; i++) + r07[1]++; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(r08\\)" "gimple" } } *//* FIXME: Should be shared, but firstprivate is an optimization. */ + /* { dg-final { scan-tree-dump "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r08 \\+ 4" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r08 \\+ 4" "gimple" } } *//* NOTE: This is implementation detail. */ + #pragma omp parallel loop reduction(+:r08[1:10]) + for (int i = 0; i < 64; i++) + r08[1]++; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r09 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r09 \\+ 4" "gimple" } } */ + #pragma omp parallel master reduction(+:r09[1:11]) + r09[1]++; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(r10\\)" "gimple" } } *//* FIXME: Should be shared, but firstprivate is an optimization. */ + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r10 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r10 \\+ 4" "gimple" } } */ + #pragma omp parallel master taskloop reduction(+:r10[1:12]) + for (int i = 0; i < 64; i++) + r10[1]++; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(r11\\)" "gimple" } } *//* FIXME: Should be shared, but firstprivate is an optimization. */ + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r11 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r11 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r11 \\+ 4" "gimple" } } */ + #pragma omp parallel master taskloop simd reduction(+:r11[1:13]) + for (int i = 0; i < 64; i++) + r11[1]++; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r12 \\+ 4" "gimple" } } *//* FIXME: This should be on sections instead. */ + /* { dg-final { scan-tree-dump-not "omp sections\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r12 \\+ 4" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump-not "omp section \[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r12 \\+ 4" "gimple" } } */ + #pragma omp parallel sections reduction(+:r12[1:14]) + { + r12[1]++; + #pragma omp section + r12[1]++; + } + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:\\\*_\[0-9]* \\\[len: 60\\\]" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(firstprivate:r13 \\\[pointer assign, bias: 4\\\]\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r13\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r13 \\+ 4" "gimple" } } */ + #pragma omp target parallel reduction(+:r13[1:15]) + r13[1]++; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:\\\*_\[0-9]* \\\[len: 64\\\]" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(firstprivate:r14 \\\[pointer assign, bias: 4\\\]\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r14" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r14 \\+ 4" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r14 \\+ 4" "gimple" } } *//* FIXME. */ + #pragma omp target parallel for reduction(+:r14[1:16]) + for (int i = 0; i < 64; i++) + r14[1]++; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:\\\*_\[0-9]* \\\[len: 68\\\]" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(firstprivate:r15 \\\[pointer assign, bias: 4\\\]\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r15\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r15 \\+ 4" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r15 \\+ 4" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r15 \\+ 4" "gimple" } } */ + #pragma omp target parallel for simd reduction(+:r15[1:17]) + for (int i = 0; i < 64; i++) + r15[1]++; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:\\\*_\[0-9]* \\\[len: 72\\\]" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(firstprivate:r16 \\\[pointer assign, bias: 4\\\]\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r16\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(r16\\)" "gimple" } } *//* FIXME: Should be shared, but firstprivate is an optimization. */ + /* { dg-final { scan-tree-dump "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r16 \\+ 4" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r16 \\+ 4" "gimple" } } *//* NOTE: This is implementation detail. */ + #pragma omp target parallel loop reduction(+:r16[1:18]) + for (int i = 0; i < 64; i++) + r16[1]++; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:\\\*_\[0-9]* \\\[len: 76\\\]" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(firstprivate:r17 \\\[pointer assign, bias: 4\\\]\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r17\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r17 \\+ 4" "gimple" } } */ + #pragma omp target teams reduction(+:r17[1:19]) + r17[1]++; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:\\\*_\[0-9]* \\\[len: 80\\\]" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(firstprivate:r18 \\\[pointer assign, bias: 4\\\]\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r18\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r18 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r18 \\+ 4" "gimple" } } */ + #pragma omp target teams distribute reduction(+:r18[1:20]) + for (int i = 0; i < 64; i++) + r18[1]++; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:\\\*_\[0-9]* \\\[len: 84\\\]" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(firstprivate:r19 \\\[pointer assign, bias: 4\\\]\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r19\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r19 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r19 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r19 \\+ 4" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r19 \\+ 4" "gimple" } } *//* FIXME. */ + #pragma omp target teams distribute parallel for reduction(+:r19[1:21]) + for (int i = 0; i < 64; i++) + r19[1]++; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:\\\*_\[0-9]* \\\[len: 88\\\]" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(firstprivate:r20 \\\[pointer assign, bias: 4\\\]\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r20\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r20 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r20 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r20 \\+ 4" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r20 \\+ 4" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r20 \\+ 4" "gimple" } } */ + #pragma omp target teams distribute parallel for simd reduction(+:r20[1:22]) + for (int i = 0; i < 64; i++) + r20[1]++; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:\\\*_\[0-9]* \\\[len: 92\\\]" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(firstprivate:r21 \\\[pointer assign, bias: 4\\\]\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r21\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r21 \\+ 4" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r21 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r21 \\+ 4" "gimple" } } */ + #pragma omp target teams distribute simd reduction(+:r21[1:23]) + for (int i = 0; i < 64; i++) + r21[1]++; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:\\\*_\[0-9]* \\\[len: 96\\\]" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(firstprivate:r22 \\\[pointer assign, bias: 4\\\]\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r22\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*firstprivate\\(r22\\)" "gimple" } } *//* FIXME: Should be shared, but firstprivate is an optimization. */ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r22 \\+ 4" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(r22\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r22 \\+ 4" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r22 \\+ 4" "gimple" } } *//* NOTE: This is implementation detail. */ + #pragma omp target teams loop reduction(+:r22[1:24]) + for (int i = 0; i < 64; i++) + r22[1]++; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:\\\*_\[0-9]* \\\[len: 100\\\]" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(firstprivate:r23 \\\[pointer assign, bias: 4\\\]\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r23\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r23 \\+ 4" "gimple" } } */ + #pragma omp target simd reduction(+:r23[1:25]) + for (int i = 0; i < 64; i++) + r23[1]++; + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r24 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r24 \\+ 4" "gimple" } } */ + #pragma omp taskloop simd reduction(+:r24[1:26]) + for (int i = 0; i < 64; i++) + r24[1]++; + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r25 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r25 \\+ 4" "gimple" } } */ + #pragma omp teams distribute reduction(+:r25[1:27]) + for (int i = 0; i < 64; i++) + r25[1]++; + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r26 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r26 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r26 \\+ 4" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r26 \\+ 4" "gimple" } } *//* FIXME. */ + #pragma omp teams distribute parallel for reduction(+:r26[1:28]) + for (int i = 0; i < 64; i++) + r26[1]++; + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r27 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r27 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r27 \\+ 4" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r27 \\+ 4" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r27 \\+ 4" "gimple" } } */ + #pragma omp teams distribute parallel for simd reduction(+:r27[1:29]) + for (int i = 0; i < 64; i++) + r27[1]++; + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r28 \\+ 4" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r28 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r28 \\+ 4" "gimple" } } */ + #pragma omp teams distribute simd reduction(+:r28[1:30]) + for (int i = 0; i < 64; i++) + r28[1]++; + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*firstprivate\\(r29\\)" "gimple" } } *//* FIXME: Should be shared, but firstprivate is an optimization. */ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r29 \\+ 4" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(r29\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r29 \\+ 4" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r29 \\+ 4" "gimple" } } *//* NOTE: This is implementation detail. */ + #pragma omp teams loop reduction(+:r29[1:31]) + for (int i = 0; i < 64; i++) + r29[1]++; +} diff --git a/gcc/testsuite/c-c++-common/gomp/pr99928-11.c b/gcc/testsuite/c-c++-common/gomp/pr99928-11.c new file mode 100644 index 0000000..66c2feb --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr99928-11.c @@ -0,0 +1,28 @@ +/* PR middle-end/99928 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp -fdump-tree-gimple" } */ + +int r00, r01, r02; + +void +bar (void) +{ + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*in_reduction\\(\\+:r00\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*in_reduction\\(\\+:r00\\)" "gimple" } } */ + #pragma omp master taskloop in_reduction(+:r00) + for (int i = 0; i < 64; i++) + r00++; + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*in_reduction\\(\\+:r01\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*in_reduction\\(\\+:r01\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*in_reduction\\(\\+:r01\\)" "gimple" } } */ + #pragma omp master taskloop simd in_reduction(+:r01) + for (int i = 0; i < 64; i++) + r01++; + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*in_reduction\\(\\+:r02\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*in_reduction\\(\\+:r02\\)" "gimple" } } */ + #pragma omp taskloop simd in_reduction(+:r02) + for (int i = 0; i < 64; i++) + r02++; + /* FIXME: We don't support in_reduction clause on target yet, once we do, should + add testcase coverage for all combined/composite constructs with target as leaf construct. */ +} diff --git a/gcc/testsuite/c-c++-common/gomp/pr99928-2.c b/gcc/testsuite/c-c++-common/gomp/pr99928-2.c new file mode 100644 index 0000000..313374c --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr99928-2.c @@ -0,0 +1,208 @@ +/* PR middle-end/99928 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp -fdump-tree-gimple" } */ + +int l00, l01, l02, l03, l04, l05, l06, l07; +int l10, l11, l12, l13, l14, l15, l16, l17, l18; + +void +foo (void) +{ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(l00\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l00\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l00\\)" "gimple" } } *//* FIXME. */ + #pragma omp distribute parallel for lastprivate (l00) + for (int i = 0; i < 64; i++) + l00 = i; + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(l01\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l01\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l01\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l01\\)" "gimple" } } */ + #pragma omp distribute parallel for simd lastprivate (l01) + for (int i = 0; i < 64; i++) + l01 = i; + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(l02\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l02\\)" "gimple" } } */ + #pragma omp distribute simd lastprivate (l02) + for (int i = 0; i < 64; i++) + l02 = i; +} + +void +bar (void) +{ + int j00, j01, j02, j03; + int l08 = 0, l09 = 0, l19 = 0, l20 = 0, l21 = 0, l22 = 0; + /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(l03\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l03\\)" "gimple" } } */ + #pragma omp for simd lastprivate (l03) + for (int i = 0; i < 64; i++) + l03 = i; + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(l04\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(l04\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(l04\\)" "gimple" } } */ + #pragma omp master taskloop lastprivate (l04) + for (int i = 0; i < 64; i++) + l04 = i; + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(l05\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(l05\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(l05\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l05\\)" "gimple" } } */ + #pragma omp master taskloop simd lastprivate (l05) + for (int i = 0; i < 64; i++) + l05 = i; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l06\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l06\\)" "gimple" } } *//* FIXME. */ + #pragma omp parallel for lastprivate (l06) + for (int i = 0; i < 64; i++) + l06 = i; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l07\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l07\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l07\\)" "gimple" } } */ + #pragma omp parallel for simd lastprivate (l07) + for (int i = 0; i < 64; i++) + l07 = i; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j00\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j00\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j00\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + #pragma omp parallel loop lastprivate (j00) + for (j00 = 0; j00 < 64; j00++) + ; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(l08\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(l08\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(l08\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(l08\\)" "gimple" } } */ + #pragma omp parallel master taskloop lastprivate (l08) + for (int i = 0; i < 64; i++) + l08 = i; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(l09\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(l09\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(l09\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(l09\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l09\\)" "gimple" } } */ + #pragma omp parallel master taskloop simd lastprivate (l09) + for (int i = 0; i < 64; i++) + l09 = i; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l10\\)" "gimple" } } *//* FIXME: This should be on sections instead. */ + /* { dg-final { scan-tree-dump-not "omp sections\[^\n\r]*lastprivate\\(l10\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump-not "omp section \[^\n\r]*lastprivate\\(l10\\)" "gimple" } } */ + #pragma omp parallel sections lastprivate (l10) + { + l10 = 1; + #pragma omp section + l10 = 2; + } + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l11" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l11\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l11\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l11\\)" "gimple" } } *//* FIXME. */ + #pragma omp target parallel for lastprivate (l11) + for (int i = 0; i < 64; i++) + l11 = i; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l12" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l12\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l12\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l12\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l12\\)" "gimple" } } */ + #pragma omp target parallel for simd lastprivate (l12) + for (int i = 0; i < 64; i++) + l12 = i; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j01" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j01\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j01\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j01\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j01\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + #pragma omp target parallel loop lastprivate (j01) + for (j01 = 0; j01 < 64; j01++) + ; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l13" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l13\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(l13\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(l13\\)" "gimple" } } */ + #pragma omp target teams distribute lastprivate (l13) + for (int i = 0; i < 64; i++) + l13 = i; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l14" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l14\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(l14\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(l14\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l14\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l14\\)" "gimple" } } *//* FIXME. */ + #pragma omp target teams distribute parallel for lastprivate (l14) + for (int i = 0; i < 64; i++) + l14 = i; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l15" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l15\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(l15\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(l15\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l15\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l15\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l15\\)" "gimple" } } */ + #pragma omp target teams distribute parallel for simd lastprivate (l15) + for (int i = 0; i < 64; i++) + l15 = i; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l16" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l16\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(l16\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(l16\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l16\\)" "gimple" } } */ + #pragma omp target teams distribute simd lastprivate (l16) + for (int i = 0; i < 64; i++) + l16 = i; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j02" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j02\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j02\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j02\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j02\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j02\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j02\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + #pragma omp target teams loop lastprivate (j02) + for (j02 = 0; j02 < 64; j02++) + ; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l17" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l17\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l17\\)" "gimple" } } */ + #pragma omp target simd lastprivate (l17) + for (int i = 0; i < 64; i++) + l17 = i; + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(l18\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(l18\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l18\\)" "gimple" } } */ + #pragma omp taskloop simd lastprivate (l18) + for (int i = 0; i < 64; i++) + l18 = i; + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(l19\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(l19\\)" "gimple" } } */ + #pragma omp teams distribute lastprivate (l19) + for (int i = 0; i < 64; i++) + l19 = i; + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(l20\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(l20\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l20\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l20\\)" "gimple" } } *//* FIXME. */ + #pragma omp teams distribute parallel for lastprivate (l20) + for (int i = 0; i < 64; i++) + l20 = i; + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(l21\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(l21\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l21\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l21\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l21\\)" "gimple" } } */ + #pragma omp teams distribute parallel for simd lastprivate (l21) + for (int i = 0; i < 64; i++) + l21 = i; + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(l22\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(l22\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l22\\)" "gimple" } } */ + #pragma omp teams distribute simd lastprivate (l22) + for (int i = 0; i < 64; i++) + l22 = i; + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j03\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j03\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j03\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j03\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(j03\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + #pragma omp teams loop lastprivate (j03) + for (j03 = 0; j03 < 64; j03++) + ; +} diff --git a/gcc/testsuite/c-c++-common/gomp/pr99928-3.c b/gcc/testsuite/c-c++-common/gomp/pr99928-3.c new file mode 100644 index 0000000..67f590b --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr99928-3.c @@ -0,0 +1,119 @@ +/* PR middle-end/99928 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp -fdump-tree-gimple" } */ + +int l00, l01, l02, l03, l04, l07, l08, l09; +int l10, l11; + +void +bar (void) +{ + int l05 = 0, l06 = 0; + /* { dg-final { scan-tree-dump "omp for\[^\n\r]*firstprivate\\(l00\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(l00\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(l00\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l00\\)" "gimple" } } */ + #pragma omp for simd firstprivate (l00) lastprivate (l00) + for (int i = 0; i < 64; i++) + l00 = i; + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*firstprivate\\(l01\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(l01\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*firstprivate\\(l01\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(l01\\)" "gimple" } } */ + #pragma omp master taskloop firstprivate (l01) lastprivate (l01) + for (int i = 0; i < 64; i++) + l01 = i; + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*firstprivate\\(l02\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(l02\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*firstprivate\\(l02\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(l02\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(l02\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l02\\)" "gimple" } } */ + #pragma omp master taskloop simd firstprivate (l02) lastprivate (l02) + for (int i = 0; i < 64; i++) + l02 = i; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(l03\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l03\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(l03\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l03\\)" "gimple" } } *//* FIXME. */ + #pragma omp parallel for firstprivate (l03) lastprivate (l03) + for (int i = 0; i < 64; i++) + l03 = i; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(l04\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l04\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(l04\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l04\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(l04\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l04\\)" "gimple" } } */ + #pragma omp parallel for simd firstprivate (l04) lastprivate (l04) + for (int i = 0; i < 64; i++) + l04 = i; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(l05\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*firstprivate\\(l05\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(l05\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*firstprivate\\(l05\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(l05\\)" "gimple" } } */ + #pragma omp parallel master taskloop firstprivate (l05) lastprivate (l05) + for (int i = 0; i < 64; i++) + l05 = i; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(l06\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*firstprivate\\(l06\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(l06\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*firstprivate\\(l06\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(l06\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(l06\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l06\\)" "gimple" } } */ + #pragma omp parallel master taskloop simd firstprivate (l06) lastprivate (l06) + for (int i = 0; i < 64; i++) + l06 = i; + /* FIXME: OpenMP 5.0/5.1 broken here, conceptually it should be shared on parallel and + firstprivate+lastprivate on sections, in GCC implementation we put firstprivate+lastprivate + on parallel for historic reasons, but OpenMP 5.0/5.1 mistakenly say firstprivate + should be on parallel and lastprivate on sections. */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(l07\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l07\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp sections\[^\n\r]*firstprivate\\(l07\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp sections\[^\n\r]*lastprivate\\(l07\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp section \[^\n\r]*firstprivate\\(l07\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp section \[^\n\r]*lastprivate\\(l07\\)" "gimple" } } */ + #pragma omp parallel sections firstprivate (l07) lastprivate (l07) + { + l07 = 1; + #pragma omp section + l07 = 2; + } + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l08" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l08\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(l08\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l08\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(l08\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l08\\)" "gimple" } } *//* FIXME. */ + #pragma omp target parallel for firstprivate (l08) lastprivate (l08) + for (int i = 0; i < 64; i++) + l08 = i; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l09" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l09\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(l09\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l09\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(l09\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l09\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(l09\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l09\\)" "gimple" } } */ + #pragma omp target parallel for simd firstprivate (l09) lastprivate (l09) + for (int i = 0; i < 64; i++) + l09 = i; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l10" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l10\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(l10\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l10\\)" "gimple" } } */ + #pragma omp target simd firstprivate (l10) lastprivate (l10) + for (int i = 0; i < 64; i++) + l10 = i; + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*firstprivate\\(l11\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(l11\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp simd\[^\n\r]*firstprivate\\(l11\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*lastprivate\\(l11\\)" "gimple" } } */ + #pragma omp taskloop simd firstprivate (l11) lastprivate (l11) + for (int i = 0; i < 64; i++) + l11 = i; +} diff --git a/gcc/testsuite/c-c++-common/gomp/pr99928-4.c b/gcc/testsuite/c-c++-common/gomp/pr99928-4.c new file mode 100644 index 0000000..c03afc4 --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr99928-4.c @@ -0,0 +1,76 @@ +/* PR middle-end/99928 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp -fdump-tree-gimple" } */ + +int l00, l01, l05, l06, l07, l08; + +void +bar (void) +{ + int l02 = 0, l03 = 0, l04 = 0; + /* { dg-final { scan-tree-dump "omp for\[^\n\r]*firstprivate\\(l00\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(l00\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(l00:1\\)" "gimple" } } */ + #pragma omp for simd linear (l00) + for (int i = 0; i < 64; i++) + l00++; + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*firstprivate\\(l01\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(l01\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*firstprivate\\(l01\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(l01\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(l01:1\\)" "gimple" } } */ + #pragma omp master taskloop simd linear (l01) + for (int i = 0; i < 64; i++) + l01++; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(l02\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp for\[^\n\r]*linear\\(l02:1\\)" "gimple" } } */ + #pragma omp parallel for linear (l02) + for (int i = 0; i < 64; i++) + l02++; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(l03\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l03\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(l03\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l03\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(l03:1\\)" "gimple" } } */ + #pragma omp parallel for simd linear (l03) + for (int i = 0; i < 64; i++) + l03++; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(l04\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*firstprivate\\(l04\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(l04\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*firstprivate\\(l04\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(l04\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(l04:1\\)" "gimple" } } */ + #pragma omp parallel master taskloop simd linear (l04) + for (int i = 0; i < 64; i++) + l04++; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l05" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l05\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(l05\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp for\[^\n\r]*linear\\(l05:1\\)" "gimple" } } */ + #pragma omp target parallel for linear (l05) + for (int i = 0; i < 64; i++) + l05++; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l06" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l06\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(l06\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(l06\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*firstprivate\\(l06\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(l06\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(l06:1\\)" "gimple" } } */ + #pragma omp target parallel for simd linear (l06) + for (int i = 0; i < 64; i++) + l06++; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:l07" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(l07\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(l07:1\\)" "gimple" } } */ + #pragma omp target simd linear (l07) + for (int i = 0; i < 64; i++) + l07++; + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*firstprivate\\(l08\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(l08\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(l08:1\\)" "gimple" } } */ + #pragma omp taskloop simd linear (l08) + for (int i = 0; i < 64; i++) + l08++; +} diff --git a/gcc/testsuite/c-c++-common/gomp/pr99928-5.c b/gcc/testsuite/c-c++-common/gomp/pr99928-5.c new file mode 100644 index 0000000..6eca9c8 --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr99928-5.c @@ -0,0 +1,107 @@ +/* PR middle-end/99928 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp -fdump-tree-gimple" } */ + +int j00, j01, j02, j03, j04, j06, j07, j08, j09; +int j10; + +void +foo (void) +{ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j00\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j00\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j00\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j00:1\\)" "gimple" } } */ + #pragma omp distribute parallel for simd linear (j00) + for (j00 = 0; j00 < 64; j00++) + ; + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j01\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j01:1\\)" "gimple" } } */ + #pragma omp distribute simd linear (j01) + for (j01 = 0; j01 < 64; j01++) + ; +} + +void +bar (void) +{ + int j05, j11, j12; + /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j02\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j02:1\\)" "gimple" } } */ + #pragma omp for simd linear (j02) + for (j02 = 0; j02 < 64; j02++) + ; + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(j03\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(j03\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(j03\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j03:1\\)" "gimple" } } */ + #pragma omp master taskloop simd linear (j03) + for (j03 = 0; j03 < 64; j03++) + ; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j04\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j04\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j04:1\\)" "gimple" } } */ + #pragma omp parallel for simd linear (j04) + for (j04 = 0; j04 < 64; j04++) + ; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j05\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(j05\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(j05\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(j05\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j05:1\\)" "gimple" } } */ + #pragma omp parallel master taskloop simd linear (j05) + for (j05 = 0; j05 < 64; j05++) + ; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j06" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j06\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j06\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j06\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j06:1\\)" "gimple" } } */ + #pragma omp target parallel for simd linear (j06) + for (j06 = 0; j06 < 64; j06++) + ; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j07" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j07\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j07:1\\)" "gimple" } } */ + #pragma omp target simd linear (j07) + for (j07 = 0; j07 < 64; j07++) + ; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j08" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j08\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j08\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j08\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j08\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j08\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j08:1\\)" "gimple" } } */ + #pragma omp target teams distribute parallel for simd linear (j08) + for (j08 = 0; j08 < 64; j08++) + ; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j09" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j09\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j09\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j09\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j09:1\\)" "gimple" } } */ + #pragma omp target teams distribute simd linear (j09) + for (j09 = 0; j09 < 64; j09++) + ; + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(j10\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(j10\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j10:1\\)" "gimple" } } */ + #pragma omp taskloop simd linear (j10) + for (j10 = 0; j10 < 64; j10++) + ; + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j11\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j11\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j11\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j11\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j11:1\\)" "gimple" } } */ + #pragma omp teams distribute parallel for simd linear (j11) + for (j11 = 0; j11 < 64; j11++) + ; + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j12\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j12\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j12:1\\)" "gimple" } } */ + #pragma omp teams distribute simd linear (j12) + for (j12 = 0; j12 < 64; j12++) + ; +} diff --git a/gcc/testsuite/c-c++-common/gomp/pr99928-6.c b/gcc/testsuite/c-c++-common/gomp/pr99928-6.c new file mode 100644 index 0000000..9934047 --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr99928-6.c @@ -0,0 +1,107 @@ +/* PR middle-end/99928 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp -fdump-tree-gimple" } */ + +int j00, j01, j02, j03, j04, j06, j07, j08, j09; +int j10; + +void +foo (void) +{ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j00\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j00\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j00\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j00:1\\)" "gimple" } } */ + #pragma omp distribute parallel for simd + for (j00 = 0; j00 < 64; j00++) + ; + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j01\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j01:1\\)" "gimple" } } */ + #pragma omp distribute simd + for (j01 = 0; j01 < 64; j01++) + ; +} + +void +bar (void) +{ + int j05, j11, j12; + /* { dg-final { scan-tree-dump "omp for\[^\n\r]*lastprivate\\(j02\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j02:1\\)" "gimple" } } */ + #pragma omp for simd + for (j02 = 0; j02 < 64; j02++) + ; + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(j03\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(j03\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(j03\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j03:1\\)" "gimple" } } */ + #pragma omp master taskloop simd + for (j03 = 0; j03 < 64; j03++) + ; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j04\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j04\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j04:1\\)" "gimple" } } */ + #pragma omp parallel for simd + for (j04 = 0; j04 < 64; j04++) + ; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(j05\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(j05\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(j05\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(j05\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j05:1\\)" "gimple" } } */ + #pragma omp parallel master taskloop simd + for (j05 = 0; j05 < 64; j05++) + ; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j06" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j06\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j06\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j06\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j06:1\\)" "gimple" } } */ + #pragma omp target parallel for simd + for (j06 = 0; j06 < 64; j06++) + ; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j07" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j07\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j07:1\\)" "gimple" } } */ + #pragma omp target simd + for (j07 = 0; j07 < 64; j07++) + ; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j08" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j08\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j08\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j08\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j08\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j08\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j08:1\\)" "gimple" } } */ + #pragma omp target teams distribute parallel for simd + for (j08 = 0; j08 < 64; j08++) + ; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:j09" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j09\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j09\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j09\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j09:1\\)" "gimple" } } */ + #pragma omp target teams distribute simd + for (j09 = 0; j09 < 64; j09++) + ; + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*shared\\(j10\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*lastprivate\\(j10\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j10:1\\)" "gimple" } } */ + #pragma omp taskloop simd + for (j10 = 0; j10 < 64; j10++) + ; + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j11\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j11\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*lastprivate\\(j11\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j11\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j11:1\\)" "gimple" } } */ + #pragma omp teams distribute parallel for simd + for (j11 = 0; j11 < 64; j11++) + ; + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(j12\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*lastprivate\\(j12\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j12:1\\)" "gimple" } } */ + #pragma omp teams distribute simd + for (j12 = 0; j12 < 64; j12++) + ; +} diff --git a/gcc/testsuite/c-c++-common/gomp/pr99928-7.c b/gcc/testsuite/c-c++-common/gomp/pr99928-7.c new file mode 100644 index 0000000..5db1101 --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr99928-7.c @@ -0,0 +1,103 @@ +/* PR middle-end/99928 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp -fdump-tree-gimple" } */ + +void +foo (void) +{ + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*lastprivate\\(j00\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp parallel\[^\n\r]*lastprivate\\(j00\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j00\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j00:1\\)" "gimple" } } */ + #pragma omp distribute parallel for simd + for (int j00 = 0; j00 < 64; j00++) + ; + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*lastprivate\\(j01\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j01:1\\)" "gimple" } } */ + #pragma omp distribute simd + for (int j01 = 0; j01 < 64; j01++) + ; +} + +void +bar (void) +{ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j02\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j02:1\\)" "gimple" } } */ + #pragma omp for simd + for (int j02 = 0; j02 < 64; j02++) + ; + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(j03\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp taskloop\[^\n\r]*lastprivate\\(j03\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j03:1\\)" "gimple" } } */ + #pragma omp master taskloop simd + for (int j03 = 0; j03 < 64; j03++) + ; + /* { dg-final { scan-tree-dump-not "omp parallel\[^\n\r]*lastprivate\\(j04\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j04\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j04:1\\)" "gimple" } } */ + #pragma omp parallel for simd + for (int j04 = 0; j04 < 64; j04++) + ; + /* { dg-final { scan-tree-dump-not "omp parallel\[^\n\r]*shared\\(j05\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*lastprivate\\(j05\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp taskloop\[^\n\r]*lastprivate\\(j05\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j05:1\\)" "gimple" } } */ + #pragma omp parallel master taskloop simd + for (int j05 = 0; j05 < 64; j05++) + ; + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*map\\(tofrom:j06" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j06\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp parallel\[^\n\r]*shared\\(j06\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp parallel\[^\n\r]*lastprivate\\(j06\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j06\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j06:1\\)" "gimple" } } */ + #pragma omp target parallel for simd + for (int j06 = 0; j06 < 64; j06++) + ; + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*map\\(tofrom:j07" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j07\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j07:1\\)" "gimple" } } */ + #pragma omp target simd + for (int j07 = 0; j07 < 64; j07++) + ; + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*map\\(tofrom:j08" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j08\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp teams\[^\n\r]*shared\\(j08\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*lastprivate\\(j08\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp parallel\[^\n\r]*shared\\(j08\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp parallel\[^\n\r]*lastprivate\\(j08\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j08\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j08:1\\)" "gimple" } } */ + #pragma omp target teams distribute parallel for simd + for (int j08 = 0; j08 < 64; j08++) + ; + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*map\\(tofrom:j09" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(j09\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp teams\[^\n\r]*shared\\(j09\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*lastprivate\\(j09\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j09:1\\)" "gimple" } } */ + #pragma omp target teams distribute simd + for (int j09 = 0; j09 < 64; j09++) + ; + /* { dg-final { scan-tree-dump-not "omp taskloop\[^\n\r]*lastprivate\\(j10\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j10:1\\)" "gimple" } } */ + #pragma omp taskloop simd + for (int j10 = 0; j10 < 64; j10++) + ; + /* { dg-final { scan-tree-dump-not "omp teams\[^\n\r]*shared\\(j11\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*lastprivate\\(j11\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp parallel\[^\n\r]*shared\\(j11\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp parallel\[^\n\r]*lastprivate\\(j11\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*lastprivate\\(j11\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j11:1\\)" "gimple" } } */ + #pragma omp teams distribute parallel for simd + for (int j11 = 0; j11 < 64; j11++) + ; + /* { dg-final { scan-tree-dump-not "omp teams\[^\n\r]*shared\\(j12\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*lastprivate\\(j12\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*linear\\(j12:1\\)" "gimple" } } */ + #pragma omp teams distribute simd + for (int j12 = 0; j12 < 64; j12++) + ; +} diff --git a/gcc/testsuite/c-c++-common/gomp/pr99928-8.c b/gcc/testsuite/c-c++-common/gomp/pr99928-8.c new file mode 100644 index 0000000..755da3b --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr99928-8.c @@ -0,0 +1,219 @@ +/* PR middle-end/99928 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp -fdump-tree-gimple" } */ + +int r00, r01, r02, r03, r04, r05; +int r13, r14, r15, r16, r17, r18, r19; +int r20, r21, r22, r23, r24; + +void +foo (void) +{ + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:r00\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:r00\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:r00\\)" "gimple" } } *//* FIXME. */ + #pragma omp distribute parallel for reduction(+:r00) + for (int i = 0; i < 64; i++) + r00++; + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:r01\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:r01\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:r01\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r01\\)" "gimple" } } */ + #pragma omp distribute parallel for simd reduction(+:r01) + for (int i = 0; i < 64; i++) + r01++; + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:r02\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r02\\)" "gimple" } } */ + #pragma omp distribute simd reduction(+:r02) + for (int i = 0; i < 64; i++) + r02++; +} + +void +bar (void) +{ + int r06 = 0, r07 = 0, r08 = 0, r09 = 0; + int r10 = 0, r11 = 0, r12 = 0; + int r25 = 0, r26 = 0, r27 = 0, r28 = 0, r29 = 0; + /* { dg-final { scan-tree-dump "omp for\[^\n\r]*reduction\\(\\+:r03\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r03\\)" "gimple" } } */ + #pragma omp for simd reduction(+:r03) + for (int i = 0; i < 64; i++) + r03++; + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*reduction\\(\\+:r04\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*reduction\\(\\+:r04\\)" "gimple" } } */ + #pragma omp master taskloop reduction(+:r04) + for (int i = 0; i < 64; i++) + r04++; + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*reduction\\(\\+:r05\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*reduction\\(\\+:r05\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r05\\)" "gimple" } } */ + #pragma omp master taskloop simd reduction(+:r05) + for (int i = 0; i < 64; i++) + r05++; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:r06\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:r06\\)" "gimple" } } *//* FIXME. */ + #pragma omp parallel for reduction(+:r06) + for (int i = 0; i < 64; i++) + r06++; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:r07\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:r07\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r07\\)" "gimple" } } */ + #pragma omp parallel for simd reduction(+:r07) + for (int i = 0; i < 64; i++) + r07++; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(r08\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp for\[^\n\r]*reduction\\(\\+:r08\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r08\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + #pragma omp parallel loop reduction(+:r08) + for (int i = 0; i < 64; i++) + r08++; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:r09\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*reduction\\(\\+:r09\\)" "gimple" } } */ + #pragma omp parallel master reduction(+:r09) + r09++; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(r10\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*reduction\\(\\+:r10\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*reduction\\(\\+:r10\\)" "gimple" } } */ + #pragma omp parallel master taskloop reduction(+:r10) + for (int i = 0; i < 64; i++) + r10++; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(r11\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*reduction\\(\\+:r11\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*reduction\\(\\+:r11\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r11\\)" "gimple" } } */ + #pragma omp parallel master taskloop simd reduction(+:r11) + for (int i = 0; i < 64; i++) + r11++; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:r12\\)" "gimple" } } *//* FIXME: This should be on sections instead. */ + /* { dg-final { scan-tree-dump-not "omp sections\[^\n\r]*reduction\\(\\+:r12\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump-not "omp section \[^\n\r]*reduction\\(\\+:r12\\)" "gimple" } } */ + #pragma omp parallel sections reduction(+:r12) + { + r12++; + #pragma omp section + r12++; + } + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r13" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r13\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:r13\\)" "gimple" } } */ + #pragma omp target parallel reduction(+:r13) + r13++; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r14" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r14\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:r14\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:r14\\)" "gimple" } } *//* FIXME. */ + #pragma omp target parallel for reduction(+:r14) + for (int i = 0; i < 64; i++) + r14++; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r15" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r15\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:r15\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:r15\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r15\\)" "gimple" } } */ + #pragma omp target parallel for simd reduction(+:r15) + for (int i = 0; i < 64; i++) + r15++; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r16" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r16\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(r16\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp for\[^\n\r]*reduction\\(\\+:r16\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r16\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + #pragma omp target parallel loop reduction(+:r16) + for (int i = 0; i < 64; i++) + r16++; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r17" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r17\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:r17\\)" "gimple" } } */ + #pragma omp target teams reduction(+:r17) + r17++; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r18" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r18\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:r18\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:r18\\)" "gimple" } } */ + #pragma omp target teams distribute reduction(+:r18) + for (int i = 0; i < 64; i++) + r18++; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r19" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r19\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:r19\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:r19\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:r19\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:r19\\)" "gimple" } } *//* FIXME. */ + #pragma omp target teams distribute parallel for reduction(+:r19) + for (int i = 0; i < 64; i++) + r19++; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r20" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r20\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:r20\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:r20\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:r20\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:r20\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r20\\)" "gimple" } } */ + #pragma omp target teams distribute parallel for simd reduction(+:r20) + for (int i = 0; i < 64; i++) + r20++; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r21" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r21\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:r21\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:r21\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r21\\)" "gimple" } } */ + #pragma omp target teams distribute simd reduction(+:r21) + for (int i = 0; i < 64; i++) + r21++; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r22" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r22\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(r22\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*reduction\\(\\+:r22\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(r22\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp for\[^\n\r]*reduction\\(\\+:r22\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r22\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + #pragma omp target teams loop reduction(+:r22) + for (int i = 0; i < 64; i++) + r22++; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r23" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r23\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r23\\)" "gimple" } } */ + #pragma omp target simd reduction(+:r23) + for (int i = 0; i < 64; i++) + r23++; + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*reduction\\(\\+:r24\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r24\\)" "gimple" } } */ + #pragma omp taskloop simd reduction(+:r24) + for (int i = 0; i < 64; i++) + r24++; + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:r25\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:r25\\)" "gimple" } } */ + #pragma omp teams distribute reduction(+:r25) + for (int i = 0; i < 64; i++) + r25++; + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:r26\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:r26\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:r26\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:r26\\)" "gimple" } } *//* FIXME. */ + #pragma omp teams distribute parallel for reduction(+:r26) + for (int i = 0; i < 64; i++) + r26++; + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:r27\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:r27\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:r27\\)" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:r27\\)" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r27\\)" "gimple" } } */ + #pragma omp teams distribute parallel for simd reduction(+:r27) + for (int i = 0; i < 64; i++) + r27++; + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:r28\\)" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:r28\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r28\\)" "gimple" } } */ + #pragma omp teams distribute simd reduction(+:r28) + for (int i = 0; i < 64; i++) + r28++; + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(r29\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*reduction\\(\\+:r29\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(r29\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp for\[^\n\r]*reduction\\(\\+:r29\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r29\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + #pragma omp teams loop reduction(+:r29) + for (int i = 0; i < 64; i++) + r29++; +} diff --git a/gcc/testsuite/c-c++-common/gomp/pr99928-9.c b/gcc/testsuite/c-c++-common/gomp/pr99928-9.c new file mode 100644 index 0000000..a766b72 --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr99928-9.c @@ -0,0 +1,219 @@ +/* PR middle-end/99928 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp -fdump-tree-gimple" } */ + +int r00[4], r01[4], r02[4], r03[4], r04[4], r05[4]; +int r13[4], r14[4], r15[4], r16[4], r17[4], r18[4], r19[4]; +int r20[4], r21[4], r22[4], r23[4], r24[4]; + +void +foo (void) +{ + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r00 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r00 \\+ 4" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r00 \\+ 4" "gimple" } } *//* FIXME. */ + #pragma omp distribute parallel for reduction(+:r00[1:2]) + for (int i = 0; i < 64; i++) + r00[1]++; + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r01 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r01 \\+ 4" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r01 \\+ 4" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r01 \\+ 4" "gimple" } } */ + #pragma omp distribute parallel for simd reduction(+:r01[1:2]) + for (int i = 0; i < 64; i++) + r01[1]++; + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r02 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r02 \\+ 4" "gimple" } } */ + #pragma omp distribute simd reduction(+:r02[1:2]) + for (int i = 0; i < 64; i++) + r02[1]++; +} + +void +bar (void) +{ + int r06[4] = {}, r07[4] = {}, r08[4] = {}, r09[4] = {}; + int r10[4] = {}, r11[4] = {}, r12[4] = {}; + int r25[4] = {}, r26[4] = {}, r27[4] = {}, r28[4] = {}, r29[4] = {}; + /* { dg-final { scan-tree-dump "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r03 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r03 \\+ 4" "gimple" } } */ + #pragma omp for simd reduction(+:r03[1:2]) + for (int i = 0; i < 64; i++) + r03[1]++; + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r04 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r04 \\+ 4" "gimple" } } */ + #pragma omp master taskloop reduction(+:r04[1:2]) + for (int i = 0; i < 64; i++) + r04[1]++; + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r05 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r05 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r05 \\+ 4" "gimple" } } */ + #pragma omp master taskloop simd reduction(+:r05[1:2]) + for (int i = 0; i < 64; i++) + r05[1]++; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r06 \\+ 4" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r06 \\+ 4" "gimple" } } *//* FIXME. */ + #pragma omp parallel for reduction(+:r06[1:2]) + for (int i = 0; i < 64; i++) + r06[1]++; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r07 \\+ 4" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r07 \\+ 4" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r07 \\+ 4" "gimple" } } */ + #pragma omp parallel for simd reduction(+:r07[1:2]) + for (int i = 0; i < 64; i++) + r07[1]++; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(r08\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r08 \\+ 4" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r08 \\+ 4" "gimple" } } *//* NOTE: This is implementation detail. */ + #pragma omp parallel loop reduction(+:r08[1:2]) + for (int i = 0; i < 64; i++) + r08[1]++; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r09 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r09 \\+ 4" "gimple" } } */ + #pragma omp parallel master reduction(+:r09[1:2]) + r09[1]++; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(r10\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r10 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r10 \\+ 4" "gimple" } } */ + #pragma omp parallel master taskloop reduction(+:r10[1:2]) + for (int i = 0; i < 64; i++) + r10[1]++; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(r11\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp master\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r11 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r11 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r11 \\+ 4" "gimple" } } */ + #pragma omp parallel master taskloop simd reduction(+:r11[1:2]) + for (int i = 0; i < 64; i++) + r11[1]++; + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r12 \\+ 4" "gimple" } } *//* FIXME: This should be on sections instead. */ + /* { dg-final { scan-tree-dump-not "omp sections\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r12 \\+ 4" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump-not "omp section \[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r12 \\+ 4" "gimple" } } */ + #pragma omp parallel sections reduction(+:r12[1:2]) + { + r12[1]++; + #pragma omp section + r12[1]++; + } + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r13\\\[1\\\] \\\[len: 8\\\]" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r13\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r13 \\+ 4" "gimple" } } */ + #pragma omp target parallel reduction(+:r13[1:2]) + r13[1]++; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r14\\\[1\\\] \\\[len: 8\\\]" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r14" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r14 \\+ 4" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r14 \\+ 4" "gimple" } } *//* FIXME. */ + #pragma omp target parallel for reduction(+:r14[1:2]) + for (int i = 0; i < 64; i++) + r14[1]++; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r15\\\[1\\\] \\\[len: 8\\\]" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r15\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r15 \\+ 4" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r15 \\+ 4" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r15 \\+ 4" "gimple" } } */ + #pragma omp target parallel for simd reduction(+:r15[1:2]) + for (int i = 0; i < 64; i++) + r15[1]++; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r16\\\[1\\\] \\\[len: 8\\\]" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r16\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(r16\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r16 \\+ 4" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r16 \\+ 4" "gimple" } } *//* NOTE: This is implementation detail. */ + #pragma omp target parallel loop reduction(+:r16[1:2]) + for (int i = 0; i < 64; i++) + r16[1]++; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r17\\\[1\\\] \\\[len: 8\\\]" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r17\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r17 \\+ 4" "gimple" } } */ + #pragma omp target teams reduction(+:r17[1:2]) + r17[1]++; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r18\\\[1\\\] \\\[len: 8\\\]" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r18\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r18 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r18 \\+ 4" "gimple" } } */ + #pragma omp target teams distribute reduction(+:r18[1:2]) + for (int i = 0; i < 64; i++) + r18[1]++; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r19\\\[1\\\] \\\[len: 8\\\]" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r19\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r19 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r19 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r19 \\+ 4" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r19 \\+ 4" "gimple" } } *//* FIXME. */ + #pragma omp target teams distribute parallel for reduction(+:r19[1:2]) + for (int i = 0; i < 64; i++) + r19[1]++; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r20\\\[1\\\] \\\[len: 8\\\]" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r20\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r20 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r20 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r20 \\+ 4" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r20 \\+ 4" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r20 \\+ 4" "gimple" } } */ + #pragma omp target teams distribute parallel for simd reduction(+:r20[1:2]) + for (int i = 0; i < 64; i++) + r20[1]++; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r21\\\[1\\\] \\\[len: 8\\\]" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r21\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r21 \\+ 4" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r21 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r21 \\+ 4" "gimple" } } */ + #pragma omp target teams distribute simd reduction(+:r21[1:2]) + for (int i = 0; i < 64; i++) + r21[1]++; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r22\\\[1\\\] \\\[len: 8\\\]" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r22\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(r22\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r22 \\+ 4" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(r22\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r22 \\+ 4" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r22 \\+ 4" "gimple" } } *//* NOTE: This is implementation detail. */ + #pragma omp target teams loop reduction(+:r22[1:2]) + for (int i = 0; i < 64; i++) + r22[1]++; + /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r23\\\[1\\\] \\\[len: 8\\\]" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r23\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r23 \\+ 4" "gimple" } } */ + #pragma omp target simd reduction(+:r23[1:2]) + for (int i = 0; i < 64; i++) + r23[1]++; + /* { dg-final { scan-tree-dump "omp taskloop\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r24 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r24 \\+ 4" "gimple" } } */ + #pragma omp taskloop simd reduction(+:r24[1:2]) + for (int i = 0; i < 64; i++) + r24[1]++; + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r25 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r25 \\+ 4" "gimple" } } */ + #pragma omp teams distribute reduction(+:r25[1:2]) + for (int i = 0; i < 64; i++) + r25[1]++; + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r26 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r26 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r26 \\+ 4" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r26 \\+ 4" "gimple" } } *//* FIXME. */ + #pragma omp teams distribute parallel for reduction(+:r26[1:2]) + for (int i = 0; i < 64; i++) + r26[1]++; + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r27 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r27 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r27 \\+ 4" "gimple" } } *//* FIXME: This should be on for instead. */ + /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r27 \\+ 4" "gimple" } } *//* FIXME. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r27 \\+ 4" "gimple" } } */ + #pragma omp teams distribute parallel for simd reduction(+:r27[1:2]) + for (int i = 0; i < 64; i++) + r27[1]++; + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r28 \\+ 4" "gimple" { xfail *-*-* } } } */ + /* { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r28 \\+ 4" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r28 \\+ 4" "gimple" } } */ + #pragma omp teams distribute simd reduction(+:r28[1:2]) + for (int i = 0; i < 64; i++) + r28[1]++; + /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(r29\\)" "gimple" } } */ + /* { dg-final { scan-tree-dump "omp distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r29 \\+ 4" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(r29\\)" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r29 \\+ 4" "gimple" } } *//* NOTE: This is implementation detail. */ + /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r29 \\+ 4" "gimple" } } *//* NOTE: This is implementation detail. */ + #pragma omp teams loop reduction(+:r29[1:2]) + for (int i = 0; i < 64; i++) + r29[1]++; +} -- cgit v1.1 From 957c437363f139313b2c0b2c93ca985df1d98ad2 Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Thu, 13 May 2021 10:38:09 -0600 Subject: PR c/100550 - ICE: in fold_convert_loc with function call VLA argument gcc/c/ChangeLog: PR c/100550 * c-decl.c (get_parm_array_spec): Avoid erroneous VLA bounds. gcc/testsuite/ChangeLog: PR c/100550 * gcc.dg/Wvla-parameter-9.c: New test. --- gcc/testsuite/gcc.dg/Wvla-parameter-9.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/Wvla-parameter-9.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/Wvla-parameter-9.c b/gcc/testsuite/gcc.dg/Wvla-parameter-9.c new file mode 100644 index 0000000..6c8987a --- /dev/null +++ b/gcc/testsuite/gcc.dg/Wvla-parameter-9.c @@ -0,0 +1,30 @@ +/* PR c/100550 - ICE: in fold_convert_loc with function call VLA argument + { dg-do compile } + { dg-options "-Wall" } */ + +struct S { int i; }; + +extern void v; +extern void *pv; +extern struct S s; +void vf (void); + +/* Verify that a function redeclaration with an invalid VLA doesn't ICE. */ + +void f0 (int[]); +void f0 (int[undeclared]); // { dg-error "undeclared" } + +void f1 (int[]); +void f1 (int[-1]); // { dg-error "size" } + +void f2 (int[]); +void f2 (int[v]); // { dg-error "size" } + +void f3 (int[]); +void f3 (int b[s]); // { dg-error "size" } + +void f4 (int[]); +void f4 (int c[pv]); // { dg-error "size" } + +void f5 (int[]); +void f5 (int d[vf ()]); // { dg-error "size" } -- cgit v1.1 From 9feb5822b713c6a12cb290ba0406ba2362d4c09c Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Thu, 13 May 2021 13:59:59 +0200 Subject: attributes: target_clone expects a string argument PR middle-end/100504 gcc/c-family/ChangeLog: * c-attribs.c (handle_target_clones_attribute): Expect a string argument to target_clone argument. gcc/testsuite/ChangeLog: * gcc.target/i386/pr100504.c: New test. --- gcc/testsuite/gcc.target/i386/pr100504.c | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr100504.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/i386/pr100504.c b/gcc/testsuite/gcc.target/i386/pr100504.c new file mode 100644 index 0000000..2910dfb --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr100504.c @@ -0,0 +1,7 @@ +/* PR middle-end/100504 */ +/* { dg-do compile } */ + +__attribute__((target_clones(0))) +foo() +{ /* { dg-error ".target_clones. attribute argument not a string constant" } */ +} -- cgit v1.1 From e554887df0934325464fd3e811022ee048328bb5 Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Thu, 13 May 2021 11:32:33 -0600 Subject: Fix compilation error in ILP32. gcc/testsuite/ChangeLog: * g++.dg/pr100574.C: Use size_t as operator new argument type. --- gcc/testsuite/g++.dg/pr100574.C | 64 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 gcc/testsuite/g++.dg/pr100574.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/pr100574.C b/gcc/testsuite/g++.dg/pr100574.C new file mode 100644 index 0000000..42ba040 --- /dev/null +++ b/gcc/testsuite/g++.dg/pr100574.C @@ -0,0 +1,64 @@ +/* PR middle-end/100574 - ICE: in size_remaining, at builtins.c:413 with + -O3 -ftracer -fno-tree-dominator-opts -fno-tree-fre + { dg-do compile { target c++11 } } + { dg-options "-O3 -ftracer -fno-tree-dominator-opts -fno-tree-fre" } */ + +void *operator new (__SIZE_TYPE__, void *__p) { return __p; } + +template struct allocator_traits; +template class allocator {}; +template struct allocator_traits > +{ + using allocator_type = allocator<_Tp>; + using pointer = _Tp *; + using size_type = long; + template using rebind_alloc = allocator<_Up>; + static pointer allocate(allocator_type, size_type); + template static void construct(_Up __p) { new (__p) _Up(); } +}; + +struct __alloc_traits : allocator_traits> { + struct rebind { + typedef rebind_alloc other; + }; +}; + +struct _Vector_base { + struct : __alloc_traits::rebind::other { + } _M_impl; + long _M_allocate___n; +}; + +template class vector : _Vector_base { + long max_size(); +public: + void push_back() { _M_realloc_insert(); } + template void _M_realloc_insert(); +}; + +template +template +void vector<_Tp, _Alloc>::_M_realloc_insert() { + __alloc_traits::pointer __trans_tmp_5; + long __len(__len || max_size()), __elems_before; + __trans_tmp_5 = _M_allocate___n + ? __alloc_traits::allocate(_M_impl, _M_allocate___n) + : __alloc_traits::pointer(); + __alloc_traits::construct(__trans_tmp_5 + __elems_before); +} + +enum { MIDIST_PITCHBEND }; +struct DataBlock { + vector data; +}; + +char ReadTrackChunk_status; + +void ReadTrackChunk() +{ + DataBlock block; + while (!0) + switch (ReadTrackChunk_status) + case MIDIST_PITCHBEND: + block.data.push_back(); +} -- cgit v1.1 From ca9bb74a5f856ccdceb4797f18b0a4ac8f49d069 Mon Sep 17 00:00:00 2001 From: Martin Jambor Date: Thu, 13 May 2021 23:26:32 +0200 Subject: tree-sra: Avoid refreshing into const base decls (PR 100453) When SRA transforms an assignment where the RHS is an aggregate decl that it creates replacements for, the (least efficient) fallback method of dealing with them is to store all the replacements back into the original decl and then let the original assignment takes itc sourse. That of course should not need to be done for TREE_READONLY bases which cannot change contents. The SRA code handled this situation in one of two necessary places but only for DECL_IN_CONSTANT_POOL const decls, this patch modifies both to check TREE_READONLY. gcc/ChangeLog: 2021-05-12 Martin Jambor PR tree-optimization/100453 * tree-sra.c (sra_modify_assign): All const base accesses do not need refreshing, not just those from decl_pool. (sra_modify_assign): Do not refresh into a const base decl. gcc/testsuite/ChangeLog: 2021-05-12 Martin Jambor PR tree-optimization/100453 * gcc.dg/tree-ssa/pr100453.c: New test. --- gcc/testsuite/gcc.dg/tree-ssa/pr100453.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr100453.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr100453.c b/gcc/testsuite/gcc.dg/tree-ssa/pr100453.c new file mode 100644 index 0000000..0cf0ad2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr100453.c @@ -0,0 +1,18 @@ +/* { dg-do run } */ +/* { dg-options "-O1" } */ + +struct a { + int b : 4; +} d; +static int c, e; +static const struct a f; +static void g(const struct a h) { + for (; c < 1; c++) + d = h; + e = h.b; + c = h.b; +} +int main() { + g(f); + return 0; +} -- cgit v1.1 From 2efe245bb88bf4574e322ef7e6d2df83d9e13237 Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Thu, 13 May 2021 16:05:50 -0600 Subject: Avoid -Wuninitialized false negatives with sanitization and VLAs. Resolves: PR tree-optimization/93100 - gcc -fsanitize=address inhibits -Wuninitialized PR middle-end/98583 - missing -Wuninitialized reading from a second VLA in its own block gcc/ChangeLog: PR tree-optimization/93100 PR middle-end/98583 * tree-ssa-uninit.c (check_defs): Exclude intrinsic functions that don't modify referenced objects. gcc/testsuite/ChangeLog: PR tree-optimization/93100 PR middle-end/98583 * g++.dg/warn/uninit-pr93100.C: New test. * gcc.dg/uninit-pr93100.c: New test. * gcc.dg/uninit-pr98583.c: New test. --- gcc/testsuite/g++.dg/warn/uninit-pr93100.C | 59 ++++++++++++++++++++++++ gcc/testsuite/gcc.dg/uninit-pr93100.c | 74 ++++++++++++++++++++++++++++++ gcc/testsuite/gcc.dg/uninit-pr98583.c | 31 +++++++++++++ 3 files changed, 164 insertions(+) create mode 100644 gcc/testsuite/g++.dg/warn/uninit-pr93100.C create mode 100644 gcc/testsuite/gcc.dg/uninit-pr93100.c create mode 100644 gcc/testsuite/gcc.dg/uninit-pr98583.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/warn/uninit-pr93100.C b/gcc/testsuite/g++.dg/warn/uninit-pr93100.C new file mode 100644 index 0000000..c9cd3ef --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/uninit-pr93100.C @@ -0,0 +1,59 @@ +/* PR tree-optimization/98508 - Sanitizer disable -Wall and -Wextra + { dg-do compile } + { dg-options "-O0 -Wall -fsanitize=address" } */ + +struct S +{ + int a; +}; + +void warn_init_self_O0 () +{ + S s = S (s); // { dg-warning "\\\[-Wuninitialized" } + (void)&s; +} + + +void warn_init_self_use_O0 () +{ + S s = S (s); // { dg-warning "\\\[-Wuninitialized" } + + void sink (void*); + sink (&s); +} + + +#pragma GCC optimize ("1") + +void warn_init_self_O1 () +{ + S s = S (s); // { dg-warning "\\\[-Wuninitialized" } + (void)&s; +} + + +void warn_init_self_use_O1 () +{ + S s = S (s); // { dg-warning "\\\[-Wuninitialized" } + + void sink (void*); + sink (&s); +} + + +#pragma GCC optimize ("2") + +void warn_init_self_O2 () +{ + S s = S (s); // { dg-warning "\\\[-Wuninitialized" } + (void)&s; +} + + +void warn_init_self_use_O2 () +{ + S s = S (s); // { dg-warning "\\\[-Wuninitialized" } + + void sink (void*); + sink (&s); +} diff --git a/gcc/testsuite/gcc.dg/uninit-pr93100.c b/gcc/testsuite/gcc.dg/uninit-pr93100.c new file mode 100644 index 0000000..61b7e43 --- /dev/null +++ b/gcc/testsuite/gcc.dg/uninit-pr93100.c @@ -0,0 +1,74 @@ +/* PR tree-optimization/93100 - gcc -fsanitize=address inhibits -Wuninitialized + { dg-do compile } + { dg-options "-Wall -fsanitize=address" } */ + +struct A +{ + _Bool b; + int i; +}; + +void warn_A_b_O0 (void) +{ + struct A a; + + if (a.b) // { dg-warning "\\\[-Wuninitialized" } + { + (void)&a; + } +} + +void warn_A_i_O0 (void) +{ + struct A a; + + if (a.i) // { dg-warning "\\\[-Wuninitialized" } + { + (void)&a; + } +} + +#pragma GCC optimize ("1") + +void warn_A_b_O1 (void) +{ + struct A a; + + if (a.b) // { dg-warning "\\\[-Wuninitialized" } + { + (void)&a; + } +} + +void warn_A_i_O1 (void) +{ + struct A a; + + if (a.i) // { dg-warning "\\\[-Wuninitialized" } + { + (void)&a; + } +} + + +#pragma GCC optimize ("2") + +void warn_A_b_O2 (void) +{ + struct A a; + + if (a.b) // { dg-warning "\\\[-Wuninitialized" } + { + (void)&a; + } +} + +void warn_A_i_O2 (void) +{ + struct A a; + + if (a.i) // { dg-warning "\\\[-Wuninitialized" } + { + (void)&a; + } +} diff --git a/gcc/testsuite/gcc.dg/uninit-pr98583.c b/gcc/testsuite/gcc.dg/uninit-pr98583.c new file mode 100644 index 0000000..638b029 --- /dev/null +++ b/gcc/testsuite/gcc.dg/uninit-pr98583.c @@ -0,0 +1,31 @@ +/* PR middle-end/98583 - missing -Wuninitialized reading from a second VLA + in its own block + { dg-do compile } + { dg-options "-O2 -Wall" } */ + +void f (int*); +void g (int); + +void h1 (int n) +{ + int a[n]; + f (a); + + int b[n]; + g (b[1]); // { dg-warning "\\\[-Wuninitialized" } +} + +void h2 (int n, int i, int j) +{ + if (i) + { + int a[n]; + f (a); + } + + if (j) + { + int b[n]; + g (b[1]); // { dg-warning "\\\[-Wmaybe-uninitialized" } + } +} -- cgit v1.1 From f9af11c7f156bede9aa28410073acbab7b0fa0fe Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 14 May 2021 00:16:30 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 93 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 82ef74c..9dfab7b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,96 @@ +2021-05-13 Martin Sebor + + PR tree-optimization/93100 + PR middle-end/98583 + * g++.dg/warn/uninit-pr93100.C: New test. + * gcc.dg/uninit-pr93100.c: New test. + * gcc.dg/uninit-pr98583.c: New test. + +2021-05-13 Martin Jambor + + PR tree-optimization/100453 + * gcc.dg/tree-ssa/pr100453.c: New test. + +2021-05-13 Martin Sebor + + * g++.dg/pr100574.C: Use size_t as operator new argument type. + +2021-05-13 Martin Liska + + PR middle-end/100504 + * gcc.target/i386/pr100504.c: New test. + +2021-05-13 Martin Sebor + + PR c/100550 + * gcc.dg/Wvla-parameter-9.c: New test. + +2021-05-13 Jakub Jelinek + + PR middle-end/99928 + * c-c++-common/gomp/pr99928-1.c: New test. + * c-c++-common/gomp/pr99928-2.c: New test. + * c-c++-common/gomp/pr99928-3.c: New test. + * c-c++-common/gomp/pr99928-4.c: New test. + * c-c++-common/gomp/pr99928-5.c: New test. + * c-c++-common/gomp/pr99928-6.c: New test. + * c-c++-common/gomp/pr99928-7.c: New test. + * c-c++-common/gomp/pr99928-8.c: New test. + * c-c++-common/gomp/pr99928-9.c: New test. + * c-c++-common/gomp/pr99928-10.c: New test. + * c-c++-common/gomp/pr99928-11.c: New test. + +2021-05-13 Richard Earnshaw + + PR target/100563 + * gcc.dg/pr100563.c (dg-options): Add -wno-pointer-to-int-cast. + +2021-05-13 Richard Earnshaw + + * gcc.dg/pr100563.c: New test. + +2021-05-13 Jakub Jelinek + + PR tree-optimization/98856 + * gcc.target/i386/sse2-psraq-1.c: New test. + * gcc.target/i386/sse4_2-psraq-1.c: New test. + * gcc.target/i386/avx-psraq-1.c: New test. + * gcc.target/i386/avx2-psraq-1.c: New test. + * gcc.target/i386/avx-pr82370.c: Adjust expected number of vpsrad + instructions. + * gcc.target/i386/avx2-pr82370.c: Likewise. + * gcc.target/i386/avx512f-pr82370.c: Likewise. + * gcc.target/i386/avx512bw-pr82370.c: Likewise. + * gcc.dg/torture/vshuf-4.inc: Add two further permutations. + * gcc.dg/torture/vshuf-8.inc: Likewise. + +2021-05-13 UroÅ¡ Bizjak + + PR target/100581 + * g++.target/i386/pr100581.C: New test. + +2021-05-13 Eric Botcazou + + PR testsuite/100569 + * gnat.dg/lto21.adb: Prune new LTO warning. + +2021-05-13 Martin Liska + + PR testsuite/100569 + * gcc.dg/atomic/c11-atomic-exec-2.c: Prune new LTO warning. + * gcc.dg/torture/pr94947-1.c: Likewise. + +2021-05-13 liuhongt + + * gcc.target/i386/avx-pr94680.c: Fix typo in testcase. + +2021-05-13 liuhongt + + PR target/94680 + * gcc.target/i386/avx-pr94680.c: New test. + * gcc.target/i386/avx512f-pr94680.c: New test. + * gcc.target/i386/sse2-pr94680.c: New test. + 2021-05-12 Martin Sebor PR middle-end/100571 -- cgit v1.1 From 149061188c7c6ddf27663c8c00b7574fc8d0fd23 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Thu, 29 Apr 2021 21:38:14 -0400 Subject: c++: Check attributes on friend declarations [PR99032] This patch implements [dcl.attr.grammar]/5: "If an attribute-specifier-seq appertains to a friend declaration ([class.friend]), that declaration shall be a definition." This restriction applies to C++11-style attributes as well as GNU attributes with the exception that we allow GNU attributes that require a type, such as vector_size to continue accepting code as in attrib63.C. There are various forms of friend declarations, we have friend templates, C++11 extended friend declarations, and so on. In some cases we already ignore the attribute and warn that it was ignored. But certain cases weren't diagnosed, and with this patch we'll give a hard error. I tried hard not to emit both a warning and error and I think it worked out. Jason provided the cp_parser_decl_specifier_seq hunk to detect using standard attributes in the middle of decl-specifiers, which is invalid. Co-authored-by: Jason Merrill gcc/cp/ChangeLog: PR c++/99032 * cp-tree.h (any_non_type_attribute_p): Declare. * decl.c (grokdeclarator): Diagnose when an attribute appertains to a friend declaration that is not a definition. * decl2.c (any_non_type_attribute_p): New. * parser.c (cp_parser_decl_specifier_seq): Diagnose standard attributes in the middle of decl-specifiers. (cp_parser_elaborated_type_specifier): Diagnose when an attribute appertains to a friend declaration that is not a definition. (cp_parser_member_declaration): Likewise. gcc/testsuite/ChangeLog: PR c++/99032 * g++.dg/cpp0x/friend7.C: New test. * g++.dg/cpp0x/gen-attrs-4.C: Add dg-error. * g++.dg/cpp0x/gen-attrs-39-1.C: Likewise. * g++.dg/cpp0x/gen-attrs-74.C: New test. * g++.dg/ext/attrib63.C: New test. --- gcc/testsuite/g++.dg/cpp0x/friend7.C | 40 +++++++++++++++++++++++++++++ gcc/testsuite/g++.dg/cpp0x/gen-attrs-39-1.C | 3 ++- gcc/testsuite/g++.dg/cpp0x/gen-attrs-4.C | 3 ++- gcc/testsuite/g++.dg/cpp0x/gen-attrs-74.C | 10 ++++++++ gcc/testsuite/g++.dg/ext/attrib63.C | 16 ++++++++++++ 5 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/friend7.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/gen-attrs-74.C create mode 100644 gcc/testsuite/g++.dg/ext/attrib63.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp0x/friend7.C b/gcc/testsuite/g++.dg/cpp0x/friend7.C new file mode 100644 index 0000000..734b367 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/friend7.C @@ -0,0 +1,40 @@ +// PR c++/99032 +// { dg-do compile { target c++11 } } + +class X { }; +template +void foo (T1, T2); + +struct S { + [[deprecated]] friend void f(); // { dg-error "attribute appertains" } + [[deprecated]] friend void f2() { } + __attribute__((deprecated)) friend void f3(); // { dg-error "attribute appertains" } + friend void f3 [[deprecated]] (); // { dg-error "attribute appertains" } + friend void f4 [[deprecated]] () { } + [[deprecated]] friend void; // { dg-error "attribute appertains" } + __attribute__((deprecated)) friend int; // { dg-error "attribute appertains" } + friend __attribute__((deprecated)) int; // { dg-error "attribute appertains" } + friend int __attribute__((deprecated)); // { dg-error "attribute appertains" } + [[deprecated]] friend X; // { dg-error "attribute appertains" } + [[deprecated]] friend class N; // { dg-warning "attribute ignored" } + friend class [[deprecated]] N2; // { dg-error "attribute appertains" } + friend class __attribute__((deprecated)) N3; // { dg-error "attribute appertains" } + [[deprecated]] friend void foo<>(int, int); // { dg-error "attribute appertains" } + [[deprecated]] friend void ::foo(int, int); // { dg-error "attribute appertains" } + // { dg-bogus "should have" "PR100339" { xfail *-*-* } .-1 } +}; + +template +class node { }; + +template +struct A { + [[deprecated]] friend T; // { dg-error "attribute appertains" } + [[deprecated]] friend class node; // { dg-warning "attribute ignored" } + template + [[deprecated]] friend class A; // { dg-warning "attribute ignored" } + template + [[deprecated]] friend void bar () { } + template + [[deprecated]] friend void baz (); // { dg-error "attribute appertains" } +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-39-1.C b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-39-1.C index 453fc01..4010ba7 100644 --- a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-39-1.C +++ b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-39-1.C @@ -2,7 +2,8 @@ int fragile_block(void) { typedef - [[gnu::aligned (16)]] // { dg-warning "ignored" } + [[gnu::aligned (16)]] // { dg-error "standard attributes in middle of decl-specifiers" } +// { dg-warning "attribute ignored" "" { target *-*-* } .-1 } struct { int i; } XmmUint16; diff --git a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-4.C b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-4.C index b401c69..c120aed 100644 --- a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-4.C +++ b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-4.C @@ -13,7 +13,8 @@ int one_third [[noreturn]] [[gnu::unused]] (void); int [[gnu::unused]] one_half(); // { dg-warning "ignored" } static -[[noreturn]] // { dg-warning "ignored" } +[[noreturn]] // { dg-error "standard attributes in middle of decl-specifiers" } +// { dg-warning "attribute ignored" "" { target *-*-* } .-1 } void two [[gnu::unused]] (void) {} diff --git a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-74.C b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-74.C new file mode 100644 index 0000000..7e17bc8 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-74.C @@ -0,0 +1,10 @@ +// { dg-do compile { target c++11 } } +// A C++11 attribute cannot appear in the middle of the decl-specifier-seq, +// only before it (in which case it appertains to the declaration) or at +// the end (in which case it appertains to the type). + +struct S { + friend [[deprecated]] void; // { dg-error "standard attributes in middle of decl-specifiers" } + friend [[deprecated]] int fn(); // { dg-error "standard attributes in middle of decl-specifiers" } + // { dg-warning "attribute ignored" "" { target *-*-* } .-1 } +}; diff --git a/gcc/testsuite/g++.dg/ext/attrib63.C b/gcc/testsuite/g++.dg/ext/attrib63.C new file mode 100644 index 0000000..e515a2b --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/attrib63.C @@ -0,0 +1,16 @@ +// { dg-do compile } + +#define vector __attribute__((vector_size(16))) +class A { + friend vector float f(); + __attribute__((deprecated)) friend void f2(); // { dg-error "attribute appertains" } + friend __attribute__((deprecated, vector_size(16))) float f3(); // { dg-error "attribute appertains" } + friend __attribute__((vector_size(16), deprecated)) float f4(); // { dg-error "attribute appertains" } +}; + +vector float vf; +vector float +f () +{ + return vf; +} -- cgit v1.1 From 80b4ce1a5190ebe764b1009afae57dcef45f92c2 Mon Sep 17 00:00:00 2001 From: Michael de Lang Date: Fri, 14 May 2021 12:09:45 +0200 Subject: TSAN: add new test gcc/testsuite/ChangeLog: * g++.dg/tsan/pthread_cond_clockwait.C: New test. --- gcc/testsuite/g++.dg/tsan/pthread_cond_clockwait.C | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 gcc/testsuite/g++.dg/tsan/pthread_cond_clockwait.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/tsan/pthread_cond_clockwait.C b/gcc/testsuite/g++.dg/tsan/pthread_cond_clockwait.C new file mode 100644 index 0000000..82d6a5c --- /dev/null +++ b/gcc/testsuite/g++.dg/tsan/pthread_cond_clockwait.C @@ -0,0 +1,31 @@ +// Test pthread_cond_clockwait not generating false positives with tsan +// { dg-do run { target { { *-*-linux* *-*-gnu* *-*-uclinux* } && pthread } } } +// { dg-options "-fsanitize=thread -lpthread" } + +#include + +pthread_cond_t cv; +pthread_mutex_t mtx; + +void *fn(void *vp) { + pthread_mutex_lock(&mtx); + pthread_cond_signal(&cv); + pthread_mutex_unlock(&mtx); + return NULL; +} + +int main() { + pthread_mutex_lock(&mtx); + + pthread_t tid; + pthread_create(&tid, NULL, fn, NULL); + + struct timespec ts; + clock_gettime(CLOCK_MONOTONIC, &ts); + ts.tv_sec += 10; + pthread_cond_clockwait(&cv, &mtx, CLOCK_MONOTONIC, &ts); + pthread_mutex_unlock(&mtx); + + pthread_join(tid, NULL); + return 0; +} -- cgit v1.1 From f05627d404038368b99e92ac4df4c29f4ae4a5fa Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 14 May 2021 13:24:12 +0200 Subject: testsuite: Add testcase for already fixed PR [PR88872] 2021-05-14 Jakub Jelinek * g++.dg/cpp1y/pr88872.C: New test. --- gcc/testsuite/g++.dg/cpp1y/pr88872.C | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1y/pr88872.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp1y/pr88872.C b/gcc/testsuite/g++.dg/cpp1y/pr88872.C new file mode 100644 index 0000000..3719e39 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/pr88872.C @@ -0,0 +1,24 @@ +// PR c++/88872 +// { dg-do compile { target c++14 } } + +struct a { + template constexpr a(b) : c() {} + int c; +}; +void d(); +template constexpr a operator"" _n() { return d; } +struct e; +struct f { + e operator[](int); +}; +struct g { + void h(); + f i; +}; +template struct j { + void k() { [](auto) { constexpr auto l = 2_n; }(keywords); } + int keywords; +}; +using m = j; +class e : public m {}; +void g::h() { i[0].k(); } -- cgit v1.1 From d25809dbfe43917b3bed9454620fcc24f04c1e03 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 14 May 2021 14:56:28 +0200 Subject: testsuite: Add testcase for already fixed PR [PR90019] 2021-05-14 Jakub Jelinek PR c++/90019 * g++.dg/cpp0x/sfinae68.C: New test. --- gcc/testsuite/g++.dg/cpp0x/sfinae68.C | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/sfinae68.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp0x/sfinae68.C b/gcc/testsuite/g++.dg/cpp0x/sfinae68.C new file mode 100644 index 0000000..d292b68 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/sfinae68.C @@ -0,0 +1,23 @@ +// PR c++/90019 +// { dg-do compile { target c++11 } } + +template +struct enable_if { }; +template +struct enable_if { typedef T type; }; +template +using __enable_if_t = typename enable_if::type; +template +using enable_if_t = typename enable_if::type; + +template ...> void foo() {} +template ...> void foo() {} +template ...> void bar() {} +template ...> void bar() {} + +void test() +{ + bar<0>(); + bar<0,0>(); + foo<0>(); +} -- cgit v1.1 From 3cafe627d6c8bce7e7f46bdbdef3d14e9701ce9d Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 14 May 2021 15:34:12 +0200 Subject: testsuite: Add testcase for already fixed PR [PR94616] 2021-05-14 Jakub Jelinek PR c++/94616 * g++.dg/cpp0x/pr94616.C: New test. --- gcc/testsuite/g++.dg/cpp0x/pr94616.C | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr94616.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp0x/pr94616.C b/gcc/testsuite/g++.dg/cpp0x/pr94616.C new file mode 100644 index 0000000..a8fe700 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr94616.C @@ -0,0 +1,23 @@ +// PR c++/94616 +// { dg-do compile { target c++11 } } + +struct Bar { + Bar(int n) { if (n > 0) throw 2; } + ~Bar() {} +}; + +struct Foo { + Bar b1 = 0; + Bar b2 = 1; + Foo() {} + ~Foo() {} +}; + +int +main() +{ + try { + Foo f; + } catch(int) { + } +} -- cgit v1.1 From 4206171605de65df9674a14dd9db75bf4f4ed037 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 14 May 2021 16:29:49 +0200 Subject: testsuite: Add testcase for already fixed PR [PR95226] 2021-05-14 Jakub Jelinek PR c++/95226 * g++.dg/cpp1y/pr95226.C: New test. --- gcc/testsuite/g++.dg/cpp1y/pr95226.C | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1y/pr95226.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp1y/pr95226.C b/gcc/testsuite/g++.dg/cpp1y/pr95226.C new file mode 100644 index 0000000..614c83c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/pr95226.C @@ -0,0 +1,17 @@ +// PR c++/95226 +// { dg-do run { target c++14 } } + +#include + +struct T { + unsigned a; + float b {8.}; +}; + +int main() +{ + T t = {1}; + std::vector tt = {{1}, {2}}; + if (t.a != 1 || t.b != 8.0f || tt[0].a != 1 || tt[0].b != 8.0f || tt[1].a != 2 || tt[1].b != 8.0f) + __builtin_abort (); +} -- cgit v1.1 From 62e1bd651f60cfe3daaad91b41b7612bc7fa7460 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Fri, 14 May 2021 19:19:26 +0200 Subject: Fortran/OpenMP: Handle implicit SAVE for variables in main gcc/fortran/ChangeLog: * resolve.c (resolve_symbol): Handle implicit SAVE of main-program for vars in 'omp threadprivate' and 'omp declare target'. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/implicit-save.f90: New test. --- gcc/testsuite/gfortran.dg/gomp/implicit-save.f90 | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/gomp/implicit-save.f90 (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gfortran.dg/gomp/implicit-save.f90 b/gcc/testsuite/gfortran.dg/gomp/implicit-save.f90 new file mode 100644 index 0000000..2af9647 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/implicit-save.f90 @@ -0,0 +1,11 @@ +subroutine foo + integer :: n = 5, m = 7 + !$omp declare target to(n) + !$omp threadprivate (m) +end + +program main + integer :: i, j + !$omp declare target to(i) + !$omp threadprivate (j) +end -- cgit v1.1 From 0e3702f8daeec5897982d185650b78a5c1c53c25 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Fri, 14 May 2021 19:21:47 +0200 Subject: Fortran/OpenMP: Support 'omp parallel master' gcc/fortran/ChangeLog: * dump-parse-tree.c (show_omp_node, show_code_node): Handle EXEC_OMP_PARALLEL_MASTER. * frontend-passes.c (gfc_code_walker): Likewise. * gfortran.h (enum gfc_statement): Add ST_OMP_PARALLEL_MASTER and ST_OMP_END_PARALLEL_MASTER. (enum gfc_exec_op): Add EXEC_OMP_PARALLEL_MASTER.. * match.h (gfc_match_omp_parallel_master): Handle it. * openmp.c (gfc_match_omp_parallel_master, resolve_omp_clauses, omp_code_to_statement, gfc_resolve_omp_directive): Likewise. * parse.c (decode_omp_directive, case_exec_markers, gfc_ascii_statement, parse_omp_structured_block, parse_executable): Likewise. * resolve.c (gfc_resolve_blocks, gfc_resolve_code): Likewise. * st.c (gfc_free_statement): Likewise. * trans-openmp.c (gfc_trans_omp_parallel_master, gfc_trans_omp_workshare, gfc_trans_omp_directive): Likewise. * trans.c (trans_code): Likewise. libgomp/ChangeLog: * testsuite/libgomp.fortran/parallel-master.f90: New test. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/parallel-master-1.f90: New test. * gfortran.dg/gomp/parallel-master-2.f90: New test. --- .../gfortran.dg/gomp/parallel-master-1.f90 | 23 ++++++++++++++++++++++ .../gfortran.dg/gomp/parallel-master-2.f90 | 9 +++++++++ 2 files changed, 32 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/gomp/parallel-master-1.f90 create mode 100644 gcc/testsuite/gfortran.dg/gomp/parallel-master-2.f90 (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gfortran.dg/gomp/parallel-master-1.f90 b/gcc/testsuite/gfortran.dg/gomp/parallel-master-1.f90 new file mode 100644 index 0000000..2ccc18f --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/parallel-master-1.f90 @@ -0,0 +1,23 @@ +! { dg-additional-options "-fdump-tree-original" } + implicit none + integer :: k, p, s, r, nth, t, f + logical(kind=2) l2 + !$omp threadprivate (t) + + external bar + !$omp parallel master default(none) private (k) + call bar (k) + !$omp end parallel master + + !$omp parallel master private (p) firstprivate (f) if (parallel: l2) default(shared) & + !$omp& shared(s) reduction(+:r) num_threads (nth) proc_bind(spread) copyin(t) + ! + !$omp end parallel master +end + +! { dg-final { scan-tree-dump "omp parallel private\\(k\\) default\\(none\\)" "original" } } +! { dg-final { scan-tree-dump-times "#pragma omp master" 1 "original" } } +! { dg-final { scan-tree-dump "D.\[0-9\]+ = l2;" "original" } } +! { dg-final { scan-tree-dump "D.\[0-9\]+ = nth;" "original" } } +! { dg-final { scan-tree-dump "#pragma omp parallel private\\(p\\) firstprivate\\(f\\) shared\\(s\\) copyin\\(t\\) reduction\\(\\+:r\\) if\\(parallel:D.\[0-9\]+\\) num_threads\\(D.\[0-9\]+\\) default\\(shared\\) proc_bind\\(spread\\)" "original" } } + diff --git a/gcc/testsuite/gfortran.dg/gomp/parallel-master-2.f90 b/gcc/testsuite/gfortran.dg/gomp/parallel-master-2.f90 new file mode 100644 index 0000000..2e12de6 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/parallel-master-2.f90 @@ -0,0 +1,9 @@ + use iso_c_binding, only: c_intptr_t + implicit none (external, type) + integer, parameter :: omp_event_handle_kind = c_intptr_t + integer (kind=omp_event_handle_kind) :: x + !$omp parallel master default (none) ! { dg-message "enclosing 'parallel'" } + !$omp task detach (x) ! { dg-error "'x' not specified in enclosing 'parallel'" } + !$omp end task + !$omp end parallel master +end -- cgit v1.1 From 87a7d10c2e9ec34a276e6acb5d2282a35b9cfafb Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 15 May 2021 00:16:27 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9dfab7b..5647950 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,45 @@ +2021-05-14 Tobias Burnus + + * gfortran.dg/gomp/parallel-master-1.f90: New test. + * gfortran.dg/gomp/parallel-master-2.f90: New test. + +2021-05-14 Tobias Burnus + + * gfortran.dg/gomp/implicit-save.f90: New test. + +2021-05-14 Jakub Jelinek + + PR c++/95226 + * g++.dg/cpp1y/pr95226.C: New test. + +2021-05-14 Jakub Jelinek + + PR c++/94616 + * g++.dg/cpp0x/pr94616.C: New test. + +2021-05-14 Jakub Jelinek + + PR c++/90019 + * g++.dg/cpp0x/sfinae68.C: New test. + +2021-05-14 Jakub Jelinek + + * g++.dg/cpp1y/pr88872.C: New test. + +2021-05-14 Michael de Lang + + * g++.dg/tsan/pthread_cond_clockwait.C: New test. + +2021-05-14 Marek Polacek + Jason Merrill + + PR c++/99032 + * g++.dg/cpp0x/friend7.C: New test. + * g++.dg/cpp0x/gen-attrs-4.C: Add dg-error. + * g++.dg/cpp0x/gen-attrs-39-1.C: Likewise. + * g++.dg/cpp0x/gen-attrs-74.C: New test. + * g++.dg/ext/attrib63.C: New test. + 2021-05-13 Martin Sebor PR tree-optimization/93100 -- cgit v1.1 From 425ad87dcfacbb326d8f448a0f2b4d6b53dcd98f Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Sat, 15 May 2021 10:12:11 +0200 Subject: regcprop: Fix another cprop_hardreg bug [PR100342] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Tue, Jan 19, 2021 at 04:10:33PM +0000, Richard Sandiford via Gcc-patches wrote: > Ah, ok, thanks for the extra context. > > So AIUI the problem when recording xmm2<-di isn't just: > > [A] partial_subreg_p (vd->e[sr].mode, GET_MODE (src)) > > but also that: > > [B] partial_subreg_p (vd->e[sr].mode, vd->e[vd->e[sr].oldest_regno].mode) > > For example, all registers in this sequence can be part of the same chain: > > (set (reg:HI R1) (reg:HI R0)) > (set (reg:SI R2) (reg:SI R1)) // [A] > (set (reg:DI R3) (reg:DI R2)) // [A] > (set (reg:SI R4) (reg:SI R[0-3])) > (set (reg:HI R5) (reg:HI R[0-4])) > > But: > > (set (reg:SI R1) (reg:SI R0)) > (set (reg:HI R2) (reg:HI R1)) > (set (reg:SI R3) (reg:SI R2)) // [A] && [B] > > is problematic because it dips below the precision of the oldest regno > and then increases again. > > When this happens, I guess we have two choices: > > (1) what the patch does: treat R3 as the start of a new chain. > (2) pretend that the copy occured in vd->e[sr].mode instead > (i.e. copy vd->e[sr].mode to vd->e[dr].mode) > > I guess (2) would need to be subject to REG_CAN_CHANGE_MODE_P. > Maybe the optimisation provided by (2) compared to (1) isn't common > enough to be worth the complication. > > I think we should test [B] as well as [A] though. The pass is set > up to do some quite elaborate mode changes and I think rejecting > [A] on its own would make some of the other code redundant. > It also feels like it should be a seperate “if†or “else ifâ€, > with its own comment. Unfortunately, we now have a testcase that shows that testing also [B] is a problem (unfortunately now latent on the trunk, only reproduces on 10 and 11 branches). The comment in the patch tries to list just the interesting instructions, we have a 64-bit value, copy low 8 bit of those to another register, copy full 64 bits to another register and then clobber the original register. Before that (set (reg:DI r14) (const_int ...)) we have a chain DI r14, QI si, DI bp , that instruction drops the DI r14 from that chain, so we have QI si, DI bp , si being the oldest_regno. Next DI si is copied into DI dx. Only the low 8 bits of that are defined, the rest is unspecified, but we would add DI dx into that same chain at the end, so QI si, DI bp, DI dx [*]. Next si is overwritten, so the chain is DI bp, DI dx. And then we see (set (reg:DI dx) (reg:DI bp)) and remove it as redundant, because we think bp and dx are already equivalent, when in reality that is true only for the lowpart 8 bits. I believe the [*] marked step above is where the bug is. The committed regcprop.c (copy_value) change (but only committed to trunk/11, not to 10) added else if (partial_subreg_p (vd->e[sr].mode, GET_MODE (src)) && partial_subreg_p (vd->e[sr].mode, vd->e[vd->e[sr].oldest_regno].mode)) return; and while the first partial_subreg_p call returns true, the second one doesn't; before the (set (reg:DI r14) (const_int ...)) insn it would be true and we'd return, but as that reg got clobbered, si became the oldest regno in the chain and so vd->e[vd->e[sr].oldest_regno].mode is QImode and vd->e[sr].mode is QImode too, so the second partial_subreg_p is false. But as the testcase shows, what is the oldest_regno in the chain is something that changes over time, so relying on it for anything is problematic, something could have a different oldest_regno and later on get a different oldest_regno (perhaps with different mode) because the oldest_regno got overwritten and it can change both ways. The following patch effectively implements your (2) above. 2021-05-15 Jakub Jelinek PR rtl-optimization/100342 * regcprop.c (copy_value): When copying a source reg in a wider mode than it has recorded for the value, adjust recorded destination mode too or punt if !REG_CAN_CHANGE_MODE_P. * gcc.target/i386/pr100342.c: New test. --- gcc/testsuite/gcc.target/i386/pr100342.c | 70 ++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr100342.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/i386/pr100342.c b/gcc/testsuite/gcc.target/i386/pr100342.c new file mode 100644 index 0000000..8e2ec82 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr100342.c @@ -0,0 +1,70 @@ +/* PR rtl-optimization/100342 */ +/* { dg-do run { target int128 } } */ +/* { dg-options "-O2 -fno-dse -fno-forward-propagate -Wno-psabi -mno-sse2" } */ + +#define SHL(x, y) ((x) << ((y) & (sizeof(x) * 8 - 1))) +#define SHR(x, y) ((x) >> ((y) & (sizeof(x) * 8 - 1))) +#define ROR(x, y) (SHR(x, y)) | (SHL(x, (sizeof(x) * 8 - (y)))) +#define SHLV(x, y) ((x) << ((y) & (sizeof((x)[0]) * 8 - 1))) +#define SHLSV(x, y) ((x) << ((y) & (sizeof((y)[0]) * 8 - 1))) +typedef unsigned char A; +typedef unsigned char __attribute__((__vector_size__ (8))) B; +typedef unsigned char __attribute__((__vector_size__ (16))) C; +typedef unsigned char __attribute__((__vector_size__ (32))) D; +typedef unsigned char __attribute__((__vector_size__ (64))) E; +typedef unsigned short F; +typedef unsigned short __attribute__((__vector_size__ (16))) G; +typedef unsigned int H; +typedef unsigned int __attribute__((__vector_size__ (32))) I; +typedef unsigned long long J; +typedef unsigned long long __attribute__((__vector_size__ (8))) K; +typedef unsigned long long __attribute__((__vector_size__ (32))) L; +typedef unsigned long long __attribute__((__vector_size__ (64))) M; +typedef unsigned __int128 N; +typedef unsigned __int128 __attribute__((__vector_size__ (16))) O; +typedef unsigned __int128 __attribute__((__vector_size__ (32))) P; +typedef unsigned __int128 __attribute__((__vector_size__ (64))) Q; +B v1; +D v2; +L v3; +K v4; +I v5; +O v6; + +B +foo (A a, C b, E c, F d, G e, H f, J g, M h, N i, P j, Q k) +{ + b &= (A) f; + k += a; + G l = e; + D m = v2 >= (A) (J) v1; + J r = a + g; + L n = v3 <= f; + k -= i / f; + l -= (A) g; + c |= (A) d; + b -= (A) i; + J o = ROR (__builtin_clz (r), a); + K p = v4 | f, q = v4 <= f; + P s = SHLV (SHLSV (__builtin_bswap64 (i), (P) (0 < j)) <= 0, j); + n += a <= r; + M t = (M) (a / SHLV (c, 0)) != __builtin_bswap64 (i); + I u = f - v5; + E v = (E) h + (E) t + (E) k; + D w = (union { D b[2]; }) { }.b[0] + ((union { E b; }) v).b[1] + m + (D) u + (D) n + (D) s; + C x = ((union { D b; }) w).b[1] + b + (C) l + (C) v6; + B y = ((union { C a; B b; }) x).b + ((union { C a; B b[2]; }) x).b[1] + (B) p + (B) q; + J z = i + o; + F z2 = z; + A z3 = z2; + return y + z3; +} + +int +main () +{ + B x = foo (0, (C) { }, (E) { }, 10, (G) { }, 4, 2, (M) { }, 123842323652213865LL, (P) { 1 }, (Q) { }); + if ((J) x != 0x2e2c2e2c2e2c2e30ULL) + __builtin_abort(); + return 0; +} -- cgit v1.1 From af42043e6618e69187b47f37dac870763c01e20f Mon Sep 17 00:00:00 2001 From: Martin Jambor Date: Sat, 15 May 2021 10:11:12 +0200 Subject: Revert "tree-sra: Avoid refreshing into const base decls (PR 100453)" This reverts commit ca9bb74a5f856ccdceb4797f18b0a4ac8f49d069. ...because of Ada issues I did not catch with original testing. gcc/ChangeLog: 2021-05-12 Martin Jambor Revert: PR tree-optimization/100453 * tree-sra.c (sra_modify_assign): All const base accesses do not need refreshing, not just those from decl_pool. (sra_modify_assign): Do not refresh into a const base decl. gcc/testsuite/ChangeLog: 2021-05-12 Martin Jambor Revert: PR tree-optimization/100453 * gcc.dg/tree-ssa/pr100453.c: New test. --- gcc/testsuite/gcc.dg/tree-ssa/pr100453.c | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr100453.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr100453.c b/gcc/testsuite/gcc.dg/tree-ssa/pr100453.c deleted file mode 100644 index 0cf0ad2..0000000 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr100453.c +++ /dev/null @@ -1,18 +0,0 @@ -/* { dg-do run } */ -/* { dg-options "-O1" } */ - -struct a { - int b : 4; -} d; -static int c, e; -static const struct a f; -static void g(const struct a h) { - for (; c < 1; c++) - d = h; - e = h.b; - c = h.b; -} -int main() { - g(f); - return 0; -} -- cgit v1.1 From 5bd66c6826e5f3a38ba393702923feb88959f845 Mon Sep 17 00:00:00 2001 From: Bill Schmidt Date: Thu, 13 May 2021 13:33:35 -0500 Subject: rs6000: Add ROP tests 2021-05-13 Bill Schmidt gcc/testsuite/ * gcc.target/powerpc/rop-1.c: New. * gcc.target/powerpc/rop-2.c: New. * gcc.target/powerpc/rop-3.c: New. * gcc.target/powerpc/rop-4.c: New. * gcc.target/powerpc/rop-5.c: New. --- gcc/testsuite/gcc.target/powerpc/rop-1.c | 17 +++++++++++++++++ gcc/testsuite/gcc.target/powerpc/rop-2.c | 17 +++++++++++++++++ gcc/testsuite/gcc.target/powerpc/rop-3.c | 18 ++++++++++++++++++ gcc/testsuite/gcc.target/powerpc/rop-4.c | 15 +++++++++++++++ gcc/testsuite/gcc.target/powerpc/rop-5.c | 13 +++++++++++++ 5 files changed, 80 insertions(+) create mode 100644 gcc/testsuite/gcc.target/powerpc/rop-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/rop-2.c create mode 100644 gcc/testsuite/gcc.target/powerpc/rop-3.c create mode 100644 gcc/testsuite/gcc.target/powerpc/rop-4.c create mode 100644 gcc/testsuite/gcc.target/powerpc/rop-5.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/powerpc/rop-1.c b/gcc/testsuite/gcc.target/powerpc/rop-1.c new file mode 100644 index 0000000..8cedcb6 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/rop-1.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mdejagnu-cpu=power10 -mrop-protect" } */ +/* { dg-require-effective-target powerpc_elfv2 } */ + +/* Verify that ROP-protect instructions are inserted when a + call is present. */ + +extern void foo (void); + +int bar () +{ + foo (); + return 5; +} + +/* { dg-final { scan-assembler-times {\mhashst\M} 1 } } */ +/* { dg-final { scan-assembler-times {\mhashchk\M} 1 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/rop-2.c b/gcc/testsuite/gcc.target/powerpc/rop-2.c new file mode 100644 index 0000000..c556952 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/rop-2.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mdejagnu-cpu=power10 -mrop-protect -mprivileged" } */ +/* { dg-require-effective-target powerpc_elfv2 } */ + +/* Verify that privileged ROP-protect instructions are inserted when a + call is present. */ + +extern void foo (void); + +int bar () +{ + foo (); + return 5; +} + +/* { dg-final { scan-assembler-times {\mhashstp\M} 1 } } */ +/* { dg-final { scan-assembler-times {\mhashchkp\M} 1 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/rop-3.c b/gcc/testsuite/gcc.target/powerpc/rop-3.c new file mode 100644 index 0000000..8d03792 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/rop-3.c @@ -0,0 +1,18 @@ +/* { dg-do run { target { power10_hw } } } */ +/* { dg-require-effective-target powerpc_elfv2 } */ +/* { dg-options "-O2 -mdejagnu-cpu=power10 -mrop-protect" } */ + +/* Verify that ROP-protect instructions execute correctly when a + call is present. */ + +void __attribute__((noipa)) foo () +{ + asm (""); +} + +int main () +{ + foo (); + return 0; +} + diff --git a/gcc/testsuite/gcc.target/powerpc/rop-4.c b/gcc/testsuite/gcc.target/powerpc/rop-4.c new file mode 100644 index 0000000..dcf47c6 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/rop-4.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mdejagnu-cpu=power10 -mrop-protect" } */ +/* { dg-require-effective-target powerpc_elfv2 } */ + +/* Verify that no ROP-protect instructions are inserted when no + call is present. */ + + +int bar () +{ + return 5; +} + +/* { dg-final { scan-assembler-not {\mhashst\M} } } */ +/* { dg-final { scan-assembler-not {\mhashchk\M} } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/rop-5.c b/gcc/testsuite/gcc.target/powerpc/rop-5.c new file mode 100644 index 0000000..cf04ea9 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/rop-5.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mdejagnu-cpu=power10 -mrop-protect" } */ + +/* Verify that __ROP_PROTECT__ is predefined for -mrop-protect. */ + +int foo () +{ +#ifndef __ROP_PROTECT__ + __ROP_PROTECT__ macro is not defined when it should be +#endif + return 0; +} + -- cgit v1.1 From 1ba3f0ef546ec83fe28fef7f34e0ee9e52c6477f Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sun, 16 May 2021 00:16:37 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5647950..26b04e7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,24 @@ +2021-05-15 Bill Schmidt + + * gcc.target/powerpc/rop-1.c: New. + * gcc.target/powerpc/rop-2.c: New. + * gcc.target/powerpc/rop-3.c: New. + * gcc.target/powerpc/rop-4.c: New. + * gcc.target/powerpc/rop-5.c: New. + +2021-05-15 Martin Jambor + + Revert: + 2021-05-15 Martin Jambor + + PR tree-optimization/100453 + * gcc.dg/tree-ssa/pr100453.c: New test. + +2021-05-15 Jakub Jelinek + + PR rtl-optimization/100342 + * gcc.target/i386/pr100342.c: New test. + 2021-05-14 Tobias Burnus * gfortran.dg/gomp/parallel-master-1.f90: New test. -- cgit v1.1 From f1146b50e8af87dc9da25cf6d8633e91dac07e1a Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Sun, 16 May 2021 13:46:06 +0000 Subject: testsuite/arm: Improve unsigned-float.c The test requires an FPU, so use -march=armv7-a+fp -mfpu=auto instead of -march=armv7-a. We also remove dg-require-effective-target arm_fp_ok, but keep dg-add-options arm_fp: this enables the test to pass on arm-eabi configured with default cpu/fpu/mode. dg-require-effective-target arm_fp_ok fails on such a configuration for lack of FPU, since dg-options are not taken into account by dg-require-effective-target. Add -march=armv7-a+fp -mfpu=auto is sufficient for arm_fp options to be acceptable. This enables the test to pass on all the arm-eabi configurations I'm testing, as well as arm-linux-gnueabi when forcing -march=armv5t. 2021-05-16 Christophe Lyon gcc/testsuite/ * gcc.target/arm/unsigned-float.c: Remove arm_fp_ok, adjust dg-options. --- gcc/testsuite/gcc.target/arm/unsigned-float.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/arm/unsigned-float.c b/gcc/testsuite/gcc.target/arm/unsigned-float.c index ad589d9..ea3abc7 100644 --- a/gcc/testsuite/gcc.target/arm/unsigned-float.c +++ b/gcc/testsuite/gcc.target/arm/unsigned-float.c @@ -1,8 +1,8 @@ /* { dg-do compile } */ -/* { dg-require-effective-target arm_fp_ok } */ -/* { dg-skip-if "need fp instructions" { *-*-* } { "-mfloat-abi=soft" } { "" } } */ /* { dg-skip-if "-mpure-code supports M-profile only" { *-*-* } { "-mpure-code" } } */ -/* { dg-options "-march=armv7-a -O1" } */ +/* { dg-options "-march=armv7-a+fp -mfpu=auto -O1" } */ +/* Do not require arm_ok effective target to avoid skipping on arm-eabi with + default configure options. */ /* { dg-add-options arm_fp } */ -- cgit v1.1 From 2fa3e5740b87085f82970887ddacfc877cdedbff Mon Sep 17 00:00:00 2001 From: David Edelsohn Date: Fri, 14 May 2021 12:45:59 -0400 Subject: testsuite: Require fsanitize support on the target. * g++.dg/warn/uninit-pr93100.C: Require fsantize support. --- gcc/testsuite/g++.dg/warn/uninit-pr93100.C | 1 + 1 file changed, 1 insertion(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/warn/uninit-pr93100.C b/gcc/testsuite/g++.dg/warn/uninit-pr93100.C index c9cd3ef..56dc894 100644 --- a/gcc/testsuite/g++.dg/warn/uninit-pr93100.C +++ b/gcc/testsuite/g++.dg/warn/uninit-pr93100.C @@ -1,5 +1,6 @@ /* PR tree-optimization/98508 - Sanitizer disable -Wall and -Wextra { dg-do compile } + { dg-require-effective-target no_fsanitize_address } { dg-options "-O0 -Wall -fsanitize=address" } */ struct S -- cgit v1.1 From e49ff61d41979d024714ca1b44d6c969bbb59d06 Mon Sep 17 00:00:00 2001 From: David Edelsohn Date: Sat, 15 May 2021 15:24:56 -0400 Subject: testsuite: Silence psabi warning * g++.dg/ext/attrib63.C: Add -Wno-psabi option. --- gcc/testsuite/g++.dg/ext/attrib63.C | 1 + 1 file changed, 1 insertion(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/ext/attrib63.C b/gcc/testsuite/g++.dg/ext/attrib63.C index e515a2b..93bde1e 100644 --- a/gcc/testsuite/g++.dg/ext/attrib63.C +++ b/gcc/testsuite/g++.dg/ext/attrib63.C @@ -1,4 +1,5 @@ // { dg-do compile } +// { dg-additional-options "-Wno-psabi" } #define vector __attribute__((vector_size(16))) class A { -- cgit v1.1 From 1dfb5d8ab52c3c76c877077d8d6dc4eaae3c6153 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 17 May 2021 00:16:31 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 26b04e7..936f37a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,16 @@ +2021-05-16 David Edelsohn + + * g++.dg/ext/attrib63.C: Add -Wno-psabi option. + +2021-05-16 David Edelsohn + + * g++.dg/warn/uninit-pr93100.C: Require fsantize support. + +2021-05-16 Christophe Lyon + + * gcc.target/arm/unsigned-float.c: Remove arm_fp_ok, adjust + dg-options. + 2021-05-15 Bill Schmidt * gcc.target/powerpc/rop-1.c: New. -- cgit v1.1 From b050cf6a4d9c305daff4a96e5a2489ece69dc287 Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Mon, 17 May 2021 09:25:43 +0000 Subject: testsuite: Require openmp effective-target for PR100515 The related test uses -fopenmp, which is not supported by newlib-based targets such as arm-eabi or aarch64-elf. Requiring the openmp effective-target makes the test unsupported rather than failed. 2021-05-17 Christophe Lyon PR debug/100515 gcc/testsuite * gcc.dg/debug/dwarf2/pr100515.c: Require openmp effective-target. --- gcc/testsuite/gcc.dg/debug/dwarf2/pr100515.c | 1 + 1 file changed, 1 insertion(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/pr100515.c b/gcc/testsuite/gcc.dg/debug/dwarf2/pr100515.c index 7c72fcd..17f6463 100644 --- a/gcc/testsuite/gcc.dg/debug/dwarf2/pr100515.c +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/pr100515.c @@ -1,5 +1,6 @@ /* PR debug/100515 */ /* { dg-do compile } */ +/* { dg-require-effective-target fopenmp } */ /* { dg-options "-g -O2 -fopenmp" } */ void -- cgit v1.1 From 582776eb1b62c32f5234566a01ea92247b7d6bcc Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Mon, 17 May 2021 13:20:27 +0200 Subject: OpenMP/Fortran: Reject nonintrinsic assignments in OMP WORKSHARE [PR100633] PR fortran/100633 gcc/fortran/ChangeLog: * resolve.c (gfc_resolve_code): Reject nonintrinsic assignments in OMP WORKSHARE. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/workshare-59.f90: New test. --- gcc/testsuite/gfortran.dg/gomp/workshare-59.f90 | 26 +++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/gomp/workshare-59.f90 (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gfortran.dg/gomp/workshare-59.f90 b/gcc/testsuite/gfortran.dg/gomp/workshare-59.f90 new file mode 100644 index 0000000..65d04c2 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/workshare-59.f90 @@ -0,0 +1,26 @@ +! PR fortran/100633 + +module defined_assign + interface assignment(=) + module procedure work_assign + end interface + + contains + subroutine work_assign(a,b) + integer, intent(out) :: a + logical, intent(in) :: b(:) + end subroutine work_assign +end module defined_assign + +program omp_workshare + use defined_assign + + integer :: a + logical :: l(10) + l = .TRUE. + + !$omp workshare + a = l ! { dg-error "Expected intrinsic assignment in OMP WORKSHARE" } + !$omp end workshare + +end program omp_workshare -- cgit v1.1 From 325187841aa66f0d03403d41fe9e696d094588b9 Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Mon, 17 May 2021 11:53:14 +0000 Subject: testsuite/arm: Fix and rename arm_qbit_ok into arm_sat_ok effective-target The acle/saturation.c test uses __[su]sat() and __saturation_occurred() intrinsics but __[su]sat() are defined in acle.h if __ARM_FEATURE_SAT true, while __saturation_occurred() depends on __ARM_FEATURE_QBIT. QBIT is a v5te feature, while SAT is available since v6, so the test really needs __ARM_FEATURE_SAT, to have both available. This patch renames arm_qbit_ok into arm_sat_ok and checks __ARM_FEATURE_SAT. It updates acle/saturation.c accordingly. This enables the test to pass on arm-eabi with default cpu/fpu/mode, where arm_qbit previously used -march=armv5te instead of armv6 now. 2021-05-17 Christophe Lyon gcc/ * doc/sourcebuild.texi (arm_qbit_ok): Rename into... (arm_sat_ok): ...this. gcc/testsuite/ * gcc.target/arm/acle/saturation.c: Use arm_sat_ok effective target. * lib/target-supports.exp (check_effective_target_arm_qbit_ok_nocache): Rename into... (check_effective_target_arm_sat_ok_nocache): ... this. Check __ARM_FEATURE_SAT and use armv6. --- gcc/testsuite/gcc.target/arm/acle/saturation.c | 4 +-- gcc/testsuite/lib/target-supports.exp | 42 +++++++++++++------------- 2 files changed, 23 insertions(+), 23 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/arm/acle/saturation.c b/gcc/testsuite/gcc.target/arm/acle/saturation.c index 0b3fe51..a9f99e5 100644 --- a/gcc/testsuite/gcc.target/arm/acle/saturation.c +++ b/gcc/testsuite/gcc.target/arm/acle/saturation.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ -/* { dg-require-effective-target arm_qbit_ok } */ -/* { dg-add-options arm_qbit } */ +/* { dg-require-effective-target arm_sat_ok } */ +/* { dg-add-options arm_sat } */ #include diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 5700c23..8192da5 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -4180,24 +4180,24 @@ proc add_options_for_arm_simd32 { flags } { return "$flags $et_arm_simd32_flags" } -# Return 1 if this is an ARM target supporting the saturation intrinsics -# from arm_acle.h. Some multilibs may be incompatible with these options. -# Also set et_arm_qbit_flags to the best options to add. -# arm_acle.h includes stdint.h which can cause trouble with incompatible -# -mfloat-abi= options. - -proc check_effective_target_arm_qbit_ok_nocache { } { - global et_arm_qbit_flags - set et_arm_qbit_flags "" - foreach flags {"" "-march=armv5te" "-march=armv5te -mfloat-abi=softfp" "-march=armv5te -mfloat-abi=hard"} { - if { [check_no_compiler_messages_nocache et_arm_qbit_flags object { +# Return 1 if this is an ARM target supporting the __ssat and __usat +# saturation intrinsics from arm_acle.h. Some multilibs may be +# incompatible with these options. Also set et_arm_sat_flags to the +# best options to add. arm_acle.h includes stdint.h which can cause +# trouble with incompatible -mfloat-abi= options. + +proc check_effective_target_arm_sat_ok_nocache { } { + global et_arm_sat_flags + set et_arm_sat_flags "" + foreach flags {"" "-march=armv6" "-march=armv6 -mfloat-abi=softfp" "-march=armv6 -mfloat-abi=hard -mfpu=vfp"} { + if { [check_no_compiler_messages_nocache et_arm_sat_flags object { #include int dummy; - #ifndef __ARM_FEATURE_QBIT - #error not QBIT + #ifndef __ARM_FEATURE_SAT + #error not SAT #endif } "$flags"] } { - set et_arm_qbit_flags $flags + set et_arm_sat_flags $flags return 1 } } @@ -4205,17 +4205,17 @@ proc check_effective_target_arm_qbit_ok_nocache { } { return 0 } -proc check_effective_target_arm_qbit_ok { } { - return [check_cached_effective_target et_arm_qbit_flags \ - check_effective_target_arm_qbit_ok_nocache] +proc check_effective_target_arm_sat_ok { } { + return [check_cached_effective_target et_arm_sat_flags \ + check_effective_target_arm_sat_ok_nocache] } -proc add_options_for_arm_qbit { flags } { - if { ! [check_effective_target_arm_qbit_ok] } { +proc add_options_for_arm_sat { flags } { + if { ! [check_effective_target_arm_sat_ok] } { return "$flags" } - global et_arm_qbit_flags - return "$flags $et_arm_qbit_flags" + global et_arm_sat_flags + return "$flags $et_arm_sat_flags" } # Return 1 if this is an ARM target supporting the DSP intrinsics from -- cgit v1.1 From e87d568e9e3e331e22850127308abedd0642e5e8 Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Mon, 17 May 2021 11:57:30 +0000 Subject: testsuite/arm: Improve mve-vshr.c Vector right shifts by immediate use vshr, while right shifts by vectors instead use vneg and vshl. This patch adds the corresponding scan-assembler-times that were missing. 2021-05-17 Christophe Lyon gcc/testsuite/ * gcc.target/arm/simd/mve-vshr.c: Add more scan-assembler-times. --- gcc/testsuite/gcc.target/arm/simd/mve-vshr.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-vshr.c b/gcc/testsuite/gcc.target/arm/simd/mve-vshr.c index d4e658c..d4258e9 100644 --- a/gcc/testsuite/gcc.target/arm/simd/mve-vshr.c +++ b/gcc/testsuite/gcc.target/arm/simd/mve-vshr.c @@ -55,5 +55,12 @@ FUNC_IMM(u, uint, 8, 16, >>, vshrimm) /* MVE has only 128-bit vectors, so we can vectorize only half of the functions above. */ +/* Vector right shifts use vneg and left shifts. */ +/* { dg-final { scan-assembler-times {vshl.s[0-9]+\tq[0-9]+, q[0-9]+} 3 } } */ +/* { dg-final { scan-assembler-times {vshl.u[0-9]+\tq[0-9]+, q[0-9]+} 3 } } */ +/* { dg-final { scan-assembler-times {vneg.s[0-9]+ q[0-9]+, q[0-9]+} 6 } } */ + + +/* Shift by immediate. */ /* { dg-final { scan-assembler-times {vshr.s[0-9]+\tq[0-9]+, q[0-9]+} 3 } } */ /* { dg-final { scan-assembler-times {vshr.u[0-9]+\tq[0-9]+, q[0-9]+} 3 } } */ -- cgit v1.1 From afa4401edd8a6a882848a6613d5441b0d0a10587 Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Mon, 17 May 2021 11:59:01 +0000 Subject: testsuite/arm: Factorize and increase coverage in mve-sub_1.c Use a template macro to factorize the existing test functions. This patch also adds a version to check subtraction with __fp16 type. 2021-05-17 Christophe Lyon gcc/testsuite/ * gcc.target/arm/simd/mve-vsub_1.c: Factorize and add __fp16 test. --- gcc/testsuite/gcc.target/arm/simd/mve-vsub_1.c | 60 +++++++++----------------- 1 file changed, 21 insertions(+), 39 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-vsub_1.c b/gcc/testsuite/gcc.target/arm/simd/mve-vsub_1.c index 842e5c6..5a6c345 100644 --- a/gcc/testsuite/gcc.target/arm/simd/mve-vsub_1.c +++ b/gcc/testsuite/gcc.target/arm/simd/mve-vsub_1.c @@ -5,60 +5,42 @@ #include -void test_vsub_i32 (int32_t * dest, int32_t * a, int32_t * b) { - int i; - for (i=0; i<4; i++) { - dest[i] = a[i] - b[i]; - } +#define FUNC(SIGN, TYPE, BITS, NB, OP, NAME) \ + void test_ ## NAME ##_ ## SIGN ## BITS ## x ## NB (TYPE##BITS##_t * __restrict__ dest, \ + TYPE##BITS##_t *a, TYPE##BITS##_t *b) { \ + int i; \ + for (i=0; i Date: Mon, 17 May 2021 12:00:07 +0000 Subject: testsuite/arm: Add mve-vadd-1.c test Support for vadd has been present for a while, but it was lacking a test. 2021-05-17 Christophe Lyon gcc/testsuite/ * gcc.target/arm/simd/mve-vadd-1.c: New. --- gcc/testsuite/gcc.target/arm/simd/mve-vadd-1.c | 43 ++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 gcc/testsuite/gcc.target/arm/simd/mve-vadd-1.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-vadd-1.c b/gcc/testsuite/gcc.target/arm/simd/mve-vadd-1.c new file mode 100644 index 0000000..15a9daa --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/simd/mve-vadd-1.c @@ -0,0 +1,43 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ +/* { dg-add-options arm_v8_1m_mve_fp } */ +/* { dg-additional-options "-O3" } */ + +#include + +#define FUNC(SIGN, TYPE, BITS, NB, OP, NAME) \ + void test_ ## NAME ##_ ## SIGN ## BITS ## x ## NB (TYPE##BITS##_t * __restrict__ dest, \ + TYPE##BITS##_t *a, TYPE##BITS##_t *b) { \ + int i; \ + for (i=0; i Date: Mon, 17 May 2021 12:02:40 +0000 Subject: testsuite/arm: Add mve-vadd-scalar-1.c test This patch adds a test for the scalar mode of vadd, precisely noting that we do not yet use the T2 variants of vadd, which take a scalar as final argument. 2021-05-17 Christophe Lyon gcc/testsuite/ * gcc.target/arm/simd/mve-vadd-scalar-1.c: New. --- .../gcc.target/arm/simd/mve-vadd-scalar-1.c | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 gcc/testsuite/gcc.target/arm/simd/mve-vadd-scalar-1.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-vadd-scalar-1.c b/gcc/testsuite/gcc.target/arm/simd/mve-vadd-scalar-1.c new file mode 100644 index 0000000..bbf70e1 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/simd/mve-vadd-scalar-1.c @@ -0,0 +1,47 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ +/* { dg-add-options arm_v8_1m_mve_fp } */ +/* { dg-additional-options "-O3" } */ + +#include + +#define FUNC_IMM(SIGN, TYPE, BITS, NB, OP, NAME) \ + void test_ ## NAME ##_ ## SIGN ## BITS ## x ## NB (TYPE##BITS##_t * __restrict__ dest, \ + TYPE##BITS##_t *a) { \ + int i; \ + for (i=0; i Date: Thu, 13 May 2021 13:08:16 +0800 Subject: Fix ICE [PR target/100549] When arg0 is same as arg1 in __builtin_ia32_pcmpgtw, gimple_build (&stmts, GT_EXPR, cmp_type, arg0, arg1) will simplify the comparison to vector constant 0, no stmts is generated, which causes ICE in gsi_insert_before (gsi, stmts, GSI_SAME_STMT). So use gsi_insert_seq_before instead which will handle NULL seq. gcc/ChangeLog: PR target/100549 * config/i386/i386.c (ix86_gimple_fold_builtin): Use gsi_insert_seq_before instead. gcc/testsuite/ChangeLog: PR target/100549 * gcc.target/i386/pr100549.c: New test. --- gcc/testsuite/gcc.target/i386/pr100549.c | 108 +++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr100549.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/i386/pr100549.c b/gcc/testsuite/gcc.target/i386/pr100549.c new file mode 100644 index 0000000..83bba3c --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr100549.c @@ -0,0 +1,108 @@ +/* PR target/100549 */ +/* { dg-do compile } */ +/* { dg-options "-O -mavx2" } */ + +typedef char v16qi __attribute__ ((vector_size (16))); +typedef char v32qi __attribute__ ((vector_size (32))); +typedef short v8hi __attribute__ ((vector_size (16))); +typedef short v16hi __attribute__ ((vector_size (32))); +typedef int v4si __attribute__ ((vector_size (16))); +typedef int v8si __attribute__ ((vector_size (32))); +typedef long long v2di __attribute__ ((vector_size (16))); +typedef long long v4di __attribute__ ((vector_size (32))); + +v16qi +f1 (v16qi a) +{ + return __builtin_ia32_pcmpeqb128 (a, a); +} + +v8hi +f2 (v8hi a) +{ + return __builtin_ia32_pcmpeqw128 (a, a); +} + +v4si +f3 (v4si a) +{ + return __builtin_ia32_pcmpeqd128 (a, a); +} + +v2di +f4 (v2di a) +{ + return __builtin_ia32_pcmpeqq (a, a); +} + +v16qi +f5 (v16qi a) +{ + return __builtin_ia32_pcmpgtb128 (a, a); +} + +v8hi +f6 (v8hi a) +{ + return __builtin_ia32_pcmpgtw128 (a, a); +} + +v4si +f7 (v4si a) +{ + return __builtin_ia32_pcmpgtd128 (a, a); +} + +v2di +f8 (v2di a) +{ + return __builtin_ia32_pcmpgtq (a, a); +} + +v32qi +f9 (v32qi a) +{ + return __builtin_ia32_pcmpeqb256 (a, a); +} + +v16hi +f10 (v16hi a) +{ + return __builtin_ia32_pcmpeqw256 (a, a); +} + +v8si +f11 (v8si a) +{ + return __builtin_ia32_pcmpeqd256 (a, a); +} + +v4di +f12 (v4di a) +{ + return __builtin_ia32_pcmpeqq256 (a, a); +} + +v32qi +f13 (v32qi a) +{ + return __builtin_ia32_pcmpgtb256 (a, a); +} + +v16hi +f14 (v16hi a) +{ + return __builtin_ia32_pcmpgtw256 (a, a); +} + +v8si +f15 (v8si a) +{ + return __builtin_ia32_pcmpgtd256 (a, a); +} + +v4di +f16 (v4di a) +{ + return __builtin_ia32_pcmpgtq256 (a, a); +} -- cgit v1.1 From a6eacbf1055520e968d1a25f6d30d6ff4b66272d Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Mon, 17 May 2021 12:29:42 +0000 Subject: arm: Auto-vectorization for MVE: vcmp Since MVE has a different set of vector comparison operators from Neon, we have to update the expansion to take into account the new ones, for instance 'NE' for which MVE does not require to use 'EQ' with the inverted condition. Conversely, Neon supports comparisons with #0, MVE does not. For: typedef long int vs32 __attribute__((vector_size(16))); vs32 cmp_eq_vs32_reg (vs32 a, vs32 b) { return a == b; } we now generate: cmp_eq_vs32_reg: vldr.64 d4, .L123 @ 8 [c=8 l=4] *mve_movv4si/8 vldr.64 d5, .L123+8 vldr.64 d6, .L123+16 @ 9 [c=8 l=4] *mve_movv4si/8 vldr.64 d7, .L123+24 vcmp.i32 eq, q0, q1 @ 7 [c=16 l=4] mve_vcmpeqq_v4si vpsel q0, q3, q2 @ 15 [c=8 l=4] mve_vpselq_sv4si bx lr @ 26 [c=8 l=4] *thumb2_return .L124: .align 3 .L123: .word 0 .word 0 .word 0 .word 0 .word 1 .word 1 .word 1 .word 1 For some reason emit_move_insn (zero, CONST0_RTX (cmp_mode)) produces a pair of vldr instead of vmov.i32, qX, #0 2021-05-17 Christophe Lyon gcc/ * config/arm/arm-protos.h (arm_expand_vector_compare): Update prototype. * config/arm/arm.c (arm_expand_vector_compare): Add support for MVE. (arm_expand_vcond): Likewise. * config/arm/iterators.md (supf): Remove VCMPNEQ_S, VCMPEQQ_S, VCMPEQQ_N_S, VCMPNEQ_N_S. (VCMPNEQ, VCMPEQQ, VCMPEQQ_N, VCMPNEQ_N): Remove. * config/arm/mve.md (@mve_vcmpq_): Add '@' prefix. (@mve_vcmpq_f): Likewise. (@mve_vcmpq_n_f): Likewise. (@mve_vpselq_): Likewise. (@mve_vpselq_f"): Likewise. * config/arm/neon.md (vec_cmp): Likewise. (vcond): Likewise. (vcond): Likewise. (vcondu): Likewise. (vcond_mask_): Likewise. * config/arm/unspecs.md (VCMPNEQ_U, VCMPNEQ_S, VCMPEQQ_S) (VCMPEQQ_N_S, VCMPNEQ_N_S, VCMPEQQ_U, CMPEQQ_N_U, VCMPNEQ_N_U) (VCMPGEQ_N_S, VCMPGEQ_S, VCMPGTQ_N_S, VCMPGTQ_S, VCMPLEQ_N_S) (VCMPLEQ_S, VCMPLTQ_N_S, VCMPLTQ_S, VCMPCSQ_N_U, VCMPCSQ_U) (VCMPHIQ_N_U, VCMPHIQ_U): Remove. * config/arm/vec-common.md (vec_cmp): Likewise. (vcond): Likewise. (vcond): Likewise. (vcondu): Likewise. (vcond_mask_): Likewise. Added unsafe math condition. gcc/testsuite * gcc.target/arm/simd/mve-compare-1.c: New test with GCC vectors. * gcc.target/arm/simd/mve-compare-2.c: New test with GCC vectors. * gcc.target/arm/simd/mve-compare-scalar-1.c: New test with GCC vectors. * gcc.target/arm/simd/mve-vcmp-f32.c: New test for auto-vectorization. * gcc.target/arm/simd/mve-vcmp.c: New test for auto-vectorization. --- gcc/testsuite/gcc.target/arm/simd/mve-compare-1.c | 80 ++++++++++++++++++++++ gcc/testsuite/gcc.target/arm/simd/mve-compare-2.c | 38 ++++++++++ .../gcc.target/arm/simd/mve-compare-scalar-1.c | 69 +++++++++++++++++++ gcc/testsuite/gcc.target/arm/simd/mve-vcmp-f32.c | 30 ++++++++ gcc/testsuite/gcc.target/arm/simd/mve-vcmp.c | 50 ++++++++++++++ 5 files changed, 267 insertions(+) create mode 100644 gcc/testsuite/gcc.target/arm/simd/mve-compare-1.c create mode 100644 gcc/testsuite/gcc.target/arm/simd/mve-compare-2.c create mode 100644 gcc/testsuite/gcc.target/arm/simd/mve-compare-scalar-1.c create mode 100644 gcc/testsuite/gcc.target/arm/simd/mve-vcmp-f32.c create mode 100644 gcc/testsuite/gcc.target/arm/simd/mve-vcmp.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-compare-1.c b/gcc/testsuite/gcc.target/arm/simd/mve-compare-1.c new file mode 100644 index 0000000..029c931 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/simd/mve-compare-1.c @@ -0,0 +1,80 @@ +/* { dg-do assemble } */ +/* { dg-require-effective-target arm_v8_1m_mve_ok } */ +/* { dg-add-options arm_v8_1m_mve } */ +/* { dg-additional-options "-O3" } */ + +/* Integer tests. */ + +#define COMPARE_REG(NAME, OP, TYPE) \ + TYPE \ + cmp_##NAME##_##TYPE##_reg (TYPE a, TYPE b) \ + { \ + return a OP b; \ + } + +#define COMPARE_REG_AND_ZERO(NAME, OP, TYPE) \ + COMPARE_REG (NAME, OP, TYPE) \ + \ + TYPE \ + cmp_##NAME##_##TYPE##_zero (TYPE a) \ + { \ + return a OP (TYPE) {}; \ + } + +#define COMPARE_TYPE(TYPE, COMPARE_ORDERED) \ + COMPARE_REG_AND_ZERO (eq, ==, TYPE) \ + COMPARE_REG_AND_ZERO (ne, !=, TYPE) \ + COMPARE_ORDERED (lt, <, TYPE) \ + COMPARE_ORDERED (le, <=, TYPE) \ + COMPARE_ORDERED (gt, >, TYPE) \ + COMPARE_ORDERED (ge, >=, TYPE) + +#define TEST_TYPE(NAME, ELEM, COMPARE_ORDERED, SIZE) \ + typedef ELEM NAME##SIZE __attribute__((vector_size(SIZE))); \ + COMPARE_TYPE (NAME##SIZE, COMPARE_ORDERED) + +/* 64-bits vectors, not vectorized. */ +TEST_TYPE (vs8, __INT8_TYPE__, COMPARE_REG_AND_ZERO, 8) +TEST_TYPE (vu8, __UINT8_TYPE__, COMPARE_REG, 8) +TEST_TYPE (vs16, __INT16_TYPE__, COMPARE_REG_AND_ZERO, 8) +TEST_TYPE (vu16, __UINT16_TYPE__, COMPARE_REG, 8) +TEST_TYPE (vs32, __INT32_TYPE__, COMPARE_REG_AND_ZERO, 8) +TEST_TYPE (vu32, __UINT32_TYPE__, COMPARE_REG, 8) + +/* 128-bits vectors. */ +TEST_TYPE (vs8, __INT8_TYPE__, COMPARE_REG_AND_ZERO, 16) +TEST_TYPE (vu8, __UINT8_TYPE__, COMPARE_REG, 16) +TEST_TYPE (vs16, __INT16_TYPE__, COMPARE_REG_AND_ZERO, 16) +TEST_TYPE (vu16, __UINT16_TYPE__, COMPARE_REG, 16) +TEST_TYPE (vs32, __INT32_TYPE__, COMPARE_REG_AND_ZERO, 16) +TEST_TYPE (vu32, __UINT32_TYPE__, COMPARE_REG, 16) + +/* { 8 bits } x { eq, ne, lt, le, gt, ge, hi, cs }. +/* { dg-final { scan-assembler-times {\tvcmp.i8 eq, q[0-9]+, q[0-9]+\n} 4 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.i8 ne, q[0-9]+, q[0-9]+\n} 4 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.s8 lt, q[0-9]+, q[0-9]+\n} 2 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.s8 le, q[0-9]+, q[0-9]+\n} 2 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.s8 gt, q[0-9]+, q[0-9]+\n} 2 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.s8 ge, q[0-9]+, q[0-9]+\n} 2 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.u8 hi, q[0-9]+, q[0-9]+\n} 2 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.u8 cs, q[0-9]+, q[0-9]+\n} 2 } } */ + +/* { 16 bits } x { eq, ne, lt, le, gt, ge, hi, cs }. +/* { dg-final { scan-assembler-times {\tvcmp.i16 eq, q[0-9]+, q[0-9]+\n} 4 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.i16 ne, q[0-9]+, q[0-9]+\n} 4 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.s16 lt, q[0-9]+, q[0-9]+\n} 2 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.s16 le, q[0-9]+, q[0-9]+\n} 2 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.s16 gt, q[0-9]+, q[0-9]+\n} 2 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.s16 ge, q[0-9]+, q[0-9]+\n} 2 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.u16 hi, q[0-9]+, q[0-9]+\n} 2 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.u16 cs, q[0-9]+, q[0-9]+\n} 2 } } */ + +/* { 32 bits } x { eq, ne, lt, le, gt, ge, hi, cs }. +/* { dg-final { scan-assembler-times {\tvcmp.i32 eq, q[0-9]+, q[0-9]+\n} 4 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.i32 ne, q[0-9]+, q[0-9]+\n} 4 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.s32 lt, q[0-9]+, q[0-9]+\n} 2 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.s32 le, q[0-9]+, q[0-9]+\n} 2 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.s32 gt, q[0-9]+, q[0-9]+\n} 2 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.s32 ge, q[0-9]+, q[0-9]+\n} 2 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.u32 hi, q[0-9]+, q[0-9]+\n} 2 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.u32 cs, q[0-9]+, q[0-9]+\n} 2 } } */ diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-compare-2.c b/gcc/testsuite/gcc.target/arm/simd/mve-compare-2.c new file mode 100644 index 0000000..8515195 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/simd/mve-compare-2.c @@ -0,0 +1,38 @@ +/* { dg-do assemble } */ +/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ +/* { dg-add-options arm_v8_1m_mve_fp } */ +/* { dg-additional-options "-O3 -funsafe-math-optimizations" } */ + +/* float 32 tests. */ + +#ifndef ELEM_TYPE +#define ELEM_TYPE float +#endif +#ifndef INT_ELEM_TYPE +#define INT_ELEM_TYPE __INT32_TYPE__ +#endif + +#define COMPARE(NAME, OP) \ + int_vec \ + cmp_##NAME##_reg (vec a, vec b) \ + { \ + return a OP b; \ + } + +typedef INT_ELEM_TYPE int_vec __attribute__((vector_size(16))); +typedef ELEM_TYPE vec __attribute__((vector_size(16))); + +COMPARE (eq, ==) +COMPARE (ne, !=) +COMPARE (lt, <) +COMPARE (le, <=) +COMPARE (gt, >) +COMPARE (ge, >=) + +/* eq, ne, lt, le, gt, ge. +/* { dg-final { scan-assembler-times {\tvcmp.f32\teq, q[0-9]+, q[0-9]+\n} 1 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.f32\tne, q[0-9]+, q[0-9]+\n} 1 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.f32\tlt, q[0-9]+, q[0-9]+\n} 1 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.f32\tle, q[0-9]+, q[0-9]+\n} 1 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.f32\tgt, q[0-9]+, q[0-9]+\n} 1 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.f32\tge, q[0-9]+, q[0-9]+\n} 1 } } */ diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-compare-scalar-1.c b/gcc/testsuite/gcc.target/arm/simd/mve-compare-scalar-1.c new file mode 100644 index 0000000..7774972 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/simd/mve-compare-scalar-1.c @@ -0,0 +1,69 @@ +/* { dg-do assemble } */ +/* { dg-require-effective-target arm_v8_1m_mve_ok } */ +/* { dg-add-options arm_v8_1m_mve } */ +/* { dg-additional-options "-O3" } */ + +#define COMPARE_REG(NAME, OP, TYPE, SCALAR) \ + TYPE \ + cmp_##NAME##_##TYPE##_scalar (TYPE a, SCALAR b) \ + { \ + return a OP b; \ + } + +#define COMPARE_TYPE(SCALAR, TYPE) \ + COMPARE_REG (eq, ==, TYPE, SCALAR) \ + COMPARE_REG (ne, !=, TYPE, SCALAR) \ + COMPARE_REG (lt, <, TYPE, SCALAR) \ + COMPARE_REG (le, <=, TYPE, SCALAR) \ + COMPARE_REG (gt, >, TYPE, SCALAR) \ + COMPARE_REG (ge, >=, TYPE, SCALAR) + +#define TEST_TYPE(NAME, ELEM, SIZE) \ + typedef ELEM NAME##SIZE __attribute__((vector_size(SIZE))); \ + COMPARE_TYPE (ELEM, NAME##SIZE) + +/* 64-bits vectors, not vectorized. */ +TEST_TYPE (vs8, __INT8_TYPE__, 8) +TEST_TYPE (vu8, __UINT8_TYPE__, 8) +TEST_TYPE (vs16, __INT16_TYPE__, 8) +TEST_TYPE (vu16, __UINT16_TYPE__, 8) +TEST_TYPE (vs32, __INT32_TYPE__, 8) +TEST_TYPE (vu32, __UINT32_TYPE__, 8) + +/* 128-bits vectors. */ +TEST_TYPE (vs8, __INT8_TYPE__, 16) +TEST_TYPE (vu8, __UINT8_TYPE__, 16) +TEST_TYPE (vs16, __INT16_TYPE__, 16) +TEST_TYPE (vu16, __UINT16_TYPE__, 16) +TEST_TYPE (vs32, __INT32_TYPE__, 16) +TEST_TYPE (vu32, __UINT32_TYPE__, 16) + +/* { 8 bits } x { eq, ne, lt, le, gt, ge, hi, cs }. +/* { dg-final { scan-assembler-times {\tvcmp.i8 eq, q[0-9]+, q[0-9]+\n} 2 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.i8 ne, q[0-9]+, q[0-9]+\n} 2 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.s8 lt, q[0-9]+, q[0-9]+\n} 1 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.s8 le, q[0-9]+, q[0-9]+\n} 1 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.s8 gt, q[0-9]+, q[0-9]+\n} 1 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.s8 ge, q[0-9]+, q[0-9]+\n} 1 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.u8 hi, q[0-9]+, q[0-9]+\n} 2 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.u8 cs, q[0-9]+, q[0-9]+\n} 2 } } */ + +/* { 16 bits } x { eq, ne, lt, le, gt, ge, hi, cs }. +/* { dg-final { scan-assembler-times {\tvcmp.i16 eq, q[0-9]+, q[0-9]+\n} 2 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.i16 ne, q[0-9]+, q[0-9]+\n} 2 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.s16 lt, q[0-9]+, q[0-9]+\n} 1 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.s16 le, q[0-9]+, q[0-9]+\n} 1 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.s16 gt, q[0-9]+, q[0-9]+\n} 1 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.s16 ge, q[0-9]+, q[0-9]+\n} 1 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.u16 hi, q[0-9]+, q[0-9]+\n} 2 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.u16 cs, q[0-9]+, q[0-9]+\n} 2 } } */ + +/* { 32 bits } x { eq, ne, lt, le, gt, ge, hi, cs }. +/* { dg-final { scan-assembler-times {\tvcmp.i32 eq, q[0-9]+, q[0-9]+\n} 2 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.i32 ne, q[0-9]+, q[0-9]+\n} 2 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.s32 lt, q[0-9]+, q[0-9]+\n} 1 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.s32 le, q[0-9]+, q[0-9]+\n} 1 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.s32 gt, q[0-9]+, q[0-9]+\n} 1 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.s32 ge, q[0-9]+, q[0-9]+\n} 1 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.u32 hi, q[0-9]+, q[0-9]+\n} 2 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.u32 cs, q[0-9]+, q[0-9]+\n} 2 } } */ diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-vcmp-f32.c b/gcc/testsuite/gcc.target/arm/simd/mve-vcmp-f32.c new file mode 100644 index 0000000..4ed449e --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/simd/mve-vcmp-f32.c @@ -0,0 +1,30 @@ +/* { dg-do assemble } */ +/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ +/* { dg-add-options arm_v8_1m_mve_fp } */ +/* { dg-additional-options "-O3 -funsafe-math-optimizations" } */ + +#include + +#define NB 4 + +#define FUNC(OP, NAME) \ + void test_ ## NAME ##_f (float * __restrict__ dest, float *a, float *b) { \ + int i; \ + for (i=0; i, vcmpgt) +FUNC(>=, vcmpge) + +/* { dg-final { scan-assembler-times {\tvcmp.f32\teq, q[0-9]+, q[0-9]+\n} 1 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.f32\tne, q[0-9]+, q[0-9]+\n} 1 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.f32\tlt, q[0-9]+, q[0-9]+\n} 1 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.f32\tle, q[0-9]+, q[0-9]+\n} 1 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.f32\tgt, q[0-9]+, q[0-9]+\n} 1 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.f32\tge, q[0-9]+, q[0-9]+\n} 1 } } */ diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-vcmp.c b/gcc/testsuite/gcc.target/arm/simd/mve-vcmp.c new file mode 100644 index 0000000..8da15e7 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/simd/mve-vcmp.c @@ -0,0 +1,50 @@ +/* { dg-do assemble } */ +/* { dg-require-effective-target arm_v8_1m_mve_ok } */ +/* { dg-add-options arm_v8_1m_mve } */ +/* { dg-additional-options "-O3" } */ + +#include + +#define FUNC(SIGN, TYPE, BITS, NB, OP, NAME) \ + void test_ ## NAME ##_ ## SIGN ## BITS ## x ## NB (TYPE##BITS##_t * __restrict__ dest, TYPE##BITS##_t *a, TYPE##BITS##_t *b) { \ + int i; \ + for (i=0; i, vcmpgt) +ALL_FUNCS(>=, vcmpge) + +/* MVE has only 128-bit vectors, so we can vectorize only half of the + functions above. */ +/* { dg-final { scan-assembler-times {\tvcmp.i[0-9]+ eq, q[0-9]+, q[0-9]+\n} 6 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.i[0-9]+ ne, q[0-9]+, q[0-9]+\n} 6 } } */ + +/* lt, le, gt, ge apply to signed types, cs and hi to unsigned types. */ +/* lt and le with unsigned types are replaced with the opposite condition, hence + the double number of matches for cs and hi. */ +/* { dg-final { scan-assembler-times {\tvcmp.s[0-9]+ lt, q[0-9]+, q[0-9]+\n} 3 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.s[0-9]+ le, q[0-9]+, q[0-9]+\n} 3 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.s[0-9]+ gt, q[0-9]+, q[0-9]+\n} 3 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.s[0-9]+ ge, q[0-9]+, q[0-9]+\n} 3 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.u[0-9]+ cs, q[0-9]+, q[0-9]+\n} 6 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.u[0-9]+ hi, q[0-9]+, q[0-9]+\n} 6 } } */ -- cgit v1.1 From 7606865198b241b4c944f66761d6506b02ead951 Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Mon, 17 May 2021 12:31:58 +0000 Subject: arm: Auto-vectorization for MVE: add __fp16 support to VCMP This patch adds __fp16 support to the previous patch that added vcmp support with MVE. For this we update existing expanders to use VDQWH iterator, and add a new expander vcond. In the process we need to create suitable iterators, and update v_cmp_result as needed. 2021-05-17 Christophe Lyon gcc/ * config/arm/iterators.md (V16): New iterator. (VH_cvtto): New iterator. (v_cmp_result): Added V4HF and V8HF support. * config/arm/vec-common.md (vec_cmp): Use VDQWH. (vcond): Likewise. (vcond_mask_): Likewise. (vcond): New expander. gcc/testsuite/ * gcc.target/arm/simd/mve-compare-3.c: New test with GCC vectors. * gcc.target/arm/simd/mve-vcmp-f16.c: New test for auto-vectorization. * gcc.target/arm/armv8_2-fp16-arith-1.c: Adjust since we now vectorize float16_t vectors. --- .../gcc.target/arm/armv8_2-fp16-arith-1.c | 16 +++++++-- gcc/testsuite/gcc.target/arm/simd/mve-compare-3.c | 38 ++++++++++++++++++++++ gcc/testsuite/gcc.target/arm/simd/mve-vcmp-f16.c | 30 +++++++++++++++++ 3 files changed, 82 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.target/arm/simd/mve-compare-3.c create mode 100644 gcc/testsuite/gcc.target/arm/simd/mve-vcmp-f16.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/arm/armv8_2-fp16-arith-1.c b/gcc/testsuite/gcc.target/arm/armv8_2-fp16-arith-1.c index 921d26e..52b8737 100644 --- a/gcc/testsuite/gcc.target/arm/armv8_2-fp16-arith-1.c +++ b/gcc/testsuite/gcc.target/arm/armv8_2-fp16-arith-1.c @@ -104,8 +104,20 @@ TEST_CMP (greaterthanqual, >=, int16x8_t, float16x8_t) /* { dg-final { scan-assembler-times {vmul\.f16\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */ /* { dg-final { scan-assembler-times {vdiv\.f16\ts[0-9]+, s[0-9]+, s[0-9]+} 13 } } */ -/* { dg-final { scan-assembler-times {vcmp\.f32\ts[0-9]+, s[0-9]+} 26 } } */ -/* { dg-final { scan-assembler-times {vcmpe\.f32\ts[0-9]+, s[0-9]+} 52 } } */ + +/* For float16_t. */ +/* { dg-final { scan-assembler-times {vcmp\.f32\ts[0-9]+, s[0-9]+} 2 } } */ +/* { dg-final { scan-assembler-times {vcmpe\.f32\ts[0-9]+, s[0-9]+} 4 } } */ + +/* For float16x4_t. */ +/* { dg-final { scan-assembler-times {vceq\.f16\td[0-9]+, d[0-9]+} 2 } } */ +/* { dg-final { scan-assembler-times {vcge\.f16\td[0-9]+, d[0-9]+} 2 } } */ +/* { dg-final { scan-assembler-times {vcgt\.f16\td[0-9]+, d[0-9]+} 2 } } */ + +/* For float16x8_t. */ +/* { dg-final { scan-assembler-times {vceq\.f16\tq[0-9]+, q[0-9]+} 2 } } */ +/* { dg-final { scan-assembler-times {vcge\.f16\tq[0-9]+, q[0-9]+} 2 } } */ +/* { dg-final { scan-assembler-times {vcgt\.f16\tq[0-9]+, q[0-9]+} 2 } } */ /* { dg-final { scan-assembler-not {vadd\.f32} } } */ /* { dg-final { scan-assembler-not {vsub\.f32} } } */ diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-compare-3.c b/gcc/testsuite/gcc.target/arm/simd/mve-compare-3.c new file mode 100644 index 0000000..76f81e8 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/simd/mve-compare-3.c @@ -0,0 +1,38 @@ +/* { dg-do assemble } */ +/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ +/* { dg-add-options arm_v8_1m_mve_fp } */ +/* { dg-additional-options "-O3 -funsafe-math-optimizations" } */ + +/* float 16 tests. */ + +#ifndef ELEM_TYPE +#define ELEM_TYPE __fp16 +#endif +#ifndef INT_ELEM_TYPE +#define INT_ELEM_TYPE __INT16_TYPE__ +#endif + +#define COMPARE(NAME, OP) \ + int_vec \ + cmp_##NAME##_reg (vec a, vec b) \ + { \ + return a OP b; \ + } + +typedef INT_ELEM_TYPE int_vec __attribute__((vector_size(16))); +typedef ELEM_TYPE vec __attribute__((vector_size(16))); + +COMPARE (eq, ==) +COMPARE (ne, !=) +COMPARE (lt, <) +COMPARE (le, <=) +COMPARE (gt, >) +COMPARE (ge, >=) + +/* eq, ne, lt, le, gt, ge. +/* { dg-final { scan-assembler-times {\tvcmp.f16\teq, q[0-9]+, q[0-9]+\n} 1 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.f16\tne, q[0-9]+, q[0-9]+\n} 1 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.f16\tlt, q[0-9]+, q[0-9]+\n} 1 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.f16\tle, q[0-9]+, q[0-9]+\n} 1 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.f16\tgt, q[0-9]+, q[0-9]+\n} 1 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.f16\tge, q[0-9]+, q[0-9]+\n} 1 } } */ diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-vcmp-f16.c b/gcc/testsuite/gcc.target/arm/simd/mve-vcmp-f16.c new file mode 100644 index 0000000..dbae2d1 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/simd/mve-vcmp-f16.c @@ -0,0 +1,30 @@ +/* { dg-do assemble } */ +/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ +/* { dg-add-options arm_v8_1m_mve_fp } */ +/* { dg-additional-options "-O3 -funsafe-math-optimizations" } */ + +#include + +#define NB 8 + +#define FUNC(OP, NAME) \ + void test_ ## NAME ##_f (__fp16 * __restrict__ dest, __fp16 *a, __fp16 *b) { \ + int i; \ + for (i=0; i, vcmpgt) +FUNC(>=, vcmpge) + +/* { dg-final { scan-assembler-times {\tvcmp.f16\teq, q[0-9]+, q[0-9]+\n} 1 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.f16\tne, q[0-9]+, q[0-9]+\n} 1 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.f16\tlt, q[0-9]+, q[0-9]+\n} 1 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.f16\tle, q[0-9]+, q[0-9]+\n} 1 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.f16\tgt, q[0-9]+, q[0-9]+\n} 1 } } */ +/* { dg-final { scan-assembler-times {\tvcmp.f16\tge, q[0-9]+, q[0-9]+\n} 1 } } */ -- cgit v1.1 From e0a5daf81f2c79a0275eccd7c1a25349990a7a4d Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 17 May 2021 13:56:14 +0200 Subject: middle-end/100582 - fix array_at_struct_end_p for vector indexing Vector indexing leaves us with ARRAY_REFs of VIEW_CONVERT_EXPRs, sth which array_at_struct_end_p considers a array-at-struct-end even when there's an underlying decl visible. The following fixes the latter. 2021-05-17 Richard Biener PR middle-end/100582 * tree.c (array_at_struct_end_p): Get to the base of the reference before looking for the underlying decl. * gcc.target/i386/pr100582.c: New testcase. --- gcc/testsuite/gcc.target/i386/pr100582.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr100582.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/i386/pr100582.c b/gcc/testsuite/gcc.target/i386/pr100582.c new file mode 100644 index 0000000..9520fe7 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr100582.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -mavx2" } */ + +typedef unsigned char v32qi __attribute__((vector_size(32))); + +v32qi +f2 (v32qi x, v32qi a, v32qi b) +{ + v32qi e; + for (int i = 0; i != 32; i++) + e[i] = x[i] ? a[i] : b[i]; + + return e; +} + +/* { dg-final { scan-assembler-times "pblendvb" 1 } } */ -- cgit v1.1 From 086882b1c8faa8f99f98a9219ccec42d89db50c2 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 17 May 2021 14:47:08 +0200 Subject: c/100625 - avoid building invalid labels in the GIMPLE FE When duplicate labes are diagnosed, avoid building a GIMPLE_LABEL. 2021-05-17 Richard Biener PR c/100625 gcc/c/ * gimple-parser.c (c_parser_gimple_label): Avoid building a GIMPLE label with NULL label decl. gcc/testsuite/ * gcc.dg/gimplefe-error-9.c: New testcase. --- gcc/testsuite/gcc.dg/gimplefe-error-9.c | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/gimplefe-error-9.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/gimplefe-error-9.c b/gcc/testsuite/gcc.dg/gimplefe-error-9.c new file mode 100644 index 0000000..87014c1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/gimplefe-error-9.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-fgimple" } */ + +void __GIMPLE +foo() +{ +bb1: +bb1:; /* { dg-error "duplicate" } */ +} -- cgit v1.1 From e91a17fe39c39e98cebe6e1cbc8064ee6846a3a7 Mon Sep 17 00:00:00 2001 From: Tamar Christina Date: Mon, 17 May 2021 15:22:39 +0100 Subject: AArch64: Have -mcpu=native and -march=native enable extensions when CPU is unknown Currently when using -mcpu=native or -march=native on a CPU that is unknown to the compiler the compiler currently just used -march=armv8-a and enables none of the extensions. To make this a bit more useful this patch changes it to still use -march=armv8.a but to enable the extensions. We still cannot do tuning but at least if using this on a future SVE core the compiler will at the very least enable SVE etc. gcc/ChangeLog: * config/aarch64/driver-aarch64.c (DEFAULT_ARCH): New. (host_detect_local_cpu): Use it. gcc/testsuite/ChangeLog: * gcc.target/aarch64/cpunative/info_16: New test. * gcc.target/aarch64/cpunative/info_17: New test. * gcc.target/aarch64/cpunative/native_cpu_16.c: New test. * gcc.target/aarch64/cpunative/native_cpu_17.c: New test. --- gcc/testsuite/gcc.target/aarch64/cpunative/info_16 | 8 ++++++++ gcc/testsuite/gcc.target/aarch64/cpunative/info_17 | 8 ++++++++ gcc/testsuite/gcc.target/aarch64/cpunative/native_cpu_16.c | 12 ++++++++++++ gcc/testsuite/gcc.target/aarch64/cpunative/native_cpu_17.c | 12 ++++++++++++ 4 files changed, 40 insertions(+) create mode 100644 gcc/testsuite/gcc.target/aarch64/cpunative/info_16 create mode 100644 gcc/testsuite/gcc.target/aarch64/cpunative/info_17 create mode 100644 gcc/testsuite/gcc.target/aarch64/cpunative/native_cpu_16.c create mode 100644 gcc/testsuite/gcc.target/aarch64/cpunative/native_cpu_17.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/aarch64/cpunative/info_16 b/gcc/testsuite/gcc.target/aarch64/cpunative/info_16 new file mode 100644 index 0000000..b067957 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/cpunative/info_16 @@ -0,0 +1,8 @@ +processor : 0 +BogoMIPS : 100.00 +Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 asimddp sve sve2 +CPU implementer : 0xff +CPU architecture: 8 +CPU variant : 0x0 +CPU part : 0xd08 +CPU revision : 2 diff --git a/gcc/testsuite/gcc.target/aarch64/cpunative/info_17 b/gcc/testsuite/gcc.target/aarch64/cpunative/info_17 new file mode 100644 index 0000000..b067957 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/cpunative/info_17 @@ -0,0 +1,8 @@ +processor : 0 +BogoMIPS : 100.00 +Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 asimddp sve sve2 +CPU implementer : 0xff +CPU architecture: 8 +CPU variant : 0x0 +CPU part : 0xd08 +CPU revision : 2 diff --git a/gcc/testsuite/gcc.target/aarch64/cpunative/native_cpu_16.c b/gcc/testsuite/gcc.target/aarch64/cpunative/native_cpu_16.c new file mode 100644 index 0000000..a424e7c --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/cpunative/native_cpu_16.c @@ -0,0 +1,12 @@ +/* { dg-do compile { target { { aarch64*-*-linux*} && native } } } */ +/* { dg-set-compiler-env-var GCC_CPUINFO "$srcdir/gcc.target/aarch64/cpunative/info_16" } */ +/* { dg-additional-options "-mcpu=native" } */ + +int main() +{ + return 0; +} + +/* { dg-final { scan-assembler {\.arch armv8-a\+crypto\+crc\+dotprod\+sve2} } } */ + +/* Test a normal looking procinfo. */ diff --git a/gcc/testsuite/gcc.target/aarch64/cpunative/native_cpu_17.c b/gcc/testsuite/gcc.target/aarch64/cpunative/native_cpu_17.c new file mode 100644 index 0000000..c269c5f --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/cpunative/native_cpu_17.c @@ -0,0 +1,12 @@ +/* { dg-do compile { target { { aarch64*-*-linux*} && native } } } */ +/* { dg-set-compiler-env-var GCC_CPUINFO "$srcdir/gcc.target/aarch64/cpunative/info_17" } */ +/* { dg-additional-options "-march=native" } */ + +int main() +{ + return 0; +} + +/* { dg-final { scan-assembler {\.arch armv8-a\+crypto\+crc\+dotprod\+sve2} } } */ + +/* Test a normal looking procinfo. */ -- cgit v1.1 From ce81282261c6c77883b17d0ebfbbe337bed76457 Mon Sep 17 00:00:00 2001 From: Aldy Hernandez Date: Thu, 13 May 2021 16:09:58 -0400 Subject: Bail in bounds_of_var_in_loop if scev returns NULL. Both initial_condition_in_loop_num and evolution_part_in_loop_num can return NULL. This patch exits if either one is NULL. Presumably this didn't happen before, because adjust_range_with_scev was called far less frequently than in ranger, which can call it for every PHI. gcc/ChangeLog: PR tree-optimization/100349 * vr-values.c (bounds_of_var_in_loop): Bail if scev returns NULL. gcc/testsuite/ChangeLog: * gcc.dg/pr100349.c: New test. --- gcc/testsuite/gcc.dg/pr100349.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr100349.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/pr100349.c b/gcc/testsuite/gcc.dg/pr100349.c new file mode 100644 index 0000000..dd7977a --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr100349.c @@ -0,0 +1,16 @@ +// { dg-do compile } +// { dg-options "-O2 -w" } + +#include +uint8_t a; +b(int8_t c) { + int d; +e: + uint32_t f; + for (;;) + for (c = 10; c; c++) + if (0 > (a = c) ?: d) { + f = a; + goto e; + } +} -- cgit v1.1 From 09867aa0ef7568012650395189b735f9a34cf9b5 Mon Sep 17 00:00:00 2001 From: Harald Anlauf Date: Mon, 17 May 2021 21:35:38 +0200 Subject: PR fortran/98411 - Pointless warning for static variables Variables with explicit SAVE attribute cannot end up on the stack. There is no point in checking whether they should be moved off the stack to static storage. gcc/fortran/ChangeLog: PR fortran/98411 * trans-decl.c (gfc_finish_var_decl): Add check for explicit SAVE attribute. gcc/testsuite/ChangeLog: PR fortran/98411 * gfortran.dg/pr98411.f90: New test. --- gcc/testsuite/gfortran.dg/pr98411.f90 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/pr98411.f90 (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gfortran.dg/pr98411.f90 b/gcc/testsuite/gfortran.dg/pr98411.f90 new file mode 100644 index 0000000..249afae --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr98411.f90 @@ -0,0 +1,16 @@ +! { dg-do compile } +! { dg-options "-Wall -fautomatic -fmax-stack-var-size=100" } +! PR fortran/98411 - Pointless warning for static variables + +module try + implicit none + integer, save :: a(1000) +contains + subroutine initmodule + real, save :: b(1000) + logical :: c(1000) ! { dg-warning "moved from stack to static storage" } + a(1) = 42 + b(2) = 3.14 + c(3) = .true. + end subroutine initmodule +end module try -- cgit v1.1 From 5d93261bc03c9c6891ccd8c77ab22b2a09971905 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Mon, 17 May 2021 10:53:56 +0100 Subject: c++: Fix diagnostic for binding lvalue reference to volatile rvalue [PR 100635] The current diagnostic assumes the reference binding fails because the reference is non-const, but it can also fail if the rvalue is volatile. Use the current diagnostic for non-const cases, and a modified diagnostic otherwise. gcc/cp/ChangeLog: PR c++/100635 * call.c (convert_like_internal): Print different diagnostic if the lvalue reference is const. gcc/testsuite/ChangeLog: * g++.dg/conversion/pr100635.C: New test. --- gcc/testsuite/g++.dg/conversion/pr100635.C | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 gcc/testsuite/g++.dg/conversion/pr100635.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/conversion/pr100635.C b/gcc/testsuite/g++.dg/conversion/pr100635.C new file mode 100644 index 0000000..5841215 --- /dev/null +++ b/gcc/testsuite/g++.dg/conversion/pr100635.C @@ -0,0 +1,12 @@ +// PR c++/100635 +// { dg-do compile } +// { dg-additional-options "-Wno-volatile" { target c++2a } } + +struct S { }; +volatile S v(); +const volatile S& svol = v(); // { dg-error "cannot bind lvalue reference of type 'const volatile S&' to an rvalue of type 'volatile S'" } + +#if __cplusplus >= 201103L +volatile int&& declvol(); +const volatile int& voli = declvol(); // { dg-error "cannot bind lvalue reference of type 'const volatile int&' to an rvalue of type 'volatile int'" "" { target c++11} } +#endif -- cgit v1.1 From 3f476de7fd274f619a0b04c2e2f7077ee8ab17a5 Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Mon, 17 May 2021 15:53:39 -0400 Subject: Once a range becomes constant, make it invariant. Once a range is forced to a constant globally, simply make it invariant. Unify this with the code which makes non-zero pointer ranges invariant. gcc/ PR tree-optimization/100512 * gimple-range-cache.cc (ranger_cache::set_global_range): Mark const and non-zero pointer ranges as invariant. * gimple-range.cc (gimple_ranger::range_of_stmt): Remove pointer processing from here. gcc/testsuite/ PR tree-optimization/100512 * gcc.dg/pr100512.c: New. --- gcc/testsuite/gcc.dg/pr100512.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr100512.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/pr100512.c b/gcc/testsuite/gcc.dg/pr100512.c new file mode 100644 index 0000000..70b90e0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr100512.c @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -w" } */ + +#include +int a; +void b() { + int16_t *c; + uint16_t d = 2; + if (0 == d) { + uint64_t e; + uint64_t *f = &e; + for (;;) { + if (e += 0 >= 0) + for (;;) + ; + g: + for (; a;) { + int16_t i = &d; + *c = i && *f; + } + } + } + goto g; +} + -- cgit v1.1 From a7ffc1ef6e38c01037c8894a6bc1889d6f875444 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 18 May 2021 00:16:40 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 93 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 936f37a..9141534 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,96 @@ +2021-05-17 Andrew MacLeod + + PR tree-optimization/100512 + * gcc.dg/pr100512.c: New. + +2021-05-17 Jonathan Wakely + + * g++.dg/conversion/pr100635.C: New test. + +2021-05-17 Harald Anlauf + + PR fortran/98411 + * gfortran.dg/pr98411.f90: New test. + +2021-05-17 Aldy Hernandez + + * gcc.dg/pr100349.c: New test. + +2021-05-17 Tamar Christina + + * gcc.target/aarch64/cpunative/info_16: New test. + * gcc.target/aarch64/cpunative/info_17: New test. + * gcc.target/aarch64/cpunative/native_cpu_16.c: New test. + * gcc.target/aarch64/cpunative/native_cpu_17.c: New test. + +2021-05-17 Richard Biener + + PR c/100625 + * gcc.dg/gimplefe-error-9.c: New testcase. + +2021-05-17 Richard Biener + + PR middle-end/100582 + * gcc.target/i386/pr100582.c: New testcase. + +2021-05-17 Christophe Lyon + + * gcc.target/arm/simd/mve-compare-3.c: New test with GCC vectors. + * gcc.target/arm/simd/mve-vcmp-f16.c: New test for + auto-vectorization. + * gcc.target/arm/armv8_2-fp16-arith-1.c: Adjust since we now + vectorize float16_t vectors. + +2021-05-17 Christophe Lyon + + * gcc.target/arm/simd/mve-compare-1.c: New test with GCC vectors. + * gcc.target/arm/simd/mve-compare-2.c: New test with GCC vectors. + * gcc.target/arm/simd/mve-compare-scalar-1.c: New test with GCC + vectors. + * gcc.target/arm/simd/mve-vcmp-f32.c: New test for + auto-vectorization. + * gcc.target/arm/simd/mve-vcmp.c: New test for auto-vectorization. + +2021-05-17 liuhongt + + PR target/100549 + * gcc.target/i386/pr100549.c: New test. + +2021-05-17 Christophe Lyon + + * gcc.target/arm/simd/mve-vadd-scalar-1.c: New. + +2021-05-17 Christophe Lyon + + * gcc.target/arm/simd/mve-vadd-1.c: New. + +2021-05-17 Christophe Lyon + + * gcc.target/arm/simd/mve-vsub_1.c: Factorize and add __fp16 test. + +2021-05-17 Christophe Lyon + + * gcc.target/arm/simd/mve-vshr.c: Add more scan-assembler-times. + +2021-05-17 Christophe Lyon + + * gcc.target/arm/acle/saturation.c: Use arm_sat_ok effective + target. + * lib/target-supports.exp + (check_effective_target_arm_qbit_ok_nocache): Rename into... + (check_effective_target_arm_sat_ok_nocache): ... this. Check + __ARM_FEATURE_SAT and use armv6. + +2021-05-17 Tobias Burnus + + PR fortran/100633 + * gfortran.dg/gomp/workshare-59.f90: New test. + +2021-05-17 Christophe Lyon + + PR debug/100515 + * gcc.dg/debug/dwarf2/pr100515.c: Require openmp effective-target. + 2021-05-16 David Edelsohn * g++.dg/ext/attrib63.C: Add -Wno-psabi option. -- cgit v1.1 From 720dff974ea0487c35c0a4bfa527f30df5066ce1 Mon Sep 17 00:00:00 2001 From: Andreas Krebbel Date: Tue, 27 Apr 2021 10:09:06 +0200 Subject: PR100281 C++: Fix SImode pointer handling The problem appears to be triggered by two locations in the front-end where non-POINTER_SIZE pointers aren't handled right now. 1. An assertion in strip_typedefs is triggered because the alignment of the types don't match. This in turn is caused by creating the new type with build_pointer_type instead of taking the type of the original pointer into account. 2. An assertion in cp_convert_to_pointer is triggered which expects the target type to always have POINTER_SIZE. gcc/cp/ChangeLog: PR c++/100281 * cvt.c (cp_convert_to_pointer): Use the size of the target pointer type. * tree.c (cp_build_reference_type): Call cp_build_reference_type_for_mode with VOIDmode. (cp_build_reference_type_for_mode): Rename from cp_build_reference_type. Add MODE argument and invoke build_reference_type_for_mode. (strip_typedefs): Use build_pointer_type_for_mode and cp_build_reference_type_for_mode for pointers and references. gcc/ChangeLog: PR c++/100281 * tree.c (build_reference_type_for_mode) (build_pointer_type_for_mode): Pick pointer mode if MODE argument is VOIDmode. (build_reference_type, build_pointer_type): Invoke build_*_type_for_mode with VOIDmode. gcc/testsuite/ChangeLog: PR c++/100281 * g++.target/s390/pr100281-1.C: New test. * g++.target/s390/pr100281-2.C: New test. --- gcc/testsuite/g++.target/s390/pr100281-1.C | 10 ++++++++++ gcc/testsuite/g++.target/s390/pr100281-2.C | 9 +++++++++ 2 files changed, 19 insertions(+) create mode 100644 gcc/testsuite/g++.target/s390/pr100281-1.C create mode 100644 gcc/testsuite/g++.target/s390/pr100281-2.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.target/s390/pr100281-1.C b/gcc/testsuite/g++.target/s390/pr100281-1.C new file mode 100644 index 0000000..b82e27b --- /dev/null +++ b/gcc/testsuite/g++.target/s390/pr100281-1.C @@ -0,0 +1,10 @@ +// PR C++/100281 +// { dg-do compile } + +typedef void * __attribute__((mode (SI))) __ptr32_t; + +void foo () { + unsigned int b = 100; + __ptr32_t a; + a = b; /* { dg-error "invalid conversion from 'unsigned int' to '__ptr32_t'.*" } */ +} diff --git a/gcc/testsuite/g++.target/s390/pr100281-2.C b/gcc/testsuite/g++.target/s390/pr100281-2.C new file mode 100644 index 0000000..58552be --- /dev/null +++ b/gcc/testsuite/g++.target/s390/pr100281-2.C @@ -0,0 +1,9 @@ +// PR C++/100281 +// { dg-do compile } + +typedef int & __attribute__((mode (SI))) __ref32_t; + +void foo () { + unsigned int b = 100; + __ref32_t a = b; /* { dg-error "cannot bind non-const lvalue reference of type '__ref32_t'.*" } */ +} -- cgit v1.1 From 7e75d62442fc3707c96c53d22f6c185fdf893c72 Mon Sep 17 00:00:00 2001 From: Andreas Krebbel Date: Tue, 18 May 2021 08:51:08 +0200 Subject: IBM Z: Support vector _Bool language extension _Bool needs to be defined as macro in order to trigger the context-sensitive macro expansion mechanism. gcc/ChangeLog: * config/s390/s390-c.c (s390_cpu_cpp_builtins_internal): Define _Bool as macro expanding to _Bool. gcc/testsuite/ChangeLog: * gcc.target/s390/zvector/vec-_Bool.c: New test. --- gcc/testsuite/gcc.target/s390/zvector/vec-_Bool.c | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 gcc/testsuite/gcc.target/s390/zvector/vec-_Bool.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/s390/zvector/vec-_Bool.c b/gcc/testsuite/gcc.target/s390/zvector/vec-_Bool.c new file mode 100644 index 0000000..525b950 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/zvector/vec-_Bool.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-options "-march=z13 -mzvector" } */ + +vector _Bool char bc; +vector _Bool short int bs; +vector _Bool int bi; +vector _Bool long long bll; -- cgit v1.1 From 4054472b3fa15e11ccd48190f5e3ecfc89d65af9 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 12 May 2021 09:20:17 +0200 Subject: c/100547 - reject overly large vector_size attributes This rejects a number of vector components that does not fit an 'int' which is an internal limitation of RTVEC. This requires adjusting gcc.dg/attr-vector_size.c which checks for much larger supported vectors. Note that the RTVEC limitation is a host specific limitation (unless we change this 'int' to int32_t), but should be 32bits in practice everywhere. 2021-05-12 Richard Biener PR c/100547 gcc/c-family/ * c-attribs.c (type_valid_for_vector_size): Reject too large nunits. Reword existing nunit diagnostic. gcc/testsuite/ * gcc.dg/pr100547.c: New testcase. * gcc.dg/attr-vector_size.c: Adjust. --- gcc/testsuite/gcc.dg/attr-vector_size.c | 16 --------------- gcc/testsuite/gcc.dg/pr100547.c | 35 +++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 16 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pr100547.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/attr-vector_size.c b/gcc/testsuite/gcc.dg/attr-vector_size.c index 00be26a..3f2ce88 100644 --- a/gcc/testsuite/gcc.dg/attr-vector_size.c +++ b/gcc/testsuite/gcc.dg/attr-vector_size.c @@ -22,14 +22,6 @@ DEFVEC (extern, 30); #if __SIZEOF_SIZE_T__ > 4 -DEFVEC (extern, 31); -DEFVEC (extern, 32); -DEFVEC (extern, 33); -DEFVEC (extern, 34); -DEFVEC (extern, 60); -DEFVEC (extern, 61); -DEFVEC (extern, 62); - VEC (POW2 (63)) char v63; /* { dg-error "'vector_size' attribute argument value '9223372036854775808' exceeds 9223372036854775807" "LP64" { target lp64 } } */ #else @@ -49,14 +41,6 @@ void test_local_scope (void) #if __SIZEOF_SIZE_T__ > 4 - DEFVEC (auto, 31); - DEFVEC (auto, 32); - DEFVEC (auto, 33); - DEFVEC (auto, 34); - DEFVEC (auto, 60); - DEFVEC (auto, 61); - DEFVEC (auto, 62); - VEC (POW2 (63)) char v63; /* { dg-error "'vector_size' attribute argument value '9223372036854775808' exceeds 9223372036854775807" "LP64" { target lp64 } } */ #else diff --git a/gcc/testsuite/gcc.dg/pr100547.c b/gcc/testsuite/gcc.dg/pr100547.c new file mode 100644 index 0000000..2d3da4e --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr100547.c @@ -0,0 +1,35 @@ +/* { dg-do compile { target lp64 } } */ +/* { dg-options "-O -g" } */ + +typedef int __attribute__((vector_size( + ((((((((((((((((((((((((((((((8 * sizeof(short)) * sizeof(short)) * + sizeof(short)) * + sizeof(short)) * + sizeof(short)) * + sizeof(short)) * + sizeof(short)) * + sizeof(short)) * + sizeof(short)) * + sizeof(short)) * + sizeof(short)) * + sizeof(short)) * + sizeof(short)) * + sizeof(short)) * + sizeof(short)) * + sizeof(short)) * + sizeof(short)) * + sizeof(short)) * + sizeof(short)) * + sizeof(short)) * + sizeof(short)) * + sizeof(short)) * + sizeof(short)) * + sizeof(short)) * + sizeof(short)) * + sizeof(short)) * + sizeof(short)) * + sizeof(short)) * + sizeof(short)) * + sizeof(short)) * + sizeof(short)))) V; /* { dg-error "number of vector components" } */ +void k() { V w = { 0 }; } -- cgit v1.1 From 414fe08a352eac69168f4fb3671246c84a1ac5aa Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 18 May 2021 08:41:43 +0200 Subject: c/100522 - avoid invalid GIMPLE in GIMPLE parsing This plugs a few easy holes avoiding ICEs down the route. 2021-05-18 Richard Biener PR c/100522 gcc/c/ * gimple-parser.c (c_parser_gimple_postfix_expression_after_primary): Diagnose calls to non-functions. (c_parser_gimple_statement): Diagnose unexpected assignment RHS. gcc/testsuite/ * gcc.dg/gimplefe-error-10.c: New testcase. --- gcc/testsuite/gcc.dg/gimplefe-error-10.c | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/gimplefe-error-10.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/gimplefe-error-10.c b/gcc/testsuite/gcc.dg/gimplefe-error-10.c new file mode 100644 index 0000000..13d86ac --- /dev/null +++ b/gcc/testsuite/gcc.dg/gimplefe-error-10.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-fgimple" } */ + +__GIMPLE +void foo() { + int t1; + t1_1 = t1_1(); /* { dg-error "invalid call" } */ +} -- cgit v1.1 From 1e07091de3636e9f88b313b52935457b0e2fe07e Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 18 May 2021 08:48:57 +0200 Subject: Fix gcc.target/i386/pr100582.c with AVX512 Which generates vpblendmb. 2021-05-18 Richard Biener gcc/testsuite/ * gcc.target/i386/pr100582.c: Adjust for AVX512. --- gcc/testsuite/gcc.target/i386/pr100582.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/i386/pr100582.c b/gcc/testsuite/gcc.target/i386/pr100582.c index 9520fe7..1a8e9eb 100644 --- a/gcc/testsuite/gcc.target/i386/pr100582.c +++ b/gcc/testsuite/gcc.target/i386/pr100582.c @@ -6,11 +6,11 @@ typedef unsigned char v32qi __attribute__((vector_size(32))); v32qi f2 (v32qi x, v32qi a, v32qi b) { - v32qi e; + v32qi e; for (int i = 0; i != 32; i++) - e[i] = x[i] ? a[i] : b[i]; + e[i] = x[i] ? a[i] : b[i]; return e; } -/* { dg-final { scan-assembler-times "pblendvb" 1 } } */ +/* { dg-final { scan-assembler-times "pblend" 1 } } */ -- cgit v1.1 From 65061ea287a80cfb214e402cfd2373a14bfec95a Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 18 May 2021 10:08:51 +0200 Subject: phiopt: Optimize partial_ordering spaceship >= 0 -ffinite-math-only [PR94589] As mentioned earlier, spaceship_replacement didn't optimize partial_ordering >= 0 comparisons, because the possible values are -1, 0, 1, 2 and the >= comparison is implemented as (res & 1) == res to choose the 0 and 1 cases from that. As we optimize that only with -ffinite-math-only, the 2 case is assumed not to happen and my earlier match.pd change optimizes (res & 1) == res into (res & ~1) == 0, so this patch pattern matches that case and handles it like res >= 0. 2021-05-18 Jakub Jelinek PR tree-optimization/94589 * tree-ssa-phiopt.c (spaceship_replacement): Pattern match phi result used in (res & ~1) == 0 comparison as res >= 0 as res == 2 would be UB with -ffinite-math-only. * g++.dg/opt/pr94589-2.C: Adjust scan-tree-dump count from 14 to 12. --- gcc/testsuite/g++.dg/opt/pr94589-2.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/opt/pr94589-2.C b/gcc/testsuite/g++.dg/opt/pr94589-2.C index dda947e..e9ef84b 100644 --- a/gcc/testsuite/g++.dg/opt/pr94589-2.C +++ b/gcc/testsuite/g++.dg/opt/pr94589-2.C @@ -1,8 +1,8 @@ // PR tree-optimization/94589 // { dg-do compile { target c++20 } } // { dg-options "-O2 -g0 -ffast-math -fdump-tree-optimized" } -// { dg-final { scan-tree-dump-times "\[ij]_\[0-9]+\\(D\\) (?:<|<=|==|!=|>|>=) \[ij]_\[0-9]+\\(D\\)" 14 "optimized" } } -// { dg-final { scan-tree-dump-times "i_\[0-9]+\\(D\\) (?:<|<=|==|!=|>|>=) 5\\.0" 14 "optimized" } } +// { dg-final { scan-tree-dump-times "\[ij]_\[0-9]+\\(D\\) (?:<|<=|==|!=|>|>=) \[ij]_\[0-9]+\\(D\\)" 12 "optimized" } } +// { dg-final { scan-tree-dump-times "i_\[0-9]+\\(D\\) (?:<|<=|==|!=|>|>=) 5\\.0" 12 "optimized" } } #include -- cgit v1.1 From 978b62e554ffb4b34844c72d259ce71fcbd87591 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 18 May 2021 10:10:17 +0200 Subject: function: Set dummy DECL_ASSEMBLER_NAME in push_dummy_function [PR100580] Last year I've added cgraph_node::get_create calls for the dummy functions used for -fdump-passes, so that it interacts well with pass disabling/enabling which is cgraph uid based. Unfortunately, as the following testcase shows, when assembler hash is present, that wants to compute DECL_ASSEMBLER_NAME and the C++ FE is unprepared to handle it on the dummy functions which don't have DECL_NAME etc. The following patch fixes it by setting up a dummy DECL_ASSEMBLER_NAME on these, so that the FEs don't need to compute it. 2021-05-18 Jakub Jelinek PR c++/100580 * function.c (push_dummy_function): Set DECL_ARTIFICIAL and DECL_ASSEMBLER_NAME on the fn_decl. * g++.dg/other/pr100580.C: New test. --- gcc/testsuite/g++.dg/other/pr100580.C | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 gcc/testsuite/g++.dg/other/pr100580.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/other/pr100580.C b/gcc/testsuite/g++.dg/other/pr100580.C new file mode 100644 index 0000000..d6cc0a6 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/pr100580.C @@ -0,0 +1,8 @@ +// PR c++/100580 +// { dg-do compile } +// { dg-require-weak "" } +// { dg-options "-fdump-passes" } +// { dg-prune-output ".*" } + +int foo; +static __typeof(foo) bar __attribute__((__weakref__("foo"))); -- cgit v1.1 From c81704b359283bb54696755ead881ab04136da94 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 18 May 2021 10:26:45 +0200 Subject: regcprop: Avoid DCE of asm goto [PR100590] The following testcase ICEs, because copyprop_hardreg_forward_1 decides to DCE asm goto with REG_UNUSED notes (because the output is unused and asm isn't volatile). But that DCE just removes the asm goto, leaving a bb with two successors and no insn at the end that would allow that. The following patch makes sure we drop that way only INSNs and not JUMP_INSNs or CALL_INSNs. 2021-05-18 Jakub Jelinek PR rtl-optimization/100590 * regcprop.c (copyprop_hardreg_forward_1): Only DCE dead sets if they are NONJUMP_INSN_P. * gcc.dg/pr100590.c: New test. --- gcc/testsuite/gcc.dg/pr100590.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr100590.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/pr100590.c b/gcc/testsuite/gcc.dg/pr100590.c new file mode 100644 index 0000000..5cd3687 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr100590.c @@ -0,0 +1,13 @@ +/* PR rtl-optimization/100590 */ +/* { dg-do compile } */ +/* { dg-options "-O1 -fno-dce -w" } */ + +int +foo (void) +{ + int x; + asm goto ("" : "+r" (x) : : : lab); + return 0; + lab: + return 1; +} -- cgit v1.1 From 03eb779141a29f96600cd46904b88a33c4b49a66 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Thu, 6 May 2021 11:59:42 +0200 Subject: Add 'dg-note', 'dg-lto-note' That's 'dg-message "note: [...]"' with a twist: inhibit default notes pruning, such that "if 'dg-note' is used at least once in a testcase, [notes] are not pruned and instead must *all* be handled explicitly". The rationale is that either you're not interested in notes at all (default behavior of pruning all notes), but often, when you're interested in one note, you're in fact interested in all notes, and especially interested if *additional* notes appear over time, as GCC evolves. gcc/testsuite/ * lib/gcc-dg.exp: Implement 'dg-note'. * lib/prune.exp: Likewise. * gcc.dg/vect/nodump-vect-opt-info-2.c: Use 'dg-note', and 'dg-prune-output "note: ". * gfortran.dg/goacc/routine-external-level-of-parallelism-2.f: Use 'dg-note', match up additional notes, one class of them with XFAILed 'dg-bogus'. * lib/lto.exp: Implement 'dg-lto-note'. * g++.dg/lto/odr-1_0.C: Use 'dg-lto-note', match up additional notes. * g++.dg/lto/odr-1_1.C: Likewise. * g++.dg/lto/odr-2_1.C: Likewise. libstdc++-v3/ * testsuite/lib/prune.exp: Add note about 'dg-note'. gcc/ * doc/sourcebuild.texi: Document 'dg-note'. --- gcc/testsuite/g++.dg/lto/odr-1_0.C | 4 ++- gcc/testsuite/g++.dg/lto/odr-1_1.C | 9 +++--- gcc/testsuite/g++.dg/lto/odr-2_1.C | 2 +- gcc/testsuite/gcc.dg/vect/nodump-vect-opt-info-2.c | 4 ++- .../routine-external-level-of-parallelism-2.f | 26 ++++++++++++++++++ gcc/testsuite/lib/gcc-dg.exp | 32 ++++++++++++++++++++++ gcc/testsuite/lib/lto.exp | 22 +++++++++++---- gcc/testsuite/lib/prune.exp | 7 +++-- 8 files changed, 92 insertions(+), 14 deletions(-) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/lto/odr-1_0.C b/gcc/testsuite/g++.dg/lto/odr-1_0.C index 6fff888..318a047 100644 --- a/gcc/testsuite/g++.dg/lto/odr-1_0.C +++ b/gcc/testsuite/g++.dg/lto/odr-1_0.C @@ -1,8 +1,10 @@ // PR c++/82414 // { dg-lto-do link } enum vals {aa,cc}; // { dg-lto-warning "6: type 'vals' violates the C\\+\\+ One Definition Rule" } +// { dg-lto-note "name 'cc' differs from name 'bb' defined in another translation unit" "" { target *-*-* } .-1 } struct a { // { dg-lto-warning "8: type 'struct a' violates the C\\+\\+ One Definition Rule" } - struct b *ptr; // { dg-lto-message "13: the first difference of corresponding definitions is field 'ptr'" } + struct b *ptr; // { dg-lto-note "13: the first difference of corresponding definitions is field 'ptr'" } + // { dg-lto-note "the incompatible type defined in another translation unit" "" { target *-*-* } .-1 } enum vals vals; }; void test(struct a *a) diff --git a/gcc/testsuite/g++.dg/lto/odr-1_1.C b/gcc/testsuite/g++.dg/lto/odr-1_1.C index 494436a..a57bb38 100644 --- a/gcc/testsuite/g++.dg/lto/odr-1_1.C +++ b/gcc/testsuite/g++.dg/lto/odr-1_1.C @@ -1,9 +1,10 @@ namespace { - struct b; // { dg-lto-message "type 'struct b' defined in anonymous namespace cannot match across the translation unit boundary" } + struct b; // { dg-lto-note "type 'struct b' defined in anonymous namespace cannot match across the translation unit boundary" } } -enum vals {aa,bb,cc}; // { dg-lto-message "an enum with different value name is defined in another translation unit" } -struct a { // { dg-lto-message "a different type is defined in another translation unit" } - struct b *ptr; // { dg-lto-message "a field of same name but different type is defined in another translation unit" } +enum vals {aa,bb,cc}; // { dg-lto-note "an enum with different value name is defined in another translation unit" } +// { dg-lto-note "mismatching definition" "" { target *-*-* } .-1 } +struct a { // { dg-lto-note "a different type is defined in another translation unit" } + struct b *ptr; // { dg-lto-note "a field of same name but different type is defined in another translation unit" } enum vals vals; } a; void test(struct a *); diff --git a/gcc/testsuite/g++.dg/lto/odr-2_1.C b/gcc/testsuite/g++.dg/lto/odr-2_1.C index f384ae8..23cfccc 100644 --- a/gcc/testsuite/g++.dg/lto/odr-2_1.C +++ b/gcc/testsuite/g++.dg/lto/odr-2_1.C @@ -1,4 +1,4 @@ -class a { // { dg-lto-message "a different type is defined in another translation unit" } +class a { // { dg-lto-note "a different type is defined in another translation unit" } int *b() const; }; int *a::b() const { return 0; } diff --git a/gcc/testsuite/gcc.dg/vect/nodump-vect-opt-info-2.c b/gcc/testsuite/gcc.dg/vect/nodump-vect-opt-info-2.c index 23a3b39..bcdf7f0 100644 --- a/gcc/testsuite/gcc.dg/vect/nodump-vect-opt-info-2.c +++ b/gcc/testsuite/gcc.dg/vect/nodump-vect-opt-info-2.c @@ -3,7 +3,9 @@ extern void accumulate (int x, int *a); -int test_missing_function_defn (int *arr, int n) /* { dg-message "vectorized 0 loops in function" } */ +int test_missing_function_defn (int *arr, int n) /* { dg-note "5: vectorized 0 loops in function" } */ +/* { dg-prune-output "note: " } as we're not interested in matching any further + notes. */ { int sum = 0; for (int i = 0; i < n; ++i) /* { dg-missed "21: couldn't vectorize loop" } */ diff --git a/gcc/testsuite/gfortran.dg/goacc/routine-external-level-of-parallelism-2.f b/gcc/testsuite/gfortran.dg/goacc/routine-external-level-of-parallelism-2.f index 0e8dfb1..04d507f 100644 --- a/gcc/testsuite/gfortran.dg/goacc/routine-external-level-of-parallelism-2.f +++ b/gcc/testsuite/gfortran.dg/goacc/routine-external-level-of-parallelism-2.f @@ -22,6 +22,8 @@ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 } do j = 1, n call workerr (a, n) ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" } +! { dg-bogus "note: routine 'workerr' declared here" "TODO" { xfail { ! offloading_enabled } } .-1 } +! { dg-bogus "note: routine 'workerr_' declared here" "TODO" { xfail offloading_enabled } .-2 } end do end do !$acc end parallel loop @@ -30,9 +32,12 @@ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 } do i = 1, n !$acc loop gang ! { dg-message "optimized: assigned OpenACC gang loop parallelism" } +! { dg-note "containing loop here" "" { target *-*-* } .-1 } do j = 1, n call gangr (a, n) ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" } ! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } +! { dg-bogus "note: routine 'gangr' declared here" "TODO" { xfail { ! offloading_enabled } } .-2 } +! { dg-bogus "note: routine 'gangr_' declared here" "TODO" { xfail offloading_enabled } .-3 } end do end do !$acc end parallel loop @@ -83,6 +88,7 @@ !$acc end parallel loop !$acc parallel loop gang ! { dg-message "optimized: assigned OpenACC gang loop parallelism" } +! { dg-note "containing loop here" "" { target *-*-* } .-1 } do i = 1, n call gangr (a, n) ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" } ! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } @@ -90,6 +96,7 @@ !$acc end parallel loop !$acc parallel loop worker ! { dg-message "optimized: assigned OpenACC worker loop parallelism" } +! { dg-note "containing loop here" "" { target *-*-* } .-1 } do i = 1, n call gangr (a, n) ! { dg-message "optimized: assigned OpenACC gang vector loop parallelism" } ! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } @@ -97,6 +104,7 @@ !$acc end parallel loop !$acc parallel loop vector ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } +! { dg-note "containing loop here" "" { target *-*-* } .-1 } do i = 1, n call gangr (a, n) ! { dg-message "optimized: assigned OpenACC gang worker loop parallelism" } ! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } @@ -126,6 +134,7 @@ !$acc end parallel loop !$acc parallel loop worker ! { dg-message "optimized: assigned OpenACC worker loop parallelism" } +! { dg-note "containing loop here" "" { target *-*-* } .-1 } do i = 1, n call workerr (a, n) ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } ! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } @@ -133,6 +142,7 @@ !$acc end parallel loop !$acc parallel loop vector ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } +! { dg-note "containing loop here" "" { target *-*-* } .-1 } do i = 1, n call workerr (a, n) ! { dg-message "optimized: assigned OpenACC worker loop parallelism" } ! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } @@ -152,6 +162,8 @@ !$acc parallel loop ! { dg-message "optimized: assigned OpenACC gang worker loop parallelism" } do i = 1, n call vectorr (a, n) ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } +! { dg-bogus "note: routine 'vectorr' declared here" "TODO" { xfail { ! offloading_enabled } } .-1 } +! { dg-bogus "note: routine 'vectorr_' declared here" "TODO" { xfail offloading_enabled } .-2 } end do !$acc end parallel loop @@ -168,6 +180,7 @@ !$acc end parallel loop !$acc parallel loop vector ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } +! { dg-note "containing loop here" "" { target *-*-* } .-1 } do i = 1, n call vectorr (a, n) ! { dg-message "optimized: assigned OpenACC seq loop parallelism" } ! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } @@ -201,6 +214,8 @@ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 } do j = 1, n a(i) = workerf (a, n) ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" } +! { dg-bogus "note: routine 'workerf' declared here" "TODO" { xfail { ! offloading_enabled } } .-1 } +! { dg-bogus "note: routine 'workerf_' declared here" "TODO" { xfail offloading_enabled } .-2 } end do end do !$acc end parallel loop @@ -209,9 +224,12 @@ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 } do i = 1, n !$acc loop gang ! { dg-message "optimized: assigned OpenACC gang loop parallelism" } +! { dg-note "containing loop here" "" { target *-*-* } .-1 } do j = 1, n a(i) = gangf (a, n) ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" } ! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } +! { dg-bogus "note: routine 'gangf' declared here" "TODO" { xfail { ! offloading_enabled } } .-2 } +! { dg-bogus "note: routine 'gangf_' declared here" "TODO" { xfail offloading_enabled } .-3 } end do end do !$acc end parallel loop @@ -262,6 +280,7 @@ !$acc end parallel loop !$acc parallel loop gang ! { dg-message "optimized: assigned OpenACC gang loop parallelism" } +! { dg-note "containing loop here" "" { target *-*-* } .-1 } do i = 1, n a(i) = gangf (a, n) ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" } ! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } @@ -269,6 +288,7 @@ !$acc end parallel loop !$acc parallel loop worker ! { dg-message "optimized: assigned OpenACC worker loop parallelism" } +! { dg-note "containing loop here" "" { target *-*-* } .-1 } do i = 1, n a(i) = gangf (a, n) ! { dg-message "optimized: assigned OpenACC gang vector loop parallelism" } ! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } @@ -276,6 +296,7 @@ !$acc end parallel loop !$acc parallel loop vector ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } +! { dg-note "containing loop here" "" { target *-*-* } .-1 } do i = 1, n a(i) = gangf (a, n) ! { dg-message "optimized: assigned OpenACC gang worker loop parallelism" } ! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } @@ -305,6 +326,7 @@ !$acc end parallel loop !$acc parallel loop worker ! { dg-message "optimized: assigned OpenACC worker loop parallelism" } +! { dg-note "containing loop here" "" { target *-*-* } .-1 } do i = 1, n a(i) = workerf (a, n) ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } ! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } @@ -312,6 +334,7 @@ !$acc end parallel loop !$acc parallel loop vector ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } +! { dg-note "containing loop here" "" { target *-*-* } .-1 } do i = 1, n a(i) = workerf (a, n) ! { dg-message "optimized: assigned OpenACC worker loop parallelism" } ! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } @@ -331,6 +354,8 @@ !$acc parallel loop ! { dg-message "optimized: assigned OpenACC gang worker loop parallelism" } do i = 1, n a(i) = vectorf (a, n) ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } +! { dg-bogus "note: routine 'vectorf' declared here" "TODO" { xfail { ! offloading_enabled } } .-1 } +! { dg-bogus "note: routine 'vectorf_' declared here" "TODO" { xfail offloading_enabled } .-2 } end do !$acc end parallel loop @@ -347,6 +372,7 @@ !$acc end parallel loop !$acc parallel loop vector ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } +! { dg-note "containing loop here" "" { target *-*-* } .-1 } do i = 1, n a(i) = vectorf (a, n) ! { dg-message "optimized: assigned OpenACC seq loop parallelism" } ! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp index e48a184..fce0989 100644 --- a/gcc/testsuite/lib/gcc-dg.exp +++ b/gcc/testsuite/lib/gcc-dg.exp @@ -1012,6 +1012,8 @@ if { [info procs saved-dg-test] == [list] } { } unset save_linenr_varnames } + + initialize_prune_notes } proc dg-test { args } { @@ -1245,6 +1247,36 @@ proc dg-missed { args } { process-message saved-dg-warning "missed:" "$args" } +# Look for messages with 'note: ' prefixes. +# In addition to standard compiler diagnostics ('DK_NOTE', 'inform' functions, +# "for additional details on an error message"), +# this also includes output from '-fopt-info' for 'MSG_NOTE': +# a general optimization info. +# By default, any *excess* notes are pruned, meaning their appearance doesn't +# trigger *excess errors*. However, if 'dg-note' is used at least once in a +# testcase, they're not pruned and instead must *all* be handled explicitly. +# Thus, if looking for just single instances of messages with 'note: ' prefixes +# without caring for all of them, use 'dg-message "note: [...]"' instead of +# 'dg-note', or use 'dg-note' together with 'dg-prune-output "note: "'. + +variable prune_notes + +proc initialize_prune_notes { } { + global prune_notes + set prune_notes 1 +} + +initialize_prune_notes + +proc dg-note { args } { + upvar dg-messages dg-messages + + global prune_notes + set prune_notes 0 + + process-message saved-dg-warning "note:" "$args" +} + # Check the existence of a gdb in the path, and return true if there # is one. # diff --git a/gcc/testsuite/lib/lto.exp b/gcc/testsuite/lib/lto.exp index 77919e8..d0e0dc6 100644 --- a/gcc/testsuite/lib/lto.exp +++ b/gcc/testsuite/lib/lto.exp @@ -161,9 +161,13 @@ proc lto_prune_warns { text } { # Ignore missing jobserver for tests that do more than 1 LTRANS unit regsub -all "(^|\n)\[^\n\]*: warning: using serial compilation of \[^\n\]*" $text "" text + regsub -all "(^|\n)\[^\n\]*: note: see the \[^\n\]*'-flto' option documentation\[^\n\]* for more information" $text "" text - # Ignore informational notes. - regsub -all "(^|\n)\[^\n\]*: note: \[^\n\]*" $text "" text + global prune_notes + if { $prune_notes } { + # Ignore informational notes. + regsub -all "(^|\n)\[^\n\]*: note: \[^\n\]*" $text "" text + } verbose "lto_prune_warns: exit: $text" 2 @@ -390,8 +394,8 @@ proc lto-can-handle-directive { op } { # A list of directives to recognize, and a list of directives # to remap them to. # For example, "dg-lto-warning" is implemented by calling "dg-warning". - set directives { dg-lto-warning dg-lto-message } - set remapped_directives { dg-warning dg-message } + set directives { dg-lto-warning dg-lto-message dg-lto-note } + set remapped_directives { dg-warning dg-message dg-note } set idx [lsearch -exact $directives $cmd] if { $idx != -1 } { @@ -597,7 +601,7 @@ proc lto-get-options { src } { # # SRC1 is the full pathname of the main file of the testcase. # SID identifies a test suite in the names of temporary files. -proc lto-execute { src1 sid } { +proc lto-execute-1 { src1 sid } { global srcdir tmpdir global lto_option_list global tool @@ -811,6 +815,14 @@ proc lto-execute { src1 sid } { } } +proc lto-execute { src1 sid } { + lto-execute-1 $src1 $sid + + # LTO testing doesn't use 'dg-runtest'/'dg-test', and thus doesn't call + # 'cleanup-after-saved-dg-test', so we have to clean up manually. + initialize_prune_notes +} + # Call pass if object readelf is ok, otherwise fail. # example: /* { dg-final { object-readelf Tag_ABI_enum_size int} } */ proc object-readelf { args } { diff --git a/gcc/testsuite/lib/prune.exp b/gcc/testsuite/lib/prune.exp index 2809f88..91f165b 100644 --- a/gcc/testsuite/lib/prune.exp +++ b/gcc/testsuite/lib/prune.exp @@ -54,8 +54,11 @@ proc prune_gcc_output { text } { regsub -all "(^|\n)\[ \]+from \[^\n\]*" $text "" text regsub -all "(^|\n)(In|of) module( \[^\n \]*,)? imported at \[^\n\]*" $text "" text - # Ignore informational notes. - regsub -all "(^|\n)\[^\n\]*: note: \[^\n\]*" $text "" text + global prune_notes + if { $prune_notes } { + # Ignore informational notes. + regsub -all "(^|\n)\[^\n\]*: note: \[^\n\]*" $text "" text + } # Ignore harmless -fpic warnings. regsub -all "(^|\n)\[^\n\]*: warning: -f(pic|PIC) ignored for target\[^\n\]*" $text "" text -- cgit v1.1 From cc193ac840d58ee0ffb57b14b542706cde3db0e7 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Tue, 18 May 2021 16:40:45 +0200 Subject: Fortran/OpenMP: Add missing EXEC_OMP_DEPOBJ case val [PR100642] PR fortran/100642 gcc/fortran/ChangeLog: * openmp.c (omp_code_to_statement): Add missing EXEC_OMP_DEPOBJ. gcc/testsuite/ChangeLog: * gfortran.dg/goacc-gomp/depobj.f90: New test. --- gcc/testsuite/gfortran.dg/goacc-gomp/depobj.f90 | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/goacc-gomp/depobj.f90 (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gfortran.dg/goacc-gomp/depobj.f90 b/gcc/testsuite/gfortran.dg/goacc-gomp/depobj.f90 new file mode 100644 index 0000000..e1c6830 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc-gomp/depobj.f90 @@ -0,0 +1,11 @@ +! PR fortran/100642 +! Contributed by G. Steinmetz +program p + !use omp_lib, only: omp_depend_kind + use iso_c_binding, only: c_intptr_t + integer, parameter :: omp_depend_kind = 2*c_intptr_t + integer(omp_depend_kind) :: a, b + !$acc data + !$omp depobj(b) depend(out:a) ! { dg-error "The !\\\$OMP DEPOBJ directive cannot be specified within a !\\\$ACC DATA region" } + !$acc end data +end -- cgit v1.1 From 46ca31d65092e5afcef292f807fcf14c5363280d Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Tue, 18 May 2021 17:25:54 +0200 Subject: i386: Implement 4-byte vector support [PR100637] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add infrastructure, logic and arithmetic support for 4-byte vectors. These can be used with SSE2 targets, where movd instructions from/to XMM registers are available. x86_64 ABI passes 4-byte vectors in integer registers, so also add logic operations with integer registers. 2021-05-18 UroÅ¡ Bizjak gcc/ PR target/100637 * config/i386/i386.h (VALID_SSE2_REG_MODE): Add V4QI and V2HI modes. (VALID_INT_MODE_P): Ditto. * config/i386/mmx.md (VI_32): New mode iterator. (mmxvecsize): Handle V4QI and V2HI. (Yv_Yw): Ditto. (mov): New expander. (*mov_internal): New insn pattern. (movmisalign): New expander. (neg): New expander. (3): New expander. (*3): New insn pattern. (mulv2hi3): New expander. (*mulv2hi3): New insn pattern. (one_cmpl2): New expander. (*andnot3): New insn pattern. (3): New expander. (*3): New insn pattern. gcc/testsuite/ PR target/100637 * gcc.target/i386/pr100637-1b.c: New test. * gcc.target/i386/pr100637-1w.c: Ditto. * gcc.target/i386/pr92658-avx2-2.c: Do not XFAIL scan for pmovsxbq. * gcc.target/i386/pr92658-avx2.c: Do not XFAIL scan for pmovzxbq. * gcc.target/i386/pr92658-avx512vl.c: Do not XFAIL scan for vpmovdb. * gcc.target/i386/pr92658-sse4-2.c: Do not XFAIL scan for pmovsxbd and pmovsxwq. * gcc.target/i386/pr92658-sse4.c: Do not XFAIL scan for pmovzxbd and pmovzxwq. --- gcc/testsuite/gcc.target/i386/pr100637-1b.c | 25 +++++++++++++++++++++ gcc/testsuite/gcc.target/i386/pr100637-1w.c | 28 ++++++++++++++++++++++++ gcc/testsuite/gcc.target/i386/pr92658-avx2-2.c | 2 +- gcc/testsuite/gcc.target/i386/pr92658-avx2.c | 2 +- gcc/testsuite/gcc.target/i386/pr92658-avx512vl.c | 2 +- gcc/testsuite/gcc.target/i386/pr92658-sse4-2.c | 4 ++-- gcc/testsuite/gcc.target/i386/pr92658-sse4.c | 4 ++-- 7 files changed, 60 insertions(+), 7 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr100637-1b.c create mode 100644 gcc/testsuite/gcc.target/i386/pr100637-1w.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/i386/pr100637-1b.c b/gcc/testsuite/gcc.target/i386/pr100637-1b.c new file mode 100644 index 0000000..3e7445a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr100637-1b.c @@ -0,0 +1,25 @@ +/* PR target/100637 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -msse2 -dp" } */ + +typedef char __v4qi __attribute__ ((__vector_size__ (4))); + +__v4qi and (__v4qi a, __v4qi b) { return a & b; }; +/* { dg-final { scan-assembler "andv4qi3" } } */ + +__v4qi andn (__v4qi a, __v4qi b) { return a & ~b; }; +/* { dg-final { scan-assembler "andnotv4qi3" } } */ + +__v4qi or (__v4qi a, __v4qi b) { return a | b; }; +/* { dg-final { scan-assembler "iorv4qi3" } } */ + +__v4qi xor (__v4qi a, __v4qi b) { return a ^ b; }; +__v4qi not (__v4qi a) { return ~a; }; +/* { dg-final { scan-assembler-times "xorv4qi3" 2 } } */ + +__v4qi plus (__v4qi a, __v4qi b) { return a + b; }; +/* { dg-final { scan-assembler "addv4qi3" } } */ + +__v4qi minus (__v4qi a, __v4qi b) { return a - b; }; +__v4qi neg (__v4qi a) { return -a; }; +/* { dg-final { scan-assembler-times "subv4qi3" 2 } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr100637-1w.c b/gcc/testsuite/gcc.target/i386/pr100637-1w.c new file mode 100644 index 0000000..ed1baeb --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr100637-1w.c @@ -0,0 +1,28 @@ +/* PR target/100637 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -msse2 -dp" } */ + +typedef short __v2hi __attribute__ ((__vector_size__ (4))); + +__v2hi and (__v2hi a, __v2hi b) { return a & b; }; +/* { dg-final { scan-assembler "andv2hi3" } } */ + +__v2hi andn (__v2hi a, __v2hi b) { return a & ~b; }; +/* { dg-final { scan-assembler "andnotv2hi3" } } */ + +__v2hi or (__v2hi a, __v2hi b) { return a | b; }; +/* { dg-final { scan-assembler "iorv2hi3" } } */ + +__v2hi xor (__v2hi a, __v2hi b) { return a ^ b; }; +__v2hi not (__v2hi a) { return ~a; }; +/* { dg-final { scan-assembler-times "xorv2hi3" 2 } } */ + +__v2hi plus (__v2hi a, __v2hi b) { return a + b; }; +/* { dg-final { scan-assembler "addv2hi3" } } */ + +__v2hi minus (__v2hi a, __v2hi b) { return a - b; }; +__v2hi neg (__v2hi a) { return -a; }; +/* { dg-final { scan-assembler-times "subv2hi3" 2 } } */ + +__v2hi mul (__v2hi a, __v2hi b) { return a * b; }; +/* { dg-final { scan-assembler "mulv2hi3" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr92658-avx2-2.c b/gcc/testsuite/gcc.target/i386/pr92658-avx2-2.c index 7aad858..6c30702 100644 --- a/gcc/testsuite/gcc.target/i386/pr92658-avx2-2.c +++ b/gcc/testsuite/gcc.target/i386/pr92658-avx2-2.c @@ -109,7 +109,7 @@ bar_s8_s64 (v4di * dst, v32qi src) dst[0] = *(v4di *) tem; } -/* { dg-final { scan-assembler-times "pmovsxbq" 2 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "pmovsxbq" 2 } } */ void foo_s16_s32 (v8si * dst, v16hi * __restrict src) diff --git a/gcc/testsuite/gcc.target/i386/pr92658-avx2.c b/gcc/testsuite/gcc.target/i386/pr92658-avx2.c index 21fa3e5..70b5bdb 100644 --- a/gcc/testsuite/gcc.target/i386/pr92658-avx2.c +++ b/gcc/testsuite/gcc.target/i386/pr92658-avx2.c @@ -109,7 +109,7 @@ bar_u8_u64 (v4di * dst, v32qi src) dst[0] = *(v4di *) tem; } -/* { dg-final { scan-assembler-times "pmovzxbq" 2 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "pmovzxbq" 2 } } */ void foo_u16_u32 (v8si * dst, v16hi * __restrict src) diff --git a/gcc/testsuite/gcc.target/i386/pr92658-avx512vl.c b/gcc/testsuite/gcc.target/i386/pr92658-avx512vl.c index dc50084..a9f7d7e 100644 --- a/gcc/testsuite/gcc.target/i386/pr92658-avx512vl.c +++ b/gcc/testsuite/gcc.target/i386/pr92658-avx512vl.c @@ -126,4 +126,4 @@ truncdb_128 (v16qi * dst, v4si * __restrict src) /* { dg-final { scan-assembler-times "vpmovqb" 2 { xfail *-*-* } } } */ /* { dg-final { scan-assembler-times "vpmovdw" 1 } } */ /* { dg-final { scan-assembler-times "vpmovdw" 2 { xfail *-*-* } } } */ -/* { dg-final { scan-assembler-times "vpmovdb" 2 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "vpmovdb" 2 } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr92658-sse4-2.c b/gcc/testsuite/gcc.target/i386/pr92658-sse4-2.c index ca174ce..53e89ad 100644 --- a/gcc/testsuite/gcc.target/i386/pr92658-sse4-2.c +++ b/gcc/testsuite/gcc.target/i386/pr92658-sse4-2.c @@ -61,7 +61,7 @@ bar_s8_s32 (v4si * dst, v16qi src) dst[0] = *(v4si *) tem; } -/* { dg-final { scan-assembler-times "pmovsxbd" 2 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "pmovsxbd" 2 } } */ void foo_s8_s64 (v2di * dst, v16qi * __restrict src) @@ -125,7 +125,7 @@ bar_s16_s64 (v2di * dst, v8hi src) dst[0] = *(v2di *) tem; } -/* { dg-final { scan-assembler-times "pmovsxwq" 2 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "pmovsxwq" 2 } } */ void foo_s32_s64 (v2di * dst, v4si * __restrict src) diff --git a/gcc/testsuite/gcc.target/i386/pr92658-sse4.c b/gcc/testsuite/gcc.target/i386/pr92658-sse4.c index e462629..e12e163 100644 --- a/gcc/testsuite/gcc.target/i386/pr92658-sse4.c +++ b/gcc/testsuite/gcc.target/i386/pr92658-sse4.c @@ -61,7 +61,7 @@ bar_u8_u32 (v4si * dst, v16qi src) dst[0] = *(v4si *) tem; } -/* { dg-final { scan-assembler-times "pmovzxbd" 2 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "pmovzxbd" 2 } } */ void foo_u8_u64 (v2di * dst, v16qi * __restrict src) @@ -125,7 +125,7 @@ bar_u16_u64 (v2di * dst, v8hi src) dst[0] = *(v2di *) tem; } -/* { dg-final { scan-assembler-times "pmovzxwq" 2 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "pmovzxwq" 2 } } */ void foo_u32_u64 (v2di * dst, v4si * __restrict src) -- cgit v1.1 From cd323d97d0592135ca4345701ef051659d8d4507 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Tue, 18 May 2021 12:29:58 -0400 Subject: analyzer: fix missing leak after call to strsep [PR100615] PR analyzer/100615 reports a missing leak diagnostic. The issue is that the code calls strsep which the analyzer doesn't have special knowledge of, and so conservatively assumes that it could free the pointer, so drops malloc state for it. Properly "teaching" the analyzer about strsep would require it to support bifurcating state at a call, which is currently fiddly to do, so for now this patch notes that strsep doesn't affect the malloc state machine, allowing the analyzer to correctly detect the leak. gcc/analyzer/ChangeLog: PR analyzer/100615 * sm-malloc.cc: Include "analyzer/function-set.h". (malloc_state_machine::on_stmt): Call unaffected_by_call_p and bail on the functions it recognizes. (malloc_state_machine::unaffected_by_call_p): New. gcc/testsuite/ChangeLog: PR analyzer/100615 * gcc.dg/analyzer/pr100615.c: New test. --- gcc/testsuite/gcc.dg/analyzer/pr100615.c | 53 ++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/analyzer/pr100615.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.dg/analyzer/pr100615.c b/gcc/testsuite/gcc.dg/analyzer/pr100615.c new file mode 100644 index 0000000..7a06f98 --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/pr100615.c @@ -0,0 +1,53 @@ +/* Adapted from + https://github.com/stackpath/rxtxcpu/blob/816d86c5d49c4db2ea5649f6b87e96da5af660f1/cpu.c + which is MIT-licensed. */ + +typedef __SIZE_TYPE__ size_t; +#define NULL ((void *)0) + +extern size_t strlen (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) + __attribute__ ((__pure__)) + __attribute__ ((__nonnull__ (1))); +extern char *strdup (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) + __attribute__ ((__malloc__)) + __attribute__ ((__nonnull__ (1))); +extern char *strsep (char **__restrict __stringp, + const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) + __attribute__ ((__nonnull__ (1, 2))); +extern long int strtol (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) + __attribute__ ((__nonnull__ (1))); +extern void free (void *__ptr) + __attribute__ ((__nothrow__ , __leaf__)); + +#define CPU_LIST_BASE 10 + +int parse_cpu_list(char *cpu_list) { + if (strlen(cpu_list) == 0) { + return 0; + } + + char *endptr; + char *tofree, *string, *range; + + tofree = string = strdup(cpu_list); /* { dg-message "allocated here" } */ + + while ((range = strsep(&string, ",")) != NULL) { + int first = strtol(range, &endptr, CPU_LIST_BASE); + if (!*endptr) { + continue; + } + char *save = endptr; + endptr++; + int last = strtol(endptr, &endptr, CPU_LIST_BASE); + if (save[0] != '-' || *endptr || last < first) { + return -1; /* { dg-warning "leak of 'tofree'" } */ + } + } + free(tofree); + return 0; +} -- cgit v1.1 From f71ca97def69b8aeb046d716eaea2367736f505e Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 18 May 2021 12:06:36 -0400 Subject: c++: "perfect" implicitly deleted move [PR100644] Here we were ignoring the template constructor because the implicit move constructor had all perfect conversions. But CWG1402 says that an implicitly deleted move constructor is ignored by overload resolution; we implement that instead by preferring any other candidate in joust, to get better diagnostics, but that means we need to handle that case here as well. gcc/cp/ChangeLog: PR c++/100644 * call.c (perfect_candidate_p): An implicitly deleted move is not perfect. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/implicit-delete1.C: New test. --- gcc/testsuite/g++.dg/cpp0x/implicit-delete1.C | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/implicit-delete1.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp0x/implicit-delete1.C b/gcc/testsuite/g++.dg/cpp0x/implicit-delete1.C new file mode 100644 index 0000000..6dcced4 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/implicit-delete1.C @@ -0,0 +1,20 @@ +// PR c++/100644 +// { dg-do compile { target c++11 } } + +struct NonMovable { + NonMovable(NonMovable&&) = delete; +}; + +template +struct Maybe { + NonMovable mMember; + + template + Maybe(Maybe&&); +}; + +void foo(Maybe); + +void unlucky(Maybe&& x) { + Maybe var{(Maybe&&)x}; +} -- cgit v1.1 From 8c114759b8c9c9e2ec90b82d92a24b5a71647017 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 18 May 2021 12:18:56 -0400 Subject: c++: non-static member, decltype, {} [PR100205] This test was fixed by my second patch for PR93314, which distinguishes between constant-expression and potentially-constant-evaluated contexts in a way that my first patch did not. PR c++/100205 PR c++/99314 gcc/testsuite/ChangeLog: * g++.dg/cpp0x/decltype-nonstatic1.C: New test. --- gcc/testsuite/g++.dg/cpp0x/decltype-nonstatic1.C | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype-nonstatic1.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype-nonstatic1.C b/gcc/testsuite/g++.dg/cpp0x/decltype-nonstatic1.C new file mode 100644 index 0000000..bc488ff --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype-nonstatic1.C @@ -0,0 +1,16 @@ +// PR c++/100205 +// { dg-do compile { target c++11 } } + +struct coordinate_matrix { + using index_t = unsigned; + struct convert_to_matrix_coordinate { + index_t column_id; + }; + index_t column_id; + + // does not work + using value_type2 = decltype(convert_to_matrix_coordinate{column_id}); + + // does work + using value_type5 = decltype(column_id); +}; -- cgit v1.1 From 79cf0004ffbb0c7f12729a1fc7801d2f25539c5a Mon Sep 17 00:00:00 2001 From: Bill Schmidt Date: Tue, 18 May 2021 09:04:39 -0500 Subject: rs6000: Remove old psabi warnings Long ago we were forced to make some small ABI breaks to correct errors in the implementation, and we added warning messages for the changes from GCC 4.9 to GCC 5. Enough time has passed that these are now just irritants, so let's remove them. Also clean up associated macros using rs6000_special_adjust_field_align_p, which has been always returning false for a long time. 2021-05-18 Bill Schmidt gcc/ * config/rs6000/freebsd64.h (ADJUST_FIELD_ALIGN): Remove call to rs6000_special_adjust_field_align_p. * config/rs6000/linux64.h (ADJUST_FIELD_ALIGN): Likewise. * config/rs6000/rs6000-call.c (rs6000_function_arg_boundary): Remove ABI warning. (rs6000_function_arg): Likewise. * config/rs6000/rs6000-protos.h (rs6000_special_adjust_field_align_p): Remove prototype. * config/rs6000/rs6000.c (rs6000_special_adjust_field_align_p): Remove. * config/rs6000/sysv4.h (ADJUST_FIELD_ALIGN): Remove call to rs6000_special_adjust_field_align_p. gcc/testsuite/ * gcc.target/powerpc/ppc64-abi-warn-1.c: Remove. * gcc.target/powerpc/ppc64-abi-warn-2.c: Remove. * gcc.target/powerpc/ppc64-abi-warn-3.c: Remove. --- gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-1.c | 12 ------------ gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-2.c | 11 ----------- gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-3.c | 9 --------- 3 files changed, 32 deletions(-) delete mode 100644 gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-1.c delete mode 100644 gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-2.c delete mode 100644 gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-3.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-1.c b/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-1.c deleted file mode 100644 index ae7d574..0000000 --- a/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-1.c +++ /dev/null @@ -1,12 +0,0 @@ -/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */ -/* { dg-options "-mabi=elfv2" } */ - -struct f8 - { - float x[8]; - }; - -void test (struct f8 a, struct f8 b) /* { dg-message "note: the ABI of passing homogeneous 'float' aggregates has changed" } */ -{ -} - diff --git a/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-2.c b/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-2.c deleted file mode 100644 index fdbeddf..0000000 --- a/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-2.c +++ /dev/null @@ -1,11 +0,0 @@ -/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */ - -struct test - { - long a __attribute__((aligned (16))); - }; - -void test (struct test a) /* { dg-message "note: the ABI of passing aggregates with 16-byte alignment has changed" } */ -{ -} - diff --git a/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-3.c b/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-3.c deleted file mode 100644 index 22cad0c..0000000 --- a/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-3.c +++ /dev/null @@ -1,9 +0,0 @@ -/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */ -/* { dg-require-effective-target powerpc_altivec_ok } */ -/* { dg-options "-maltivec" } */ - -struct test - { - int a __attribute__((vector_size (8))); - }; /* { dg-message "note: the layout of aggregates containing vectors with 8-byte alignment has changed" } */ - -- cgit v1.1 From a8daf9a19a5eae6b98acede14bb6c27b2e0038e0 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 19 May 2021 00:16:45 +0000 Subject: Daily bump. --- gcc/testsuite/ChangeLog | 94 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9141534..e9a410e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,97 @@ +2021-05-18 Bill Schmidt + + * gcc.target/powerpc/ppc64-abi-warn-1.c: Remove. + * gcc.target/powerpc/ppc64-abi-warn-2.c: Remove. + * gcc.target/powerpc/ppc64-abi-warn-3.c: Remove. + +2021-05-18 Jason Merrill + + PR c++/100205 + PR c++/99314 + * g++.dg/cpp0x/decltype-nonstatic1.C: New test. + +2021-05-18 Jason Merrill + + * g++.dg/cpp0x/implicit-delete1.C: New test. + +2021-05-18 David Malcolm + + PR analyzer/100615 + * gcc.dg/analyzer/pr100615.c: New test. + +2021-05-18 UroÅ¡ Bizjak + + PR target/100637 + * gcc.target/i386/pr100637-1b.c: New test. + * gcc.target/i386/pr100637-1w.c: Ditto. + * gcc.target/i386/pr92658-avx2-2.c: Do not XFAIL scan for pmovsxbq. + * gcc.target/i386/pr92658-avx2.c: Do not XFAIL scan for pmovzxbq. + * gcc.target/i386/pr92658-avx512vl.c: Do not XFAIL scan for vpmovdb. + * gcc.target/i386/pr92658-sse4-2.c: Do not XFAIL scan for + pmovsxbd and pmovsxwq. + * gcc.target/i386/pr92658-sse4.c: Do not XFAIL scan for + pmovzxbd and pmovzxwq. + +2021-05-18 Tobias Burnus + + PR fortran/100642 + * gfortran.dg/goacc-gomp/depobj.f90: New test. + +2021-05-18 Thomas Schwinge + + * lib/gcc-dg.exp: Implement 'dg-note'. + * lib/prune.exp: Likewise. + * gcc.dg/vect/nodump-vect-opt-info-2.c: Use 'dg-note', and + 'dg-prune-output "note: ". + * gfortran.dg/goacc/routine-external-level-of-parallelism-2.f: Use + 'dg-note', match up additional notes, one class of them with + XFAILed 'dg-bogus'. + * lib/lto.exp: Implement 'dg-lto-note'. + * g++.dg/lto/odr-1_0.C: Use 'dg-lto-note', match up additional + notes. + * g++.dg/lto/odr-1_1.C: Likewise. + * g++.dg/lto/odr-2_1.C: Likewise. + +2021-05-18 Jakub Jelinek + + PR rtl-optimization/100590 + * gcc.dg/pr100590.c: New test. + +2021-05-18 Jakub Jelinek + + PR c++/100580 + * g++.dg/other/pr100580.C: New test. + +2021-05-18 Jakub Jelinek + + PR tree-optimization/94589 + * g++.dg/opt/pr94589-2.C: Adjust scan-tree-dump count from 14 to 12. + +2021-05-18 Richard Biener + + * gcc.target/i386/pr100582.c: Adjust for AVX512. + +2021-05-18 Richard Biener + + PR c/100522 + * gcc.dg/gimplefe-error-10.c: New testcase. + +2021-05-18 Richard Biener + + PR c/100547 + * gcc.dg/pr100547.c: New testcase. + * gcc.dg/attr-vector_size.c: Adjust. + +2021-05-18 Andreas Krebbel + + * gcc.target/s390/zvector/vec-_Bool.c: New test. + +2021-05-18 Andreas Krebbel + + PR c++/100281 + * g++.target/s390/pr100281-1.C: New test. + * g++.target/s390/pr100281-2.C: New test. + 2021-05-17 Andrew MacLeod PR tree-optimization/100512 -- cgit v1.1 From 061fe8c58ac4d436906a404f7fb46b0a6e0d7b4f Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 18 May 2021 17:12:37 -0400 Subject: c++: template template parm pack expansion [PR100372] Here we have a pack expansion of a template template parameter pack, of which the pattern is a TEMPLATE_DECL, which strip_typedefs doesn't want to see. PR c++/100372 gcc/cp/ChangeLog: * tree.c (strip_typedefs): Only look at the pattern of a TYPE_PACK_EXPANSION if it's a type. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/alias-decl-ttp1.C: New test. --- gcc/testsuite/g++.dg/cpp0x/alias-decl-ttp1.C | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/alias-decl-ttp1.C (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-ttp1.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-ttp1.C new file mode 100644 index 0000000..d1af8d1 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-ttp1.C @@ -0,0 +1,6 @@ +// PR c++/100372 +// { dg-do compile { target c++14 } } + +template using enable_if_t = int; +template bool has_P_match_v; +template