diff options
author | Ian Lance Taylor <iant@golang.org> | 2021-02-12 11:38:19 -0800 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2021-02-12 11:38:19 -0800 |
commit | 89d7be42db00cd0953e7d4584877cf50a56ed046 (patch) | |
tree | 3a471e8ee60b7be687ab7501f70379618adcf174 /gcc/testsuite | |
parent | 305e9d2c7815e90a29bbde1e3a7cd776861f4d7c (diff) | |
parent | 9769564e7456453e2273071d0faa5aab2554ff78 (diff) | |
download | gcc-89d7be42db00cd0953e7d4584877cf50a56ed046.zip gcc-89d7be42db00cd0953e7d4584877cf50a56ed046.tar.gz gcc-89d7be42db00cd0953e7d4584877cf50a56ed046.tar.bz2 |
Merge from trunk revision 9769564e7456453e2273071d0faa5aab2554ff78.
Diffstat (limited to 'gcc/testsuite')
116 files changed, 3525 insertions, 367 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a0c6e73..288ea1d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,370 @@ +2021-02-11 Marek Polacek <polacek@redhat.com> + + PR c++/95888 + * g++.dg/template/deduce10.C: New test. + * g++.dg/template/deduce9.C: New test. + +2021-02-11 Peter Bergner <bergner@linux.ibm.com> + + PR target/99041 + * g++.target/powerpc/pr99041.C: New test. + +2021-02-11 Jakub Jelinek <jakub@redhat.com> + + PR c++/99033 + * g++.dg/ext/flexary38.C: New test. + +2021-02-11 Marek Polacek <polacek@redhat.com> + + PR c++/99063 + * g++.dg/cpp0x/variadic-crash6.C: New test. + +2021-02-11 Patrick Palka <ppalka@redhat.com> + + PR c++/97582 + * g++.dg/cpp0x/lambda/lambda-template17.C: New test. + +2021-02-11 Andrea Corallo <andrea.corallo@arm.com> + + PR target/98931 + * gcc.target/arm/pr98931.c: New testcase. + +2021-02-11 Joel Hutton <joel.hutton@arm.com> + + PR tree-optimization/98772 + * gcc.target/aarch64/pr98772.c: New test. + +2021-02-11 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/98897 + * gfortran.dg/typebound_call_32.f90: New test. + +2021-02-11 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/99060 + * gfortran.dg/pr99060.f90: New test. + +2021-02-11 Alexandre Oliva <oliva@adacore.com> + + * gcc.target/arm/simd/vmmla_1.c: Pass -mfpu=auto. + +2021-02-11 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR libfortran/98825 + * gfortran.dg/dollar_edit_descriptor_4.f: New test. + +2021-02-10 Martin Sebor <msebor@redhat.com> + + PR tree-optimization/92879 + * g++.dg/warn/Warray-bounds-16.C: New test. + +2021-02-10 David Malcolm <dmalcolm@redhat.com> + + PR preprocessor/96391 + * g++.dg/plugin/location-overflow-test-pr96391.c: New test. + * g++.dg/plugin/plugin.exp (plugin_test_list): Add it, + using the location_overflow_plugin.c from gcc.dg/plugin. + +2021-02-10 Jakub Jelinek <jakub@redhat.com> + + PR c++/99035 + * g++.dg/ext/weak6.C: New test. + +2021-02-10 Jakub Jelinek <jakub@redhat.com> + + PR target/99025 + * gcc.target/i386/pr99025.c: New test. + +2021-02-10 Jakub Jelinek <jakub@redhat.com> + + PR c++/98988 + PR c++/99031 + * g++.dg/cpp2a/constexpr-new16.C: New test. + * g++.dg/cpp2a/constexpr-new17.C: New test. + +2021-02-10 Nathan Sidwell <nathan@acm.org> + + PR c++/99030 + * g++.dg/lookup/pr99030.C: New. + +2021-02-10 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/99007 + * g++.dg/gomp/pr99007.C: New test. + * gcc.dg/gomp/pr99007-1.c: New test. + * gcc.dg/gomp/pr99007-2.c: New test. + * gcc.dg/gomp/pr99007-3.c: New test. + +2021-02-10 Julian Brown <julian@codesourcery.com> + + PR fortran/98979 + * gfortran.dg/goacc/array-with-dt-2.f90: Add expected errors. + * gfortran.dg/goacc/derived-chartypes-1.f90: Skip ICEing test. + * gfortran.dg/goacc/derived-chartypes-2.f90: Likewise. + +2021-02-09 David Malcolm <dmalcolm@redhat.com> + + PR analyzer/98575 + * gcc.dg/analyzer/file-1.c (test_5): New. + * gcc.dg/analyzer/file-3.c: New test. + +2021-02-09 David Malcolm <dmalcolm@redhat.com> + + PR analyzer/98575 + * gcc.dg/analyzer/explode-1.c: Remove expected leak warning. + * gcc.dg/analyzer/pr94851-2.c: New test. + * gcc.dg/analyzer/pr98575-1.c: New test. + +2021-02-09 Andre Vieira <andre.simoesdiasvieira@arm.com> + + * gcc.target/aarch64/asimd-mul-to-shl-sub.c: New test. + +2021-02-09 Jonathan Wright <jonathan.wright@arm.com> + + * gcc.target/aarch64/advsimd-intrinsics/vpXXXq.inc: + New test template. + * gcc.target/aarch64/advsimd-intrinsics/vpaddq.c: New test. + +2021-02-09 Nathan Sidwell <nathan@acm.org> + + PR c++/98944 + * g++.dg/modules/pr98944_a.C: New. + * g++.dg/modules/pr98944_b.C: New. + * g++.dg/modules/pr98944_c.C: New. + * g++.dg/modules/pr98944_d.C: New. + +2021-02-09 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/98465 + * g++.dg/warn/Wstringop-overread-1.C: New test. + +2021-02-09 Jason Merrill <jason@redhat.com> + + PR c++/96905 + * g++.dg/cpp2a/consteval-expinst1.C: New test. + +2021-02-09 Jason Merrill <jason@redhat.com> + + PR c++/98326 + * g++.dg/cpp1y/lambda-generic-empty1.C: New test. + +2021-02-09 Jason Merrill <jason@redhat.com> + + PR c++/98994 + * g++.dg/cpp2a/no_unique_address12.C: New test. + +2021-02-08 Nathan Sidwell <nathan@acm.org> + + * g++.dg/modules/pr98531-2.h: New. + * g++.dg/modules/pr98531-2_a.H: New. + * g++.dg/modules/pr98531-2_b.C: New. + * g++.dg/modules/pr98531-3.h: New. + * g++.dg/modules/pr98531-3_a.H: New. + * g++.dg/modules/pr98531-3_b.C: New. + +2021-02-08 Nathan Sidwell <nathan@acm.org> + + PR c++/98531 + * g++.dg/modules/pr98531-1.h: New. + * g++.dg/modules/pr98531-1_a.H: New. + * g++.dg/modules/pr98531-1_b.C: New. + * g++.dg/abi/pr98531-1.C: New. + * g++.dg/abi/pr98531-2.C: New. + * g++.dg/abi/pr98531-3.C: New. + * g++.dg/abi/pr98531-4.C: New. + +2021-02-08 Andre Vieira <andre.simoesdiasvieira@arm.com> + + PR middle-end/98974 + * gfortran.dg/pr98974.F90: New test. + +2021-02-08 Richard Biener <rguenther@suse.de> + + PR lto/96591 + * g++.dg/lto/pr96591_0.C: New testcase. + +2021-02-05 Marek Polacek <polacek@redhat.com> + + PR c++/98947 + * g++.dg/cpp2a/volatile5.C: New test. + +2021-02-05 Marek Polacek <polacek@redhat.com> + + PR c++/96462 + * g++.dg/cpp2a/using-enum-8.C: New test. + +2021-02-05 Nathan Sidwell <nathan@acm.org> + + PR driver/98943 + * c-c++-common/pr98943.c: New. + +2021-02-05 Richard Biener <rguenther@suse.de> + + PR tree-optimization/98855 + * g++.dg/vect/slp-pr98855.cc: New testcase. + +2021-02-05 Jakub Jelinek <jakub@redhat.com> + + PR c++/97878 + * g++.dg/cpp1z/decomp54.C: New test. + +2021-02-05 liuhongt <hongtao.liu@intel.com> + + PR target/98537 + * g++.target/i386/avx512bw-pr98537-1.C: New test. + * g++.target/i386/avx512vl-pr98537-1.C: New test. + * g++.target/i386/avx512vl-pr98537-2.C: New test. + * gcc.target/i386/avx512vl-pr88547-1.c: Adjust testcase, + integer mask comparison should not be generated. + * gcc.target/i386/avx512vl-pr92686-vpcmp-1.c: Remove. + * gcc.target/i386/avx512vl-pr92686-vpcmp-2.c: Ditto. + * gcc.target/i386/avx512vl-pr92686-vpcmp-intelasm-1.c: Ditto. + +2021-02-04 Julian Brown <julian@codesourcery.com> + + * gfortran.dg/goacc/derived-chartypes-1.f90: New test. + * gfortran.dg/goacc/derived-chartypes-2.f90: Likewise. + * gfortran.dg/goacc/derived-chartypes-3.f90: Likewise. + * gfortran.dg/goacc/derived-chartypes-4.f90: Likewise. + +2021-02-04 Julian Brown <julian@codesourcery.com> + + * gfortran.dg/goacc/array-with-dt-2.f90: New test. + +2021-02-04 Julian Brown <julian@codesourcery.com> + + * gfortran.dg/goacc/derived-classtypes-1.f95: New test. + +2021-02-04 Jakub Jelinek <jakub@redhat.com> + + PR testsuite/98325 + * lib/scanasm.exp (dg-scan-symbol-section): For powerpc*-*-* targets if + $section is .opd, look at .L.$symbol_name's section. + (parse_section_section_of_symbols): Handle .previous directive. + * gcc.dg/array-quals-1.c: Allow .sdata section. + +2021-02-04 Iain Buclaw <ibuclaw@gdcproject.org> + + * gdc.dg/intrinsics.d: Update test. + +2021-02-04 Martin Sebor <msebor@redhat.com> + + PR c/97882 + * gcc.dg/decl-8.c: Adjust text of expected diagnostic. + * gcc.dg/label-decl-4.c: Same. + * gcc.dg/mismatch-decl-1.c: Same. + * gcc.dg/old-style-then-proto-1.c: Same. + * gcc.dg/parm-mismatch-1.c: Same. + * gcc.dg/pr35445.c: Same. + * gcc.dg/redecl-11.c: Same. + * gcc.dg/redecl-12.c: Same. + * gcc.dg/redecl-13.c: Same. + * gcc.dg/redecl-15.c: Same. + * gcc.dg/tls/thr-init-1.c: Same. + * objc.dg/id-1.m: Same. + * objc.dg/tls/diag-3.m: Same. + * gcc.dg/pr97882.c: New test. + * gcc.dg/qual-return-7.c: New test. + * gcc.dg/qual-return-8.c: New test. + +2021-02-04 Jason Merrill <jason@redhat.com> + + PR c++/98717 + * g++.dg/cpp2a/concepts-variadic3.C: New test. + +2021-02-04 David Malcolm <dmalcolm@redhat.com> + + PR c/97932 + * gcc.dg/pr97932.c: New test. + +2021-02-04 emsr <3dw4rd@verizon.net> + + * g++.dg/cpp23/feat-cxx2b.C: __cpp_size_t_suffix == 202011. + +2021-02-04 Jakub Jelinek <jakub@redhat.com> + + * g++.dg/warn/Wsize_t-literals.C: Expect make_signed_t<size_t> instead + of make_signed<size_t>::type in the diagnostics. + +2021-02-04 Tom Greenslade (thomgree) <thomgree@cisco.com> + + PR c++/90926 + * g++.dg/cpp1y/nsdmi-aggr12.C: New test. + +2021-02-04 Tobias Burnus <tobias@codesourcery.com> + + * gfortran.dg/goacc/substring.f90: New test. + * gfortran.dg/gomp/substring.f90: New test. + +2021-02-04 Martin Liska <mliska@suse.cz> + + * gcc.target/i386/prefer-vector-width-attr.c: New test. + +2021-02-04 Jason Merrill <jason@redhat.com> + + PR c++/98802 + * g++.dg/cpp1z/class-deduction78.C: New test. + +2021-02-04 Jason Merrill <jason@redhat.com> + + PR c++/95192 + * g++.dg/cpp0x/pr84630.C: Call b(). + * g++.dg/cpp2a/lambda-uneval13.C: New test. + * g++.dg/ext/attr-expr1.C: New test. + +2021-02-03 Jakub Jelinek <jakub@redhat.com> + + PR preprocessor/98882 + * gcc.dg/cpp/pr98882.c: New test. + +2021-02-03 Jason Merrill <jason@redhat.com> + + * g++.dg/cpp0x/alias-decl-dr1558.C: Pass --param + hash-table-verification-limit=10000. + +2021-02-03 Ed Smith-Rowland <3dw4rd@verizon.net> + + * g++.dg/cpp0x/udlit-shadow-neg.C: Test for 'z' and 'zu' shadowing. + * g++.dg/cpp23/feat-cxx2b.C: New test. + * g++.dg/cpp23/size_t-literals.C: New test. + * g++.dg/warn/Wsize_t-literals.C: New test. + +2021-02-03 Jakub Jelinek <jakub@redhat.com> + + PR c++/97804 + * g++.dg/cpp2a/no_unique_address11.C: New test. + +2021-02-03 Marek Polacek <polacek@redhat.com> + + PR c++/98899 + * g++.dg/cpp0x/noexcept65.C: New test. + +2021-02-03 Tobias Burnus <tobias@codesourcery.com> + + PR fortran/98913 + * gfortran.dg/coarray/array_temporary.f90: New test. + +2021-02-03 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/97487 + * gcc.dg/pr97487-1.c: New test. + * gcc.dg/pr97487-2.c: New test. + +2021-02-03 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/97971 + * gcc.target/i386/pr97971.c: New test. + +2021-02-03 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/98287 + * gcc.dg/pr98287.c: New test. + +2021-02-03 Tamar Christina <tamar.christina@arm.com> + + PR tree-optimization/98928 + * gcc.target/i386/pr98928.c: New test. + 2021-02-02 Martin Liska <mliska@suse.cz> PR target/97510 diff --git a/gcc/testsuite/c-c++-common/pr98943.c b/gcc/testsuite/c-c++-common/pr98943.c new file mode 100644 index 0000000..53d8838 --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr98943.c @@ -0,0 +1,10 @@ +// { dg-do compile } +// PR 98943, compiler feature tests can get confused by not linking +// { dg-options "NOTAFILE" } + +int main () +{ + return 0; +} + +// { dg-regexp {[^\n:]*: warning: NOTAFILE: linker input file unused because linking not done\n[^\n:]*: error: NOTAFILE: linker input file not found: [^\n]*\n} } diff --git a/gcc/testsuite/g++.dg/abi/pr98531-1.C b/gcc/testsuite/g++.dg/abi/pr98531-1.C new file mode 100644 index 0000000..dc9ad99 --- /dev/null +++ b/gcc/testsuite/g++.dg/abi/pr98531-1.C @@ -0,0 +1,20 @@ +// { dg-do compile { target c++11 } } +// PR 98531 Making __cxa_atexit (or atexit) more visible means it +// must be consistent with the std library's declarations + +struct C +{ + ~C () noexcept; + C () noexcept; +}; + +C &frob () +{ + static C c; // Requires atexit functionality + + return c; +} + +// Make sure this agrees with what we introduced above +#include <cxxabi.h> +#include <cstdlib> diff --git a/gcc/testsuite/g++.dg/abi/pr98531-2.C b/gcc/testsuite/g++.dg/abi/pr98531-2.C new file mode 100644 index 0000000..4bdf9b9 --- /dev/null +++ b/gcc/testsuite/g++.dg/abi/pr98531-2.C @@ -0,0 +1,20 @@ +// { dg-do compile { target c++11 } } +// PR 98531 Making __cxa_atexit (or atexit) more visible means it +// must be consistent with the std library's declarations + +// Make sure this agrees with what we introduce below +#include <cxxabi.h> +#include <cstdlib> + +struct C +{ + ~C () noexcept; + C () noexcept; +}; + +C &frob () +{ + static C c; // Requires atexit functionality + + return c; +} diff --git a/gcc/testsuite/g++.dg/abi/pr98531-3.C b/gcc/testsuite/g++.dg/abi/pr98531-3.C new file mode 100644 index 0000000..de6129d --- /dev/null +++ b/gcc/testsuite/g++.dg/abi/pr98531-3.C @@ -0,0 +1,21 @@ +// { dg-do compile { target c++11 } } +// { dg-additional-options -fno-use-cxa-atexit } +// PR 98531 Making __cxa_atexit (or atexit) more visible means it +// must be consistent with the std library's declarations + +extern "C" int atexit (void (*) (void)); + +struct C +{ + ~C () noexcept; + C () noexcept; +}; + +C &frob () +{ + static C c; // Requires atexit functionality + + return c; +} + + diff --git a/gcc/testsuite/g++.dg/abi/pr98531-4.C b/gcc/testsuite/g++.dg/abi/pr98531-4.C new file mode 100644 index 0000000..ec64ee0 --- /dev/null +++ b/gcc/testsuite/g++.dg/abi/pr98531-4.C @@ -0,0 +1,19 @@ +// { dg-do compile { target c++11 } } +// { dg-additional-options -fno-use-cxa-atexit } +// PR 98531 Making __cxa_atexit (or atexit) more visible means it +// must be consistent with the std library's declarations + +struct C +{ + ~C () noexcept; + C () noexcept; +}; + +C &frob () +{ + static C c; // Requires atexit functionality + + return c; +} + +extern "C" int atexit (void (*) (void)); diff --git a/gcc/testsuite/g++.dg/analyzer/pr99064.C b/gcc/testsuite/g++.dg/analyzer/pr99064.C new file mode 100644 index 0000000..a002219 --- /dev/null +++ b/gcc/testsuite/g++.dg/analyzer/pr99064.C @@ -0,0 +1,39 @@ +// { dg-do compile { target c++17 } } +// { dg-additional-options "-Wno-analyzer-too-complex" } */ + +template <typename> struct iterator_traits; +template <typename _Tp> struct iterator_traits<_Tp *> { + typedef _Tp &reference; +}; +template <typename _Iterator> struct __normal_iterator { + _Iterator _M_current; + __normal_iterator(_Iterator &__i) : _M_current(__i) {} + typename iterator_traits<_Iterator>::reference operator*() { + return *_M_current; + } +}; +template <typename> struct allocator; +template <typename> struct allocator_traits; +template <typename _Tp> struct allocator_traits<allocator<_Tp>> { + using pointer = _Tp *; +}; +struct TPkcs11Token; +struct __alloc_traits : allocator_traits<allocator<TPkcs11Token>> {}; +struct _Vector_base { + typedef __alloc_traits::pointer pointer; + struct { + pointer _M_start; + } _M_impl; +}; +struct : _Vector_base { + __normal_iterator<pointer> begin() { return _M_impl._M_start; } +} list_tokens_token_list; +struct TPkcs11Token { + int *add_info; +}; +void list_tokens() { + for (__normal_iterator base = list_tokens_token_list.begin();;) { + int *add_info = new int; + (*base).add_info = add_info; // { dg-bogus "leak" "PR analyzer/98969" { xfail *-*-* } } + } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-dr1558.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-dr1558.C index 2bbb138..8495462 100644 --- a/gcc/testsuite/g++.dg/cpp0x/alias-decl-dr1558.C +++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-dr1558.C @@ -1,5 +1,6 @@ // DR 1558 still applies when using void_t as a template-argument. // { dg-do compile { target c++11 } } +// { dg-additional-options "--param hash-table-verification-limit=10000" } template<typename...> using void_t = void; template<class T> struct A { }; diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template17.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template17.C new file mode 100644 index 0000000..ac6c2e2 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template17.C @@ -0,0 +1,12 @@ +// PR c++/97582 +// { dg-do compile { target c++11 } } + +struct C1 { void operator+(); }; +struct C2 { void operator+(); }; +struct C3 : C1, C2 { + template <class T> void get() { [] (T x) { +x; }; } // { dg-error "ambiguous" } +}; + +template void C3::get<C1>(); // { dg-bogus "" } +template void C3::get<C2>(); // { dg-bogus "" } +template void C3::get<C3>(); // { dg-message "required from here" } diff --git a/gcc/testsuite/g++.dg/cpp0x/pr84630.C b/gcc/testsuite/g++.dg/cpp0x/pr84630.C index 3c2b4e4..7d6361b 100644 --- a/gcc/testsuite/g++.dg/cpp0x/pr84630.C +++ b/gcc/testsuite/g++.dg/cpp0x/pr84630.C @@ -5,3 +5,4 @@ template <typename...> struct c { template <int> __attribute__((noinline([] {}))) int b(); // { dg-error "wrong number of arguments" } }; c<> a; +int i = a.b<42>(); diff --git a/gcc/testsuite/g++.dg/cpp0x/udlit-shadow-neg.C b/gcc/testsuite/g++.dg/cpp0x/udlit-shadow-neg.C index fdddd8d..a30ec0f4 100644 --- a/gcc/testsuite/g++.dg/cpp0x/udlit-shadow-neg.C +++ b/gcc/testsuite/g++.dg/cpp0x/udlit-shadow-neg.C @@ -17,6 +17,30 @@ unsigned long long int operator"" ull(unsigned long long int k) // { dg-warning "integer suffix|shadowed by implementation" } { return k; } +unsigned long long int +operator"" z(unsigned long long int k) // { dg-warning "integer suffix|shadowed by implementation" } +{ return k; } + +unsigned long long int +operator"" uz(unsigned long long int k) // { dg-warning "integer suffix|shadowed by implementation" } +{ return k; } + +unsigned long long int +operator"" zu(unsigned long long int k) // { dg-warning "integer suffix|shadowed by implementation" } +{ return k; } + +unsigned long long int +operator"" Z(unsigned long long int k) // { dg-warning "integer suffix|shadowed by implementation" } +{ return k; } + +unsigned long long int +operator"" UZ(unsigned long long int k) // { dg-warning "integer suffix|shadowed by implementation" } +{ return k; } + +unsigned long long int +operator"" ZU(unsigned long long int k) // { dg-warning "integer suffix|shadowed by implementation" } +{ return k; } + // Namespaces are no hiding place. namespace Long { @@ -37,13 +61,50 @@ unsigned long long int operator"" ull(unsigned long long int k) // { dg-warning "integer suffix|shadowed by implementation" } { return k; } +unsigned long long int +operator"" z(unsigned long long int k) // { dg-warning "integer suffix|shadowed by implementation" } +{ return k; } + +unsigned long long int +operator"" uz(unsigned long long int k) // { dg-warning "integer suffix|shadowed by implementation" } +{ return k; } + +unsigned long long int +operator"" zu(unsigned long long int k) // { dg-warning "integer suffix|shadowed by implementation" } +{ return k; } + +unsigned long long int +operator"" Z(unsigned long long int k) // { dg-warning "integer suffix|shadowed by implementation" } +{ return k; } + +unsigned long long int +operator"" UZ(unsigned long long int k) // { dg-warning "integer suffix|shadowed by implementation" } +{ return k; } + +unsigned long long int +operator"" ZU(unsigned long long int k) // { dg-warning "integer suffix|shadowed by implementation" } +{ return k; } + } // { dg-warning "literal operator suffixes not preceded by|are reserved for future standardization" "reserved" { target *-*-* } 5 } // { dg-warning "literal operator suffixes not preceded by|are reserved for future standardization" "reserved" { target *-*-* } 9 } // { dg-warning "literal operator suffixes not preceded by|are reserved for future standardization" "reserved" { target *-*-* } 13 } // { dg-warning "literal operator suffixes not preceded by|are reserved for future standardization" "reserved" { target *-*-* } 17 } +// { dg-warning "literal operator suffixes not preceded by|are reserved for future standardization" "reserved" { target *-*-* } 21 } // { dg-warning "literal operator suffixes not preceded by|are reserved for future standardization" "reserved" { target *-*-* } 25 } // { dg-warning "literal operator suffixes not preceded by|are reserved for future standardization" "reserved" { target *-*-* } 29 } // { dg-warning "literal operator suffixes not preceded by|are reserved for future standardization" "reserved" { target *-*-* } 33 } // { dg-warning "literal operator suffixes not preceded by|are reserved for future standardization" "reserved" { target *-*-* } 37 } +// { dg-warning "literal operator suffixes not preceded by|are reserved for future standardization" "reserved" { target *-*-* } 41 } + +// { dg-warning "literal operator suffixes not preceded by|are reserved for future standardization" "reserved" { target *-*-* } 49 } +// { dg-warning "literal operator suffixes not preceded by|are reserved for future standardization" "reserved" { target *-*-* } 53 } +// { dg-warning "literal operator suffixes not preceded by|are reserved for future standardization" "reserved" { target *-*-* } 57 } +// { dg-warning "literal operator suffixes not preceded by|are reserved for future standardization" "reserved" { target *-*-* } 61 } +// { dg-warning "literal operator suffixes not preceded by|are reserved for future standardization" "reserved" { target *-*-* } 65 } +// { dg-warning "literal operator suffixes not preceded by|are reserved for future standardization" "reserved" { target *-*-* } 69 } +// { dg-warning "literal operator suffixes not preceded by|are reserved for future standardization" "reserved" { target *-*-* } 73 } +// { dg-warning "literal operator suffixes not preceded by|are reserved for future standardization" "reserved" { target *-*-* } 77 } +// { dg-warning "literal operator suffixes not preceded by|are reserved for future standardization" "reserved" { target *-*-* } 81 } +// { dg-warning "literal operator suffixes not preceded by|are reserved for future standardization" "reserved" { target *-*-* } 85 } diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-crash6.C b/gcc/testsuite/g++.dg/cpp0x/variadic-crash6.C new file mode 100644 index 0000000..88009b7 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/variadic-crash6.C @@ -0,0 +1,16 @@ +// PR c++/99063 +// { dg-do compile { target c++11 } } + +template <typename... T> +void f (T... n) +{ + do + { + } + while (--n); // { dg-error "parameter packs not expanded with '...'" } +} + +void g () +{ + f(3); +} diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-empty1.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-empty1.C new file mode 100644 index 0000000..ffb0cf1 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-empty1.C @@ -0,0 +1,9 @@ +// PR c++/98326 +// { dg-do compile { target c++14 } } + +struct A { + A() = default; + A(const A&) {} +}; + +void (*fptr)(A) = [](auto){}; diff --git a/gcc/testsuite/g++.dg/cpp1y/nsdmi-aggr12.C b/gcc/testsuite/g++.dg/cpp1y/nsdmi-aggr12.C new file mode 100644 index 0000000..fcc1f50 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/nsdmi-aggr12.C @@ -0,0 +1,36 @@ +// PR c++/90926 +// { dg-do run { target c++14 } } + +#include <cassert> + +struct A +{ + char str[4] = "foo"; + char str_array[2][4] = {"bar", "baz"}; +}; + +struct B +{ + char16_t str[10]; +}; + +int called = 0; +void f(A) { called = 1;}; +void f(B) { called = 2;}; + +int +main () +{ + A a; + a.str[0] = 'g'; + a.str_array[0][0] = 'g'; + a = {}; + + if (__builtin_strcmp (a.str, "foo") != 0) + __builtin_abort(); + if (__builtin_strcmp (a.str_array[0], "bar") != 0) + __builtin_abort(); + + f({"foo"}); assert(called == 1); + f({u"foo"}); assert(called == 2); +} diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction78.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction78.C new file mode 100644 index 0000000..6516454 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction78.C @@ -0,0 +1,20 @@ +// PR c++/98802 +// { dg-do compile { target c++17 } } + +using size_t = decltype(sizeof(42)); + +template<typename T, size_t N = 0> +struct List { + T head; + List<T, N-1> tail; +}; + +template<typename T> +struct List<T, 0> {}; + +template<typename T> List(T) -> List<T, 1>; +template<typename T, size_t N> List(T, List<T, N>) -> List<T, N+1>; + +int main() { + auto list2 = List{0, List{1, List{2}}}; +} diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp54.C b/gcc/testsuite/g++.dg/cpp1z/decomp54.C new file mode 100644 index 0000000..1bee772 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/decomp54.C @@ -0,0 +1,17 @@ +// PR c++/97878 +// { dg-do compile { target c++11 } } +// { dg-options "" } + +extern int a[]; +auto [b] { a }; // { dg-error "has incomplete type" } + // { dg-warning "only available with" "" { target c++14_down } .-1 } +auto [c] = a; // { dg-error "has incomplete type" } + // { dg-warning "only available with" "" { target c++14_down } .-1 } +extern int d[0]; +auto [e] { d }; // { dg-error "too many initializers for" } + // { dg-error "1 name provided for structured binding" "" { target *-*-* } .-1 } + // { dg-message "decomposes into 0 elements" "" { target *-*-* } .-2 } + // { dg-warning "only available with" "" { target c++14_down } .-3 } +auto [f] = d; // { dg-error "1 name provided for structured binding" } + // { dg-message "decomposes into 0 elements" "" { target *-*-* } .-1 } + // { dg-warning "only available with" "" { target c++14_down } .-2 } diff --git a/gcc/testsuite/g++.dg/cpp23/feat-cxx2b.C b/gcc/testsuite/g++.dg/cpp23/feat-cxx2b.C new file mode 100644 index 0000000..4a342e9 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp23/feat-cxx2b.C @@ -0,0 +1,549 @@ +// { dg-options "-std=c++2b -I${srcdir}/g++.dg/cpp1y -I${srcdir}/g++.dg/cpp1y/testinc" } + +// C++98 features: + +#ifndef __cpp_rtti +# error "__cpp_rtti" +#elif __cpp_rtti != 199711 +# error "__cpp_rtti != 199711" +#endif + +#ifndef __cpp_exceptions +# error "__cpp_exceptions" +#elif __cpp_exceptions != 199711 +# error "__cpp_exceptions != 199711" +#endif + +// C++11 features: + +#ifndef __cpp_raw_strings +# error "__cpp_raw_strings" +#elif __cpp_raw_strings != 200710 +# error "__cpp_raw_strings != 200710" +#endif + +#ifndef __cpp_unicode_literals +# error "__cpp_unicode_literals" +#elif __cpp_unicode_literals != 200710 +# error "__cpp_unicode_literals != 200710" +#endif + +#ifndef __cpp_user_defined_literals +# error "__cpp_user_defined_literals" +#elif __cpp_user_defined_literals != 200809 +# error "__cpp_user_defined_literals != 200809" +#endif + +#ifndef __cpp_lambdas +# error "__cpp_lambdas" +#elif __cpp_lambdas != 200907 +# error "__cpp_lambdas != 200907" +#endif + +#ifndef __cpp_range_based_for +# error "__cpp_range_based_for" +#elif __cpp_range_based_for != 201603 +# error "__cpp_range_based_for != 201603" +#endif + +#ifndef __cpp_decltype +# error "__cpp_decltype" +#elif __cpp_decltype != 200707 +# error "__cpp_decltype != 200707" +#endif + +#ifndef __cpp_attributes +# error "__cpp_attributes" +#elif __cpp_attributes != 200809 +# error "__cpp_attributes != 200809" +#endif + +#ifndef __cpp_rvalue_references +# error "__cpp_rvalue_references" +#elif __cpp_rvalue_references != 200610 +# error "__cpp_rvalue_references != 200610" +#endif + +#ifndef __cpp_variadic_templates +# error "__cpp_variadic_templates" +#elif __cpp_variadic_templates != 200704 +# error "__cpp_variadic_templates != 200704" +#endif + +#ifndef __cpp_initializer_lists +# error "__cpp_initializer_lists" +#elif __cpp_initializer_lists != 200806 +# error "__cpp_initializer_lists != 200806" +#endif + +#ifndef __cpp_delegating_constructors +# error "__cpp_delegating_constructors" +#elif __cpp_delegating_constructors != 200604 +# error "__cpp_delegating_constructors != 200604" +#endif + +#ifndef __cpp_nsdmi +# error "__cpp_nsdmi" +#elif __cpp_nsdmi != 200809 +# error "__cpp_nsdmi != 200809" +#endif + +#ifndef __cpp_inheriting_constructors +# error "__cpp_inheriting_constructors" +#elif __cpp_inheriting_constructors!= 201511 +# error "__cpp_inheriting_constructors != 201511" +#endif + +#ifndef __cpp_ref_qualifiers +# error "__cpp_ref_qualifiers" +#elif __cpp_ref_qualifiers != 200710 +# error "__cpp_ref_qualifiers != 200710" +#endif + +#ifndef __cpp_alias_templates +# error "__cpp_alias_templates" +#elif __cpp_alias_templates != 200704 +# error "__cpp_alias_templates != 200704" +#endif + +#ifndef __cpp_threadsafe_static_init +# error "__cpp_threadsafe_static_init" +#elif __cpp_threadsafe_static_init != 200806 +# error "__cpp_threadsafe_static_init != 200806" +#endif + +// C++14 features: + +#ifndef __cpp_binary_literals +# error "__cpp_binary_literals" +#elif __cpp_binary_literals != 201304 +# error "__cpp_binary_literals != 201304" +#endif + +#ifndef __cpp_init_captures +# error "__cpp_init_captures" +#elif __cpp_init_captures != 201803 +# error "__cpp_init_captures != 201803" +#endif + +#ifndef __cpp_generic_lambdas +# error "__cpp_generic_lambdas" +#elif __cpp_generic_lambdas != 201707 +# error "__cpp_generic_lambdas != 201707" +#endif + +#ifndef __cpp_constexpr +# error "__cpp_constexpr" +#elif __cpp_constexpr != 201907 +# error "__cpp_constexpr != 201907" +#endif + +#ifndef __cpp_decltype_auto +# error "__cpp_decltype_auto" +#elif __cpp_decltype_auto != 201304 +# error "__cpp_decltype_auto != 201304" +#endif + +#ifndef __cpp_return_type_deduction +# error "__cpp_return_type_deduction" +#elif __cpp_return_type_deduction != 201304 +# error "__cpp_return_type_deduction != 201304" +#endif + +#ifndef __cpp_aggregate_nsdmi +# error "__cpp_aggregate_nsdmi" +#elif __cpp_aggregate_nsdmi != 201304 +# error "__cpp_aggregate_nsdmi != 201304" +#endif + +#ifndef __cpp_variable_templates +# error "__cpp_variable_templates" +#elif __cpp_variable_templates != 201304 +# error "__cpp_variable_templates != 201304" +#endif + +#ifndef __cpp_digit_separators +# error "__cpp_digit_separators" +#elif __cpp_digit_separators != 201309 +# error "__cpp_digit_separators != 201309" +#endif + +#ifndef __cpp_sized_deallocation +# error "__cpp_sized_deallocation" +#elif __cpp_sized_deallocation != 201309 +# error "__cpp_sized_deallocation != 201309" +#endif + +// GNU VLA support: + +#ifndef __cpp_runtime_arrays +# error "__cpp_runtime_arrays" +#elif __cpp_runtime_arrays != 198712 +# error "__cpp_runtime_arrays != 198712" +#endif + +// C++11 attributes: + +#ifdef __has_cpp_attribute +# if ! __has_cpp_attribute(noreturn) +# error "__has_cpp_attribute(noreturn)" +# elif __has_cpp_attribute(noreturn) != 200809 +# error "__has_cpp_attribute(noreturn) != 200809" +# endif +#else +# error "__has_cpp_attribute" +#endif + +// Attribute carries_dependency not in yet. +//#ifdef __has_cpp_attribute +//# if ! __has_cpp_attribute(carries_dependency) +//# error "__has_cpp_attribute(carries_dependency)" +//# elif __has_cpp_attribute(carries_dependency) != 200809 +//# error "__has_cpp_attribute(carries_dependency) != 200809" +//# endif +//#else +//# error "__has_cpp_attribute" +//#endif + +// C++14 attributes: + +#ifdef __has_cpp_attribute +# if ! __has_cpp_attribute(deprecated) +# error "__has_cpp_attribute(deprecated)" +# elif __has_cpp_attribute(deprecated) != 201309 +# error "__has_cpp_attribute(deprecated) != 201309" +# endif +#else +# error "__has_cpp_attribute" +#endif + +// Include checks: + +// Check for __has_include macro. +#ifndef __has_include +# error "__has_include" +#endif + +// Try known bracket header (use operator). +#if __has_include (<complex>) +#else +# error "<complex>" +#endif + +// Define and use a macro to invoke the operator. +#define sluggo(TXT) __has_include(TXT) + +#if sluggo(<complex>) +#else +# error "<complex>" +#endif + +#if ! sluggo(<complex>) +# error "<complex>" +#else +#endif + +// Quoted complex.h should find at least the bracket version. +#if __has_include("complex.h") +#else +# error "complex.h" +#endif + +// Try known local quote header. +#if __has_include("complex_literals.h") +#else +# error "\"complex_literals.h\"" +#endif + +// Try nonexistent bracket header. +#if __has_include(<stuff>) +# error "<stuff>" +#else +#endif + +// Try nonexistent quote header. +#if __has_include("phlegm") +# error "\"phlegm\"" +#else +#endif + +// Test __has_include_next. +#if __has_include("phoobhar.h") +# include "phoobhar.h" +#else +# error "__has_include(\"phoobhar.h\")" +#endif + +// Try a macro. +#define COMPLEX_INC "complex.h" +#if __has_include(COMPLEX_INC) +#else +# error COMPLEX_INC +#endif + +// Realistic use of __has_include. +#if __has_include(<array>) +# define STD_ARRAY 1 +# include <array> + template<typename _Tp, std::size_t _Num> + using array = std::array<_Tp, _Num>; +#elif __has_include(<tr1/array>) +# define TR1_ARRAY 1 +# include <tr1/array> + template<typename _Tp, std::size_t _Num> + typedef std::tr1::array<_Tp, _Num> array; +#endif + +// C++17 features: + +#ifndef __cpp_unicode_characters +# error "__cpp_unicode_characters" +#elif __cpp_unicode_characters != 201411 +# error "__cpp_unicode_characters != 201411" +#endif + +#ifndef __cpp_static_assert +# error "__cpp_static_assert" +#elif __cpp_static_assert != 201411 +# error "__cpp_static_assert != 201411" +#endif + +#ifndef __cpp_namespace_attributes +# error "__cpp_namespace_attributes" +#elif __cpp_namespace_attributes != 201411 +# error "__cpp_namespace_attributes != 201411" +#endif + +#ifndef __cpp_enumerator_attributes +# error "__cpp_enumerator_attributes" +#elif __cpp_enumerator_attributes != 201411 +# error "__cpp_enumerator_attributes != 201411" +#endif + +#ifndef __cpp_nested_namespace_definitions +# error "__cpp_nested_namespace_definitions" +#elif __cpp_nested_namespace_definitions != 201411 +# error "__cpp_nested_namespace_definitions != 201411" +#endif + +#ifndef __cpp_fold_expressions +# error "__cpp_fold_expressions" +#elif __cpp_fold_expressions != 201603 +# error "__cpp_fold_expressions != 201603" +#endif + +#ifndef __cpp_nontype_template_args +# error "__cpp_nontype_template_args" +#elif __cpp_nontype_template_args != 201911 +# error "__cpp_nontype_template_args != 201911" +#endif + +#ifndef __cpp_hex_float +# error "__cpp_hex_float" +#elif __cpp_hex_float != 201603 +# error "__cpp_hex_float != 201603" +#endif + +#ifndef __cpp_aggregate_bases +# error "__cpp_aggregate_bases" +#elif __cpp_aggregate_bases != 201603 +# error "__cpp_aggregate_bases != 201603" +#endif + +#ifndef __cpp_deduction_guides +# error "__cpp_deduction_guides" +#elif __cpp_deduction_guides != 201907 +# error "__cpp_deduction_guides != 201907" +#endif + +#ifndef __cpp_if_constexpr +# error "__cpp_if_constexpr" +#elif __cpp_if_constexpr != 201606 +# error "__cpp_if_constexpr != 201606" +#endif + +#ifndef __cpp_aligned_new +# error "__cpp_aligned_new" +#elif __cpp_aligned_new != 201606 +# error "__cpp_aligned_new != 201606" +#endif + +#ifndef __cpp_template_auto +# error "__cpp_template_auto" +#elif __cpp_template_auto != 201606 +# error "__cpp_template_auto != 201606" +#endif + +#ifndef __cpp_inline_variables +# error "__cpp_inline_variables" +#elif __cpp_inline_variables != 201606 +# error "__cpp_inline_variables != 201606" +#endif + +#ifndef __cpp_capture_star_this +# error "__cpp_capture_star_this" +#elif __cpp_capture_star_this != 201603 +# error "__cpp_capture_star_this != 201603" +#endif + +#ifndef __cpp_noexcept_function_type +# error "__cpp_noexcept_function_type" +#elif __cpp_noexcept_function_type != 201510 +# error "__cpp_noexcept_function_type != 201510" +#endif + +#ifndef __cpp_structured_bindings +# error "__cpp_structured_bindings" +#elif __cpp_structured_bindings != 201606 +# error "__cpp_structured_bindings != 201606" +#endif + +#ifndef __cpp_template_template_args +# error "__cpp_template_template_args" +#elif __cpp_template_template_args != 201611 +# error "__cpp_template_template_args != 201611" +#endif + +#ifndef __cpp_variadic_using +# error "__cpp_variadic_using" +#elif __cpp_variadic_using != 201611 +# error "__cpp_variadic_using != 201611" +#endif + +#ifndef __cpp_guaranteed_copy_elision +# error "__cpp_guaranteed_copy_elision" +#elif __cpp_guaranteed_copy_elision != 201606 +# error "__cpp_guaranteed_copy_elision != 201606" +#endif + +#ifndef __cpp_nontype_template_parameter_auto +# error "__cpp_nontype_template_parameter_auto" +#elif __cpp_nontype_template_parameter_auto != 201606 +# error "__cpp_nontype_template_parameter_auto != 201606" +#endif + +// C++20 features + +#ifndef __cpp_conditional_explicit +# error "__cpp_conditional_explicit" +#elif __cpp_conditional_explicit != 201806 +# error "__cpp_conditional_explicit != 201806" +#endif + +#ifndef __cpp_nontype_template_parameter_class +# error "__cpp_nontype_template_parameter_class" +#elif __cpp_nontype_template_parameter_class != 201806 +# error "__cpp_nontype_template_parameter_class != 201806" +#endif + +#ifndef __cpp_impl_destroying_delete +# error "__cpp_impl_destroying_delete" +#elif __cpp_impl_destroying_delete != 201806 +# error "__cpp_impl_destroying_delete != 201806" +#endif + +#ifndef __cpp_constinit +# error "__cpp_constinit" +#elif __cpp_constinit != 201907 +# error "__cpp_constinit != 201907" +#endif + +#ifndef __cpp_constexpr_dynamic_alloc +# error "__cpp_constexpr_dynamic_alloc" +#elif __cpp_constexpr_dynamic_alloc != 201907 +# error "__cpp_constexpr_dynamic_alloc != 201907" +#endif + +#ifndef __cpp_aggregate_paren_init +# error "__cpp_aggregate_paren_init" +#elif __cpp_aggregate_paren_init != 201902 +# error "__cpp_aggregate_paren_init != 201902" +#endif + +#ifdef __has_cpp_attribute + +# if ! __has_cpp_attribute(maybe_unused) +# error "__has_cpp_attribute(maybe_unused)" +# elif __has_cpp_attribute(maybe_unused) != 201603 +# error "__has_cpp_attribute(maybe_unused) != 201603" +# endif + +# if ! __has_cpp_attribute(nodiscard) +# error "__has_cpp_attribute(nodiscard)" +# elif __has_cpp_attribute(nodiscard) != 201907 +# error "__has_cpp_attribute(nodiscard) != 201907" +# endif + +# if ! __has_cpp_attribute(fallthrough) +# error "__has_cpp_attribute(fallthrough)" +# elif __has_cpp_attribute(fallthrough) != 201603 +# error "__has_cpp_attribute(fallthrough) != 201603" +# endif + +# if ! __has_cpp_attribute(no_unique_address) +# error "__has_cpp_attribute(no_unique_address)" +# elif __has_cpp_attribute(no_unique_address) != 201803 +# error "__has_cpp_attribute(no_unique_address) != 201803" +# endif + +# if ! __has_cpp_attribute(likely) +# error "__has_cpp_attribute(likely)" +# elif __has_cpp_attribute(likely) != 201803 +# error "__has_cpp_attribute(likely) != 201803" +# endif + +# if ! __has_cpp_attribute(unlikely) +# error "__has_cpp_attribute(unlikely)" +# elif __has_cpp_attribute(unlikely) != 201803 +# error "__has_cpp_attribute(unlikely) != 201803" +# endif + +#else +# error "__has_cpp_attribute" +#endif + +#ifndef __cpp_char8_t +# error "__cpp_char8_t" +#elif __cpp_char8_t != 201811 +# error "__cpp_char8_t != 201811" +#endif + +#ifndef __cpp_designated_initializers +# error "__cpp_designated_initializers" +#elif __cpp_designated_initializers != 201707 +# error "__cpp_designated_initializers != 201707" +#endif + +#ifndef __cpp_constexpr_in_decltype +# error "__cpp_constexpr_in_decltype" +#elif __cpp_constexpr_in_decltype != 201711 +# error "__cpp_constexpr_in_decltype != 201711" +#endif + +/* Not supported fully yet: +#ifndef __cpp_consteval +# error "__cpp_consteval" +#elif __cpp_consteval != 201811 +# error "__cpp_consteval != 201811" +#endif +*/ + +#ifndef __cpp_concepts +# error "__cpp_concepts" +#elif __cpp_concepts != 201907 +# error "__cpp_concepts != 201907" +#endif + +#ifndef __cpp_using_enum +# error "__cpp_using_enum" +#elif __cpp_using_enum != 201907 +# error "__cpp_using_enum != 201907" +#endif + +// C++23 features: + +#ifndef __cpp_size_t_suffix +# error "__cpp_size_t_suffix" +#elif __cpp_size_t_suffix != 202011 +# error "__cpp_size_t_suffix != 202011" +#endif diff --git a/gcc/testsuite/g++.dg/cpp23/size_t-literals.C b/gcc/testsuite/g++.dg/cpp23/size_t-literals.C new file mode 100644 index 0000000..3488032 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp23/size_t-literals.C @@ -0,0 +1,8 @@ +// { dg-do compile { target c++23 } } + +#include <cstddef> +#include <type_traits> + +static_assert(std::is_same_v<decltype(123zu), std::size_t>); +static_assert(std::is_same_v<decltype(456z), std::make_signed_t<std::size_t>>); + diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-requires24.C b/gcc/testsuite/g++.dg/cpp2a/concepts-requires24.C new file mode 100644 index 0000000..597528b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/concepts-requires24.C @@ -0,0 +1,4 @@ +// PR c++/97742 +// { dg-do compile { target c++20 } } + +template <int = requires { true // { dg-error "expected" } diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-variadic3.C b/gcc/testsuite/g++.dg/cpp2a/concepts-variadic3.C new file mode 100644 index 0000000..6fa7113 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/concepts-variadic3.C @@ -0,0 +1,7 @@ +// PR c++/98717 +// { dg-do compile { target c++20 } } + +template<typename... T> +concept True = true; + +static_assert(True<>); diff --git a/gcc/testsuite/g++.dg/cpp2a/consteval-expinst1.C b/gcc/testsuite/g++.dg/cpp2a/consteval-expinst1.C new file mode 100644 index 0000000..01452dd --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/consteval-expinst1.C @@ -0,0 +1,20 @@ +// PR c++/96905 +// { dg-do compile { target c++20 } } + +template<typename Rep> +struct duration +{ + static consteval int + gcd(int m, int n) noexcept + { + while (m != 0 && n != 0) + { + int rem = m % n; + m = n; + n = rem; + } + return m + n; + } +}; + +template class duration<int>; diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-new16.C b/gcc/testsuite/g++.dg/cpp2a/constexpr-new16.C new file mode 100644 index 0000000..d3e4905 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-new16.C @@ -0,0 +1,13 @@ +// PR c++/98988 +// { dg-do compile { target c++20 } } +// { dg-options "-fno-delete-null-pointer-checks" } + +constexpr bool +foo () +{ + auto ptr = new int(); + delete ptr; + return true; +} + +static_assert (foo ()); diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-new17.C b/gcc/testsuite/g++.dg/cpp2a/constexpr-new17.C new file mode 100644 index 0000000..4f6e819 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-new17.C @@ -0,0 +1,15 @@ +// PR c++/99031 +// { dg-do compile { target c++20 } } + +constexpr bool +foo () +{ + auto a = new int; + auto b = new int; + bool r = a == b; + delete b; + delete a; + return r; +} + +static_assert (!foo ()); diff --git a/gcc/testsuite/g++.dg/cpp2a/lambda-generic-variadic21.C b/gcc/testsuite/g++.dg/cpp2a/lambda-generic-variadic21.C new file mode 100644 index 0000000..d6b5656 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/lambda-generic-variadic21.C @@ -0,0 +1,19 @@ +// PR c++/97246 +// { dg-do compile { target c++20 } } + +template <int... Is, typename T> +T arg_T(decltype(Is)..., T, ...); + +template <int I, int... Is> +inline constexpr auto get = + []<typename... T>(decltype(Is)..., T... v, ...) { + static_assert( sizeof...(T) == sizeof...(v) ); + if constexpr ( sizeof...(T) == 1 ) + return (v,...); + else { + using V = decltype(arg_T<__integer_pack(I)...>(v...)); + return get<I,__integer_pack(I)...>.template operator()<V>(v...); + } + }; + +static_assert( get<0>('\0', short{1}, 2, long{3}) == 0 ); diff --git a/gcc/testsuite/g++.dg/cpp2a/lambda-uneval13.C b/gcc/testsuite/g++.dg/cpp2a/lambda-uneval13.C new file mode 100644 index 0000000..df908f0 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/lambda-uneval13.C @@ -0,0 +1,11 @@ +// { dg-do compile { target c++20 } } + +template <class U> struct A +{ + template <class T> void spam(decltype([]{}) *s = nullptr) { } +}; + +void foo() +{ + A<int>().spam<int>(); +} diff --git a/gcc/testsuite/g++.dg/cpp2a/no_unique_address12.C b/gcc/testsuite/g++.dg/cpp2a/no_unique_address12.C new file mode 100644 index 0000000..761d208 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/no_unique_address12.C @@ -0,0 +1,12 @@ +// PR c++/98994 +// { dg-do compile { target c++20 } } + +struct empty {}; + +union U { + constexpr U(): a() { } + + [[no_unique_address]] empty a; +}; + +constexpr U u; diff --git a/gcc/testsuite/g++.dg/cpp2a/using-enum-8.C b/gcc/testsuite/g++.dg/cpp2a/using-enum-8.C new file mode 100644 index 0000000..9a743a9 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/using-enum-8.C @@ -0,0 +1,5 @@ +// PR c++/96462 +// { dg-do compile { target c++11 } } + +enum E {}; +using E::~E; // { dg-error "names destructor" } diff --git a/gcc/testsuite/g++.dg/cpp2a/volatile5.C b/gcc/testsuite/g++.dg/cpp2a/volatile5.C new file mode 100644 index 0000000..1f9d238 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/volatile5.C @@ -0,0 +1,15 @@ +// PR c++/98947 +// { dg-do compile } + +volatile int x, y, z; + +void +f (bool b) +{ + (b ? x : y) = 1; + (b ? x : y) += 1; // { dg-warning "compound assignment" "" { target c++20 } } + z = (b ? x : y) = 1; // { dg-warning "using value of simple assignment" "" { target c++20 } } + ((z = 2) ? x : y) = 1; // { dg-warning "using value of simple assignment" "" { target c++20 } } + (b ? (x = 2) : y) = 1; // { dg-warning "using value of simple assignment" "" { target c++20 } } + (b ? x : (y = 5)) = 1; // { dg-warning "using value of simple assignment" "" { target c++20 } } +} diff --git a/gcc/testsuite/g++.dg/ext/attr-expr1.C b/gcc/testsuite/g++.dg/ext/attr-expr1.C new file mode 100644 index 0000000..990e710 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/attr-expr1.C @@ -0,0 +1,9 @@ +// PR c++/95192 + +template<typename T> +__attribute__((assume_aligned(sizeof(int(T()))))) // { dg-message "function type" } +T *f(); + +void test21() { + void *p = f<void>() // { dg-error "no match" } +} diff --git a/gcc/testsuite/g++.dg/ext/flexary38.C b/gcc/testsuite/g++.dg/ext/flexary38.C new file mode 100644 index 0000000..4fa987b --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/flexary38.C @@ -0,0 +1,18 @@ +// PR c++/99033 +// { dg-do compile } +// { dg-options "" } + +struct T { int t; }; +struct S { char c; int T::*b[]; } a; +struct U { char c; int T::*b[0]; } b; +struct V { char c; int T::*b[1]; } c; +struct W { char c; int T::*b[2]; } d; + +void +foo () +{ + a.c = 1; + b.c = 2; + c.c = 3; + d.c = 4; +} diff --git a/gcc/testsuite/g++.dg/ext/weak6.C b/gcc/testsuite/g++.dg/ext/weak6.C new file mode 100644 index 0000000..e9a70ee --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/weak6.C @@ -0,0 +1,8 @@ +// PR c++/99035 +// { dg-do compile } +// { dg-require-weak "" } +// { dg-options "-fsyntax-only" } + +extern void * foo (void); +void * foo (void) { return (void *)foo; } +#pragma weak foo diff --git a/gcc/testsuite/g++.dg/gomp/pr99007.C b/gcc/testsuite/g++.dg/gomp/pr99007.C new file mode 100644 index 0000000..889bfab --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/pr99007.C @@ -0,0 +1,18 @@ +// PR middle-end/99007 +// { dg-additional-options "-Wno-div-by-zero" } + +template <typename T> +void +bar (T *) +{ + T s[0/0]; + #pragma omp teams distribute parallel for reduction(+:s) allocate(s) + for (int i = 0; i < 8; i++) + ; +} + +void +foo (long *a) +{ + bar (a); +} diff --git a/gcc/testsuite/g++.dg/lookup/pr99030.C b/gcc/testsuite/g++.dg/lookup/pr99030.C new file mode 100644 index 0000000..080847c --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/pr99030.C @@ -0,0 +1,16 @@ +// PR 99030 ICE with generic lambda accessing local extern +// { dg-do compile { target c++14 } } + +void foo () +{ + extern int a; + [] (auto b) { a; } (1); +} + +template<typename T> void bar () +{ + extern T a; + [] (auto b) { a; } (1); +} + +template void bar<int> (); diff --git a/gcc/testsuite/g++.dg/lto/pr96591_0.C b/gcc/testsuite/g++.dg/lto/pr96591_0.C new file mode 100644 index 0000000..ae2dc98 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/pr96591_0.C @@ -0,0 +1,45 @@ +// { dg-lto-do assemble } +// { dg-lto-options { { -O -flto } } } + +template <typename scalar_t, unsigned length> +struct builtin_simd +{ + using type [[gnu::vector_size(sizeof(scalar_t) * length)]] = scalar_t; +}; + +struct simd_traits +{ + using scalar_type = int; + + template <typename new_scalar_type> + using rebind = typename builtin_simd<new_scalar_type, 1>::type; +}; + +template <typename simd_t> +constexpr simd_t fill(typename simd_traits::scalar_type const scalar) +{ + return simd_t{scalar}; +} + +class Test +{ + using score_type = typename builtin_simd<int, 1>::type; + score_type data[1]{fill<score_type>(8)}; +}; + +struct TestFactoryBase +{ + virtual Test *CreateTest() = 0; +}; + +template <class TestClass> +struct TestFactoryImpl : public TestFactoryBase +{ + Test *CreateTest() override { return new TestClass; } +}; + +void MakeAndRegisterTestInfo(TestFactoryBase *factory); + +int main() { + MakeAndRegisterTestInfo(new TestFactoryImpl<Test>); +} diff --git a/gcc/testsuite/g++.dg/modules/pr98531-1.h b/gcc/testsuite/g++.dg/modules/pr98531-1.h new file mode 100644 index 0000000..62d4c1d --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr98531-1.h @@ -0,0 +1,13 @@ + +struct __waiters +{ + __waiters() noexcept; + ~__waiters () noexcept; + + static __waiters &_S_for() + { + static __waiters w; + + return w; + } +}; diff --git a/gcc/testsuite/g++.dg/modules/pr98531-1_a.H b/gcc/testsuite/g++.dg/modules/pr98531-1_a.H new file mode 100644 index 0000000..cbd2090 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr98531-1_a.H @@ -0,0 +1,6 @@ +// { dg-require-cxa-atexit "" } +// { dg-additional-options "-fmodule-header -fuse-cxa-atexit" } +// PR c++ 98531 no-context __cxa_atexit +// { dg-module-cmi {} } + +#include "pr98531-1.h" diff --git a/gcc/testsuite/g++.dg/modules/pr98531-1_b.C b/gcc/testsuite/g++.dg/modules/pr98531-1_b.C new file mode 100644 index 0000000..096cdc8 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr98531-1_b.C @@ -0,0 +1,5 @@ +// { dg-require-cxa-atexit "" } +// { dg-additional-options "-fmodules-ts -fno-module-lazy -fuse-cxa-atexit" } + +#include "pr98531-1.h" +import "pr98531-1_a.H"; diff --git a/gcc/testsuite/g++.dg/modules/pr98531-2.h b/gcc/testsuite/g++.dg/modules/pr98531-2.h new file mode 100644 index 0000000..62d4c1d --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr98531-2.h @@ -0,0 +1,13 @@ + +struct __waiters +{ + __waiters() noexcept; + ~__waiters () noexcept; + + static __waiters &_S_for() + { + static __waiters w; + + return w; + } +}; diff --git a/gcc/testsuite/g++.dg/modules/pr98531-2_a.H b/gcc/testsuite/g++.dg/modules/pr98531-2_a.H new file mode 100644 index 0000000..757d68a --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr98531-2_a.H @@ -0,0 +1,5 @@ +// { dg-additional-options "-fmodule-header -fno-use-cxa-atexit" } +// PR c++ 98531 no-context __cxa_atexit +// { dg-module-cmi {} } + +#include "pr98531-2.h" diff --git a/gcc/testsuite/g++.dg/modules/pr98531-2_b.C b/gcc/testsuite/g++.dg/modules/pr98531-2_b.C new file mode 100644 index 0000000..b5fa449 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr98531-2_b.C @@ -0,0 +1,4 @@ +// { dg-additional-options "-fmodules-ts -fno-module-lazy -fno-use-cxa-atexit" } + +#include "pr98531-2.h" +import "pr98531-2_a.H"; diff --git a/gcc/testsuite/g++.dg/modules/pr98531-3.h b/gcc/testsuite/g++.dg/modules/pr98531-3.h new file mode 100644 index 0000000..a1a2f8a --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr98531-3.h @@ -0,0 +1,13 @@ + +struct __waiters +{ + __waiters() noexcept; + ~__waiters () noexcept; + + static __waiters &_S_for() + { + static __waiters w[2]; + + return w[0]; + } +}; diff --git a/gcc/testsuite/g++.dg/modules/pr98531-3_a.H b/gcc/testsuite/g++.dg/modules/pr98531-3_a.H new file mode 100644 index 0000000..1c6267a --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr98531-3_a.H @@ -0,0 +1,5 @@ +// { dg-additional-options -fmodule-header } +// PR c++ 98531 no-context __tcf_0 +// { dg-module-cmi {} } + +#include "pr98531-3.h" diff --git a/gcc/testsuite/g++.dg/modules/pr98531-3_b.C b/gcc/testsuite/g++.dg/modules/pr98531-3_b.C new file mode 100644 index 0000000..7e3e16d3 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr98531-3_b.C @@ -0,0 +1,4 @@ +// { dg-additional-options "-fmodules-ts -fno-module-lazy" } + +#include "pr98531-3.h" +import "pr98531-3_a.H"; diff --git a/gcc/testsuite/g++.dg/modules/pr98944_a.C b/gcc/testsuite/g++.dg/modules/pr98944_a.C new file mode 100644 index 0000000..9475317 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr98944_a.C @@ -0,0 +1,9 @@ +// PR 98944, the example in [module.unit]/4 +// { dg-additional-options -fmodules-ts } + +// tu3 + +module A:Internals; +// { dg-module-cmi A:Internals } + +int bar(); diff --git a/gcc/testsuite/g++.dg/modules/pr98944_b.C b/gcc/testsuite/g++.dg/modules/pr98944_b.C new file mode 100644 index 0000000..209eafc --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr98944_b.C @@ -0,0 +1,8 @@ +// { dg-additional-options -fmodules-ts } + +// tu2 +export module A:Foo; +// { dg-module-cmi A:Foo } + +import :Internals; +export int foo() { return 2 * (bar() + 1); } diff --git a/gcc/testsuite/g++.dg/modules/pr98944_c.C b/gcc/testsuite/g++.dg/modules/pr98944_c.C new file mode 100644 index 0000000..90be60f --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr98944_c.C @@ -0,0 +1,8 @@ +// { dg-additional-options -fmodules-ts } + +// tu1 +export module A; +// { dg-module-cmi A } + +export import :Foo; +export int baz(); diff --git a/gcc/testsuite/g++.dg/modules/pr98944_d.C b/gcc/testsuite/g++.dg/modules/pr98944_d.C new file mode 100644 index 0000000..25364ab --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr98944_d.C @@ -0,0 +1,8 @@ +// { dg-additional-options -fmodules-ts } + +// tu4 +module A; + +import :Internals; +int bar() { return baz() - 10; } +int baz() { return 30; } diff --git a/gcc/testsuite/g++.dg/plugin/location-overflow-test-pr96391.c b/gcc/testsuite/g++.dg/plugin/location-overflow-test-pr96391.c new file mode 100644 index 0000000..1816961 --- /dev/null +++ b/gcc/testsuite/g++.dg/plugin/location-overflow-test-pr96391.c @@ -0,0 +1,12 @@ +/* { dg-options "-fplugin-arg-location_overflow_plugin-value=0x60000001" } */ + +/* We use location_overflow_plugin.c, which injects the case that location_t + values have exceeded LINE_MAP_MAX_LOCATION_WITH_COLS, and hence no column + numbers are available. */ + +/* Verify that we're in column-less mode. */ +extern unknown_type test; /* { dg-error "-:'unknown_type' does not name a type" } */ + +#define CONST const +#define VOID void +typedef CONST VOID *PCVOID; diff --git a/gcc/testsuite/g++.dg/plugin/plugin.exp b/gcc/testsuite/g++.dg/plugin/plugin.exp index 80c5355..5cd4b4b 100644 --- a/gcc/testsuite/g++.dg/plugin/plugin.exp +++ b/gcc/testsuite/g++.dg/plugin/plugin.exp @@ -72,6 +72,8 @@ set plugin_test_list [list \ ../../gcc.dg/plugin/diagnostic-test-string-literals-2.c \ ../../gcc.dg/plugin/diagnostic-test-string-literals-3.c \ ../../gcc.dg/plugin/diagnostic-test-string-literals-4.c } \ + { ../../gcc.dg/plugin/location_overflow_plugin.c \ + location-overflow-test-pr96391.c } \ { show_template_tree_color_plugin.c \ show-template-tree-color.C \ show-template-tree-color-labels.C \ diff --git a/gcc/testsuite/g++.dg/template/deduce10.C b/gcc/testsuite/g++.dg/template/deduce10.C new file mode 100644 index 0000000..165ff19 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/deduce10.C @@ -0,0 +1,23 @@ +// PR c++/95888 +// { dg-do compile { target c++17 } } + +template <typename T> class A { + A(int, int); + template <typename> friend class A; + friend T; +}; + +template<typename U> struct B { + template<auto V> struct C { + A<B> begin() { return {1, 0}; } + }; + template<auto Z, int *P = nullptr> + C<Z> fn(); +}; + +int +main () +{ + B<int> b; + b.fn<1>().begin(); +} diff --git a/gcc/testsuite/g++.dg/template/deduce9.C b/gcc/testsuite/g++.dg/template/deduce9.C new file mode 100644 index 0000000..5f55a84 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/deduce9.C @@ -0,0 +1,23 @@ +// PR c++/95888 +// { dg-do compile { target c++11 } } + +template <typename T> class A { + A(int, int); + template <typename> friend class A; + friend T; +}; + +template<typename U> struct B { + template<typename V> struct C { + A<B> begin() { return {1, 0}; } + }; + template<typename Z, int *P = nullptr> + C<Z> fn(); +}; + +int +main () +{ + B<int> b; + b.fn<int>().begin(); +} diff --git a/gcc/testsuite/g++.dg/vect/slp-pr98855.cc b/gcc/testsuite/g++.dg/vect/slp-pr98855.cc new file mode 100644 index 0000000..0b4e479 --- /dev/null +++ b/gcc/testsuite/g++.dg/vect/slp-pr98855.cc @@ -0,0 +1,84 @@ +// { dg-do compile } +// { dg-additional-options "-fvect-cost-model=cheap" } +// { dg-additional-options "-mavx2" { target x86_64-*-* i?86-*-* } } + +#include <stdint.h> +#include <stdlib.h> + +inline uint32_t make_uint32(uint8_t i0, uint8_t i1, uint8_t i2, uint8_t i3) +{ + return ((static_cast<uint32_t>(i0) << 24) | + (static_cast<uint32_t>(i1) << 16) | + (static_cast<uint32_t>(i2) << 8) | + (static_cast<uint32_t>(i3))); +} + +inline uint32_t load_be(const uint8_t in[], size_t off) +{ + in += off * sizeof(uint32_t); + return make_uint32(in[0], in[1], in[2], in[3]); +} + +template<typename T> +inline void load_be(const uint8_t in[], + T& x0, T& x1, T& x2, T& x3, + T& x4, T& x5, T& x6, T& x7) +{ + x0 = load_be(in, 0); + x1 = load_be(in, 1); + x2 = load_be(in, 2); + x3 = load_be(in, 3); + x4 = load_be(in, 4); + x5 = load_be(in, 5); + x6 = load_be(in, 6); + x7 = load_be(in, 7); +} + +inline void store_be(uint32_t in, uint8_t out[4]) +{ + uint32_t o = __builtin_bswap32 (in); + __builtin_memcpy (out, &o, sizeof (uint32_t)); +} + +template<typename T> +inline void store_be(uint8_t out[], T x0, T x1, T x2, T x3, + T x4, T x5, T x6, T x7) +{ + store_be(x0, out + (0 * sizeof(T))); + store_be(x1, out + (1 * sizeof(T))); + store_be(x2, out + (2 * sizeof(T))); + store_be(x3, out + (3 * sizeof(T))); + store_be(x4, out + (4 * sizeof(T))); + store_be(x5, out + (5 * sizeof(T))); + store_be(x6, out + (6 * sizeof(T))); + store_be(x7, out + (7 * sizeof(T))); +} + +#define BLOCK_SIZE 8 +void encrypt_n(const uint8_t in[], uint8_t out[], size_t blocks, uint32_t *EK) +{ + const size_t blocks4 = blocks / 4; + + for (size_t i = 0; i < blocks4; i++) + { + uint32_t L0, R0, L1, R1, L2, R2, L3, R3; + load_be(in + 4*BLOCK_SIZE*i, L0, R0, L1, R1, L2, R2, L3, R3); + + for(size_t r = 0; r != 32; ++r) + { + L0 += (((R0 << 4) ^ (R0 >> 5)) + R0) ^ EK[2*r]; + L1 += (((R1 << 4) ^ (R1 >> 5)) + R1) ^ EK[2*r]; + L2 += (((R2 << 4) ^ (R2 >> 5)) + R2) ^ EK[2*r]; + L3 += (((R3 << 4) ^ (R3 >> 5)) + R3) ^ EK[2*r]; + + R0 += (((L0 << 4) ^ (L0 >> 5)) + L0) ^ EK[2*r+1]; + R1 += (((L1 << 4) ^ (L1 >> 5)) + L1) ^ EK[2*r+1]; + R2 += (((L2 << 4) ^ (L2 >> 5)) + L2) ^ EK[2*r+1]; + R3 += (((L3 << 4) ^ (L3 >> 5)) + L3) ^ EK[2*r+1]; + } + + store_be(out + 4*BLOCK_SIZE*i, L0, R0, L1, R1, L2, R2, L3, R3); + } +} + +// { dg-final { scan-tree-dump-times "not vectorized: vectorization is not profitable" 2 "slp1" { target x86_64-*-* i?86-*-* } } } diff --git a/gcc/testsuite/g++.dg/warn/Warray-bounds-16.C b/gcc/testsuite/g++.dg/warn/Warray-bounds-16.C new file mode 100644 index 0000000..17b4d0d --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Warray-bounds-16.C @@ -0,0 +1,29 @@ +/* PR tree-optimization/92879 - incorrect warning of __builtin_memset + offset is out of the bounds on zero-size allocation and initialization + { dg-do compile } + { dg-options "-O2 -Wall -fdump-tree-optimized" } */ + +inline void* operator new (__SIZE_TYPE__, void * v) +{ + return v; +} + +struct S +{ + int* p; + int m; + + S (int i) + { + m = i; + p = (int*) new unsigned char [sizeof (int) * m]; + + for (int i = 0; i < m; i++) + new (p + i) int (); + } +}; + +S a (0); + +/* Verify the loop has been eliminated. + { dg-final { scan-tree-dump-not "goto" "optimized" } } */ diff --git a/gcc/testsuite/g++.dg/warn/Wsize_t-literals.C b/gcc/testsuite/g++.dg/warn/Wsize_t-literals.C new file mode 100644 index 0000000..ef910a5 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wsize_t-literals.C @@ -0,0 +1,12 @@ +// { dg-do compile { target c++11 } } + +#include <cstddef> +#include <type_traits> + +std::size_t s1 = 1234zu; // { dg-warning {use of C\+\+23 .size_t. integer constant} "" { target c++20_down } } +std::size_t S1 = 5678ZU; // { dg-warning {use of C\+\+23 .size_t. integer constant} "" { target c++20_down } } +std::size_t s2 = 1234uz; // { dg-warning {use of C\+\+23 .size_t. integer constant} "" { target c++20_down } } +std::size_t S2 = 5678UZ; // { dg-warning {use of C\+\+23 .size_t. integer constant} "" { target c++20_down } } + +std::make_signed<std::size_t>::type pd1 = 1234z; // { dg-warning {use of C\+\+23 .make_signed_t<size_t>. integer constant} "" { target c++20_down } } +std::make_signed<std::size_t>::type PD1 = 5678Z; // { dg-warning {use of C\+\+23 .make_signed_t<size_t>. integer constant} "" { target c++20_down } } diff --git a/gcc/testsuite/g++.dg/warn/Wstringop-overread-1.C b/gcc/testsuite/g++.dg/warn/Wstringop-overread-1.C new file mode 100644 index 0000000..f7ba617 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wstringop-overread-1.C @@ -0,0 +1,12 @@ +// PR middle-end/98994 +// { dg-do compile } +// { dg-additional-options "-Wstringop-overread -O2" } + +#include <string> + +const char constantString[] = {42, 53}; + +void f(std::string& s) +{ + s.insert(0, static_cast<const char*>(constantString), 2); +} diff --git a/gcc/testsuite/g++.target/i386/avx512bw-pr98537-1.C b/gcc/testsuite/g++.target/i386/avx512bw-pr98537-1.C new file mode 100644 index 0000000..969684a --- /dev/null +++ b/gcc/testsuite/g++.target/i386/avx512bw-pr98537-1.C @@ -0,0 +1,11 @@ +/* PR target/98537 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -march=x86-64 -std=c++11" } */ + +#define TYPEV char +#define TYPEW short + +#define T_ARR \ + __attribute__ ((target ("avx512vl,avx512bw"))) + +#include "avx512vl-pr98537-1.C" diff --git a/gcc/testsuite/g++.target/i386/avx512vl-pr98537-1.C b/gcc/testsuite/g++.target/i386/avx512vl-pr98537-1.C new file mode 100644 index 0000000..b2ba911 --- /dev/null +++ b/gcc/testsuite/g++.target/i386/avx512vl-pr98537-1.C @@ -0,0 +1,40 @@ +/* PR target/98537 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -march=x86-64 -std=c++11" } */ + +#ifndef TYPEV +#define TYPEV int +#endif + +#ifndef TYPEW +#define TYPEW long long +#endif + +#ifndef T_ARR +#define T_ARR \ + __attribute__ ((target ("avx512vl"))) +#endif + +typedef TYPEV V __attribute__((__vector_size__(32))); +typedef TYPEW W __attribute__((__vector_size__(32))); + +W c, d; +struct B {}; +B e; +struct C { W i; }; +void foo (C); + +C +operator== (B, B) +{ + W r = (V)c == (V)d; + return {r}; +} + +void +T_ARR +bar () +{ + B a; + foo (a == e); +} diff --git a/gcc/testsuite/g++.target/i386/avx512vl-pr98537-2.C b/gcc/testsuite/g++.target/i386/avx512vl-pr98537-2.C new file mode 100644 index 0000000..42c9682 --- /dev/null +++ b/gcc/testsuite/g++.target/i386/avx512vl-pr98537-2.C @@ -0,0 +1,8 @@ +/* PR target/98537 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -march=x86-64 -std=c++11" } */ + +#define TYPEV float +#define TYPEW double + +#include "avx512vl-pr98537-1.C" diff --git a/gcc/testsuite/g++.target/powerpc/pr99041.C b/gcc/testsuite/g++.target/powerpc/pr99041.C new file mode 100644 index 0000000..c83f980 --- /dev/null +++ b/gcc/testsuite/g++.target/powerpc/pr99041.C @@ -0,0 +1,84 @@ +/* PR target/99041 */ +/* { dg-require-effective-target power10_ok } */ +/* { dg-options "-O2 -mdejagnu-cpu=power10 -w" } */ + +/* Verify we do not ICE on the following source. */ + +long a, b, c, d, e; + enum { f }; + enum { g, aa }; + enum { h }; + template < typename > struct ai; + template < typename > struct ad; + template < typename, int, int ah, int = 0, int = f, int = ah > class ab; + template < typename > class ar; + template < typename > class ak; + template < typename, int, int = 1, bool = false > class aj; + template < typename > class an; + template < typename, typename > class al; + template < typename, typename, int = h > class am; + template < typename, unsigned > class ao; + template < typename > struct ap; + template < typename aq > struct av { typedef ar< aq > ac; }; + template < typename > struct as { typedef av< am< al< int, an< aj< ab< double, 5, 2 >, false > > >, int > >::ac ac; }; + template < typename at > at au(const typename ap< at >::ac *); + template < typename at, int > at cc(typename ap< at >::ac *aw) { return au< at >(aw); } + typedef __attribute__((altivec(vector__))) double ax; + template <> struct ap< ax > { typedef double ac; }; + template <> ax au(const double *aw) { return __builtin_vec_vsx_ld(0, aw); } + template < typename > struct ay {}; + template < typename aq > class ae : public ad< aq > { public: typedef typename ai< aq >::ba ba; }; + template < typename aq > class ar : public ae< aq > { public: ak< aq > bk(); }; + template < typename > struct ad {}; + template < int > class bc; + template < typename bd, typename bf, int bg > struct ai< am< bd, bf, bg > > { typedef typename bd::ba ba; }; + template < typename bh, typename bj, int bg > class am : public bc< bg > { public: bh bu(); bj k(); }; + template < int bg > class bc : public as< am< int, int, bg > >::ac {}; + template < typename, typename, typename > struct l; + template < typename m, typename bl, typename ag > void n(m bm, bl bn, ag bo) { l< m, bl, ag >::bz(bm, bn, bo); } + template < typename, typename, typename, typename > struct bp; + class o { public: o(double *, long); double &operator()(long i, long j) { return p[aa ? j + i * w : w]; } template < typename q, int t > q br(long i, long j) { double &cl = operator()(i, j); return cc< q, t >(&cl); } double *p; long w; }; + class bt : public o { public: bt(double *cf, long bv) : o(cf, bv) {} }; + struct bw { enum { bx }; }; + template < typename bq > class ak { public: template < typename by > void operator=(by) { am< al< const an< const aj< aj< ab< double, 5, 5, 2 >, -1, -1 >, -1 > >, const an< const aj< aj< ab< double, 5, 5, 2 >, -1, -1 >, -1 > > >, ao< aj< ab< double, 5, 0 >, 1 >, 0 > > ck; n(ca, ck, ay< typename by::ba >()); } bq ca; }; + template < typename aq > class dn : public av< aq >::ac {}; + template < typename cd, int af, int ah, int ce, int co, int cg > struct ai< ab< cd, af, ah, ce, co, cg > > { typedef cd ba; enum { bs }; }; + template < typename, int, int, int, int co, int cg > class ab : public dn< ab< int, co, cg > > { public: template < typename by > ab(by); }; + template < typename, typename ch > class al : public ch {}; + template < typename aq > class az { public: typedef typename ai< aq >::ba ba; typedef const ba *ci; ba &cj(long); }; + template < typename ct > class bb : public az< ct > { public: bb(typename bb::ci, long); }; + template < typename cx, int cm, int cn, bool da > struct ai< aj< cx, cm, cn, da > > : ai< cx > {}; + template < typename > class cp; + template < typename cx, int, int, bool > class aj : public cp< cx > { public: aj(cx, long, long, long, long); }; + template < typename cx > class cp : public av< aj< cx, 1 > >::ac {}; + template < typename cq > class an : public cq {}; + template < typename cq, unsigned cr > struct ai< ao< cq, cr > > { typedef cq cs; }; + template < typename, unsigned > class ao { public: typedef aj< ab< double, 5, 0 >, 1 > cq; typename ai< ao >::cs cu(); }; + template < typename, typename > struct cv; + template < typename cw, typename bd, typename bf, int dh, typename ba > struct l< cw, am< bd, bf, dh >, ay< ba > > { static void bz(cw bm, am< bd, bf > bn, ay< ba >) { cv< bd, bf >::cy(bm, bn.bu(), bn.k()); } }; + template < typename bf, typename aq > struct cz { template < typename m > static void cy(m bm, al< const an< const aj< aj< ab< double, 5, 5, 2 >, -1, -1 >, -1 > >, const an< const aj< aj< ab< double, 5, 5, 2 >, -1, -1 >, -1 > > > bu, bf) { dl(bm, bu); } template < typename m > static void dl(m bm, al< const an< const aj< aj< ab< double, 5, 5, 2 >, -1, -1 >, -1 > >, const an< const aj< aj< ab< double, 5, 5, 2 >, -1, -1 >, -1 > > > bu) { typename alpha; bf k; aq::dl(bm, bu, k, alpha); } }; + template < typename, typename, bool > struct u; + template < typename bd, typename bf > struct cv : cz< bf, cv< bd, bf > > { template < typename v > static void dl(v bm, bd bu, bf k, typename am< bd, bf >::ba alpha) { u< bd, typename bf::cq, false >::bz(bm, bu, k.cu(), alpha); } }; + template < typename, int, typename, bool, typename, bool, int, int = g > struct db; + template < typename cb, int x, typename z, bool dc, typename dd, bool de, int df > struct db< cb, x, z, dc, dd, de, aa, df > { typedef z dg; static void bz(cb, cb, const z *, cb, const dd *, cb, dg *, cb, const dg &); }; + template < typename cb, int x, typename z, bool dc, typename dd, bool de, int df > void db< cb, x, z, dc, dd, de, aa, df >::bz(cb, cb, const z *_lhs, cb di, const dd *dj, cb dk, dg *_res, cb dm, const dg &alpha) { cb cols; bb< ab< z, 1, aa > > bu(_lhs, cols), res(_res, dm); bb< ab< dd, 1, 1 > > k(dj, cols); for (cb pi;;) { cb actualPanelWidth, s, r; bp< cb, bt, dd, bt >::bz(actualPanelWidth, r, bt(&bu.cj(s), di), bt(&k.cj(s), dk), &res.cj(pi), dm, alpha); } } + template < int, int > struct trmv_selector; + template < typename bd, typename bf > struct u< bd, bf, false > { template < typename v > static void bz(v bm, bd bu, bf k, typename v::ba alpha) { v dstT(bm); trmv_selector< 0, ai< bf >::bs ?: aa >::bz(k, bu, dstT, alpha); } }; + template < int x > struct trmv_selector< x, aa > { template < typename bd, typename bf, typename v > static void bz(bd, bf, v, typename v::ba) { typedef typename bf::ba dd; typedef bw LhsBlasTraits; typedef bw RhsBlasTraits; typename actualAlpha; dd actualRhsPtr; db< long, x, typename bd::ba, LhsBlasTraits::bx, dd, RhsBlasTraits::bx, aa >::bz(0, 0, 0, 0, &actualRhsPtr, 1, 0, 0, actualAlpha); } }; + template < typename LhsPacket, typename, bool > void pger_vec(__vector_quad *, __vector_pair &, LhsPacket); + template < typename, typename, typename, typename, typename, typename > void gemv_row(bt alhs) { typedef ax LhsPacket; typedef ax RhsPacket; bt bu(alhs); enum { LhsAlignment, LhsPacketSize }; long i, j; __vector_quad c0; for (;; j += LhsPacketSize) { RhsPacket b0; __vector_pair b00; __builtin_mma_assemble_pair(&b00, (__attribute__((altivec(vector__))) char) bu.br< LhsPacket, LhsAlignment >(1, j), (__attribute__((altivec(vector__))) char) bu.br< LhsPacket, LhsAlignment >(i, j)); pger_vec< LhsPacket, RhsPacket, true >(&c0, b00, b0); } } + template < typename cb, typename LhsMapper, typename RhsMapper > struct bp< cb, LhsMapper, double, RhsMapper > { static void bz(cb, cb, LhsMapper bu, RhsMapper, double *, cb, double) { gemv_row< cb, double, LhsMapper, double, RhsMapper, double >(bu); } }; + class be { public: template < typename v, typename Workspace > void cy(v, Workspace workspace) { applyThisOnTheLeft(workspace, true); } template < typename v, typename Workspace > void applyThisOnTheLeft(v bm, Workspace) { aj< ab< double, 5, 0 >, 1 > sub_vecs1(m_vectors, c, a, c, b); aj< v, 1 > sub_dst(bm, d, 0, e, 0); apply_block_householder_on_the_left(sub_dst, sub_vecs1, b); } ab< double, 5, 5 > m_vectors; }; + template < typename TriangularFactorType, typename VectorsType, typename CoeffsType > void make_block_householder_triangular_factor(TriangularFactorType triFactor, VectorsType vectors, CoeffsType) { triFactor.bk() = vectors; } + template < typename cq, typename VectorsType, typename CoeffsType > void apply_block_householder_on_the_left(cq, VectorsType vectors, CoeffsType hCoeffs) { enum { TFactorSize }; ab< typename cq::ba, TFactorSize, aa > y(0); make_block_householder_triangular_factor(y, vectors, hCoeffs); } + class HessenbergDecomposition { public: be matrixQ(); }; + template < typename > class RealSchur { public: enum { MaxColsAtCompileTime }; template < typename InputType > RealSchur &compute(const ad< InputType > &, bool); ab< double, 5, 5 > m_matU; ab< double, MaxColsAtCompileTime, 1 > m_workspaceVector; HessenbergDecomposition m_hess; }; + template < typename cq > template < typename InputType > RealSchur< cq > &RealSchur< cq >::compute(const ad< InputType > &, bool) { m_hess.matrixQ().cy(m_matU, m_workspaceVector); } + template < typename > class EigenSolver { public: EigenSolver(); template < typename InputType > EigenSolver &compute(const ad< InputType > &, bool = true); RealSchur< int > m_realSchur; }; + template < typename cq > template < typename InputType > EigenSolver< cq > &EigenSolver< cq >::compute(const ad< InputType > &matrix, bool computeEigenvectors) { m_realSchur.compute(matrix, computeEigenvectors); } + class PolynomialSolver { public: PolynomialSolver(ab< double, 0, 1 >) { ab< int, 0, 0 > __trans_tmp_1 = m_eigenSolver.compute(__trans_tmp_1); } EigenSolver< double > m_eigenSolver; }; + struct increment_if_fixed_size { enum { bi }; }; + template < int, typename, typename > void aux_evalSolver(ab< double, 0, 1 > pols) { PolynomialSolver solve_constr(pols); } + template < int Deg, typename > void evalSolver(ab< double, 0, 1 > pols) { aux_evalSolver< Deg, ab< double, 0, 1 >, PolynomialSolver >(pols); } + template < typename, int _Deg > void polynomialsolver(int) { ab< double, increment_if_fixed_size::bi, 1 > pols = 1; evalSolver< _Deg, ab< double, increment_if_fixed_size::bi, 1 > >(pols); } + void test_polynomialsolver() { polynomialsolver< double, 5 >(5); } diff --git a/gcc/testsuite/gcc.dg/analyzer/explode-1.c b/gcc/testsuite/gcc.dg/analyzer/explode-1.c index 9b95afd..6b62e8e 100644 --- a/gcc/testsuite/gcc.dg/analyzer/explode-1.c +++ b/gcc/testsuite/gcc.dg/analyzer/explode-1.c @@ -47,7 +47,7 @@ void test (void) { default: case 0: - *pp = malloc (16); /* { dg-warning "leak" } */ + *pp = malloc (16); break; case 1: free (*pp); diff --git a/gcc/testsuite/gcc.dg/analyzer/file-1.c b/gcc/testsuite/gcc.dg/analyzer/file-1.c index f2b77b9d..f9afa88 100644 --- a/gcc/testsuite/gcc.dg/analyzer/file-1.c +++ b/gcc/testsuite/gcc.dg/analyzer/file-1.c @@ -47,3 +47,10 @@ test_4 (const char *path) return; /* { dg-warning "leak of FILE 'f'" } */ } + +void +test_5 (const char *path) +{ + FILE *f = fopen (path, "r"); /* { dg-message "opened here" } */ + return; /* { dg-warning "leak of FILE 'f'" } */ +} diff --git a/gcc/testsuite/gcc.dg/analyzer/file-3.c b/gcc/testsuite/gcc.dg/analyzer/file-3.c new file mode 100644 index 0000000..8f93a98 --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/file-3.c @@ -0,0 +1,18 @@ +typedef struct _IO_FILE FILE; +extern struct _IO_FILE *stderr; + +extern FILE *fopen (const char *__restrict __filename, + const char *__restrict __modes); +extern int _IO_getc (FILE *stream); + +void +test_1 (const char *path) +{ + FILE *f = fopen (path, "r"); /* { dg-message "opened here" } */ + + /* Implementation of getc in glibc < 2.28. + Verify that we know that this doesn't close the file. */ + _IO_getc (f); + + return; /* { dg-warning "leak of FILE 'f'" } */ +} diff --git a/gcc/testsuite/gcc.dg/analyzer/pr94851-2.c b/gcc/testsuite/gcc.dg/analyzer/pr94851-2.c new file mode 100644 index 0000000..6094721 --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/pr94851-2.c @@ -0,0 +1,54 @@ +/* As pr94851-1.c, but verify that we don't get confused by a call to + an unknown function (PR analyzer/98575). */ + +/* { dg-additional-options "-O2" } */ + +#include <stdio.h> +#include <stdlib.h> + +typedef struct AMARK { + struct AMARK *m_next; + char m_name; +} AMARK; + +struct buf { + AMARK *b_amark; +}; + +struct buf *curbp; + +extern void unknown_fn (void); + +int pamark(void) { + int c; + + AMARK *p = curbp->b_amark; + AMARK *last = curbp->b_amark; + + unknown_fn (); + + c = getchar (); + + while (p != (AMARK *)NULL && p->m_name != (char)c) { + last = p; + p = p->m_next; + } + + if (p != (AMARK *)NULL) { + printf("over writing mark %c\n", c); + } else { + if ((p = (AMARK *)malloc(sizeof(AMARK))) == (AMARK *)NULL) + return 0; + + p->m_next = (AMARK *)NULL; + + if (curbp->b_amark == (AMARK *)NULL) + curbp->b_amark = p; + else + last->m_next = p; + } + + p->m_name = (char)c; /* { dg-bogus "leak of 'p'" "bogus leak" } */ + + return 1; +} diff --git a/gcc/testsuite/gcc.dg/analyzer/pr98575-1.c b/gcc/testsuite/gcc.dg/analyzer/pr98575-1.c new file mode 100644 index 0000000..6472e76 --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/pr98575-1.c @@ -0,0 +1,46 @@ +/* A malloced pointer that's written to a global pointer shouldn't be + reported as leaking, even if an unknown function has been called + (PR analyzer/98575). */ + +void **g; + +extern void unknown_fn (void); + +/* Without a call to unknown_fn. */ + +int test_1 (void) +{ + void *p; + p = __builtin_malloc(1024); + *g = p; + return 0; +} + +/* With a call to unknown_fn in various places. */ + +int test_2 (void) +{ + void *p; + unknown_fn (); + p = __builtin_malloc(1024); + *g = p; + return 0; +} + +int test_3 (void) +{ + void *p; + p = __builtin_malloc(1024); + unknown_fn (); + *g = p; + return 0; +} + +int test_4 (void) +{ + void *p; + p = __builtin_malloc(1024); + *g = p; + unknown_fn (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/analyzer/pr98969.c b/gcc/testsuite/gcc.dg/analyzer/pr98969.c new file mode 100644 index 0000000..8298f26 --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/pr98969.c @@ -0,0 +1,18 @@ +struct foo +{ + char *expr; +}; + +void +test_1 (long int i) +{ + struct foo *f = (struct foo *)i; + f->expr = __builtin_malloc (1024); +} /* { dg-bogus "leak" "PR analyzer/98969" { xfail *-*-* } } */ + +void +test_2 (long int i) +{ + __builtin_free (((struct foo *)i)->expr); + __builtin_free (((struct foo *)i)->expr); /* { dg-warning "double-'free' of '\\*\\(\\(struct foo \\*\\)i\\)\\.expr'" } */ +} diff --git a/gcc/testsuite/gcc.dg/array-quals-1.c b/gcc/testsuite/gcc.dg/array-quals-1.c index c8d3629..5d9170e 100644 --- a/gcc/testsuite/gcc.dg/array-quals-1.c +++ b/gcc/testsuite/gcc.dg/array-quals-1.c @@ -8,44 +8,44 @@ /* { dg-final { scan-assembler-not "\\.data(?!\\.rel\\.ro)" { xfail powerpc*-*-aix* mmix-*-* x86_64-*-mingw* } } } */ /* { dg-final { scan-assembler-symbol-section {^_?a$} {^\.(const|rodata|srodata)|\[RO\]} } } */ static const int a[2] = { 1, 2 }; -/* { dg-final { scan-assembler-symbol-section {^_?a1$} {^\.(const|rodata|srodata)|\[RO\]} } } */ +/* { dg-final { scan-assembler-symbol-section {^_?a1$} {^\.(const|rodata|srodata|sdata)|\[RO\]} } } */ const int a1[2] = { 1, 2 }; typedef const int ci; /* { dg-final { scan-assembler-symbol-section {^_?b$} {^\.(const|rodata|srodata)|\[RO\]} } } */ static ci b[2] = { 3, 4 }; -/* { dg-final { scan-assembler-symbol-section {^_?b1$} {^\.(const|rodata|srodata)|\[RO\]} } } */ +/* { dg-final { scan-assembler-symbol-section {^_?b1$} {^\.(const|rodata|srodata|sdata)|\[RO\]} } } */ ci b1[2] = { 3, 4 }; typedef int ia[2]; /* { dg-final { scan-assembler-symbol-section {^_?c$} {^\.(const|rodata|srodata)|\[RO\]} } } */ static const ia c = { 5, 6 }; -/* { dg-final { scan-assembler-symbol-section {^_?c1$} {^\.(const|rodata|srodata)|\[RO\]} } } */ +/* { dg-final { scan-assembler-symbol-section {^_?c1$} {^\.(const|rodata|srodata|sdata)|\[RO\]} } } */ const ia c1 = { 5, 6 }; typedef const int cia[2]; /* { dg-final { scan-assembler-symbol-section {^_?d$} {^\.(const|rodata|srodata)|\[RO\]} } } */ static cia d = { 7, 8 }; -/* { dg-final { scan-assembler-symbol-section {^_?d1$} {^\.(const|rodata|srodata)|\[RO\]} } } */ +/* { dg-final { scan-assembler-symbol-section {^_?d1$} {^\.(const|rodata|srodata|sdata)|\[RO\]} } } */ cia d1 = { 7, 8 }; /* { dg-final { scan-assembler-symbol-section {^_?e$} {^\.(const|rodata|srodata)|\[RO\]} } } */ static cia e[2] = { { 1, 2 }, { 3, 4 } }; -/* { dg-final { scan-assembler-symbol-section {^_?e1$} {^\.(const|rodata|srodata)|\[RO\]} } } */ +/* { dg-final { scan-assembler-symbol-section {^_?e1$} {^\.(const|rodata|srodata|sdata)|\[RO\]} } } */ cia e1[2] = { { 1, 2 }, { 3, 4 } }; -/* { dg-final { scan-assembler-symbol-section {^_?p$} {^\.(const|rodata|srodata)|\[RW\]} } } */ +/* { dg-final { scan-assembler-symbol-section {^_?p$} {^\.(const|rodata|srodata|sdata)|\[RW\]} } } */ void *const p = &a; -/* { dg-final { scan-assembler-symbol-section {^_?q$} {^\.(const|rodata|srodata)|\[RW\]} } } */ +/* { dg-final { scan-assembler-symbol-section {^_?q$} {^\.(const|rodata|srodata|sdata)|\[RW\]} } } */ void *const q = &b; -/* { dg-final { scan-assembler-symbol-section {^_?r$} {^\.(const|rodata|srodata)|\[RW\]} } } */ +/* { dg-final { scan-assembler-symbol-section {^_?r$} {^\.(const|rodata|srodata|sdata)|\[RW\]} } } */ void *const r = &c; -/* { dg-final { scan-assembler-symbol-section {^_?s$} {^\.(const|rodata|srodata)|\[RW\]} } } */ +/* { dg-final { scan-assembler-symbol-section {^_?s$} {^\.(const|rodata|srodata|sdata)|\[RW\]} } } */ void *const s = &d; -/* { dg-final { scan-assembler-symbol-section {^_?t$} {^\.(const|rodata|srodata)|\[RW\]} } } */ +/* { dg-final { scan-assembler-symbol-section {^_?t$} {^\.(const|rodata|srodata|sdata)|\[RW\]} } } */ void *const t = &e; -/* { dg-final { scan-assembler-symbol-section {^_?p1$} {^\.(const|rodata|srodata)|\[RW\]} } } */ +/* { dg-final { scan-assembler-symbol-section {^_?p1$} {^\.(const|rodata|srodata|sdata)|\[RW\]} } } */ void *const p1 = &a1; -/* { dg-final { scan-assembler-symbol-section {^_?q1$} {^\.(const|rodata|srodata)|\[RW\]} } } */ +/* { dg-final { scan-assembler-symbol-section {^_?q1$} {^\.(const|rodata|srodata|sdata)|\[RW\]} } } */ void *const q1 = &b1; -/* { dg-final { scan-assembler-symbol-section {^_?r1$} {^\.(const|rodata|srodata)|\[RW\]} } } */ +/* { dg-final { scan-assembler-symbol-section {^_?r1$} {^\.(const|rodata|srodata|sdata)|\[RW\]} } } */ void *const r1 = &c1; -/* { dg-final { scan-assembler-symbol-section {^_?s1$} {^\.(const|rodata|srodata)|\[RW\]} } } */ +/* { dg-final { scan-assembler-symbol-section {^_?s1$} {^\.(const|rodata|srodata|sdata)|\[RW\]} } } */ void *const s1 = &d1; -/* { dg-final { scan-assembler-symbol-section {^_?t1$} {^\.(const|rodata|srodata)|\[RW\]} } } */ +/* { dg-final { scan-assembler-symbol-section {^_?t1$} {^\.(const|rodata|srodata|sdata)|\[RW\]} } } */ void *const t1 = &e1; diff --git a/gcc/testsuite/gcc.dg/cpp/pr98882.c b/gcc/testsuite/gcc.dg/cpp/pr98882.c new file mode 100644 index 0000000..e831df0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/pr98882.c @@ -0,0 +1,6 @@ +/* PR preprocessor/98882 */ +/* { dg-do preprocess } */ +/* { dg-options "-fdirectives-only" } */ + +/* Last line does not end with a newline. */ + /*Here*/
\ No newline at end of file diff --git a/gcc/testsuite/gcc.dg/decl-8.c b/gcc/testsuite/gcc.dg/decl-8.c index 485065b..608ff97 100644 --- a/gcc/testsuite/gcc.dg/decl-8.c +++ b/gcc/testsuite/gcc.dg/decl-8.c @@ -3,8 +3,8 @@ /* { dg-do compile } */ /* { dg-options "-std=gnu89 -pedantic-errors" } */ -typedef int I; /* { dg-message "note: previous declaration of 'I' was here" } */ +typedef int I; /* { dg-message "note: previous declaration of 'I'" "note" } */ typedef int I; /* { dg-error "redefinition of typedef 'I'" } */ -typedef int I1; /* { dg-message "note: previous declaration of 'I1' was here" } */ +typedef int I1; /* { dg-message "note: previous declaration of 'I1'" "note" } */ typedef long I1; /* { dg-error "conflicting types for 'I1'" } */ diff --git a/gcc/testsuite/gcc.dg/gomp/pr99007-1.c b/gcc/testsuite/gcc.dg/gomp/pr99007-1.c new file mode 100644 index 0000000..d46957b --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/pr99007-1.c @@ -0,0 +1,13 @@ +/* PR middle-end/99007 */ + +void +bar (int n) +{ + int i; + long s[n]; + for (i = 0; i < n; i++) + s[i] = 0; + #pragma omp teams distribute parallel for reduction(+:s) allocate(s) + for (i = 0; i < 8; i++) + s[3]++; +} diff --git a/gcc/testsuite/gcc.dg/gomp/pr99007-2.c b/gcc/testsuite/gcc.dg/gomp/pr99007-2.c new file mode 100644 index 0000000..3909931 --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/pr99007-2.c @@ -0,0 +1,15 @@ +/* PR middle-end/99007 */ + +int +bar (int n) +{ + int s[n]; + int i, j; + for (i = 0; i < n; i++) + s[i] = 0; + #pragma omp teams distribute parallel for reduction(+:s) private (j) + for (i = 0; i < 8; i++) + for (j = 0; j < n; j++) + s[j] += i; + return s[0] + s[n - 1]; +} diff --git a/gcc/testsuite/gcc.dg/gomp/pr99007-3.c b/gcc/testsuite/gcc.dg/gomp/pr99007-3.c new file mode 100644 index 0000000..c6db941 --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/pr99007-3.c @@ -0,0 +1,16 @@ +/* PR middle-end/99007 */ + +int +bar (int n) +{ + int s[n]; + int i, j; + for (i = 0; i < n; i++) + s[i] = 0; + #pragma omp parallel reduction(+:s) num_threads(2) + #pragma omp parallel for reduction(+:s) private (j) + for (i = 0; i < 8; i++) + for (j = 0; j < n; j++) + s[j] += i; + return s[0] + s[n - 1]; +} diff --git a/gcc/testsuite/gcc.dg/label-decl-4.c b/gcc/testsuite/gcc.dg/label-decl-4.c index 5661e01..82f1af0 100644 --- a/gcc/testsuite/gcc.dg/label-decl-4.c +++ b/gcc/testsuite/gcc.dg/label-decl-4.c @@ -7,8 +7,8 @@ void f (void) { __label__ a, b, a; /* { dg-error "duplicate label declaration 'a'" } */ - /* { dg-message "note: previous declaration of 'a' was here" "previous" { target *-*-* } .-1 } */ - __label__ c; /* { dg-message "note: previous declaration of 'c' was here" } */ + /* { dg-message "note: previous declaration of 'a'" "previous" { target *-*-* } .-1 } */ + __label__ c; /* { dg-message "note: previous declaration of 'c'" "note" } */ __label__ c; /* { dg-error "duplicate label declaration 'c'" } */ return; } diff --git a/gcc/testsuite/gcc.dg/mismatch-decl-1.c b/gcc/testsuite/gcc.dg/mismatch-decl-1.c index da4db0a..b6dd543 100644 --- a/gcc/testsuite/gcc.dg/mismatch-decl-1.c +++ b/gcc/testsuite/gcc.dg/mismatch-decl-1.c @@ -4,12 +4,12 @@ /* The bug this is testing is that if a new decl conflicts with an explicit decl, you don't get the "changes type of builtin" message, - but if there was *also* a builtin, you *also* don't get the - "previous declaration was here" message, leaving you with no clue - where the previous declaration came from. */ + but if there was *also* a builtin, you *also* don't get the "previous + declaration" message, leaving you with no clue where the previous + declaration came from. */ -extern char foo(int,int); /* { dg-message "previous declaration of 'foo' was here" } */ -extern char *index(const char *,int); /* { dg-message "previous declaration of 'index' was here" } */ +extern char foo(int,int); /* { dg-message "previous declaration of 'foo'" "note" } */ +extern char *index(const char *,int); /* { dg-message "previous declaration of 'index'" "note" } */ /* This changes the type of "index", which is both a builtin and an explicit decl. */ diff --git a/gcc/testsuite/gcc.dg/old-style-then-proto-1.c b/gcc/testsuite/gcc.dg/old-style-then-proto-1.c index 7d76287..e3e6186 100644 --- a/gcc/testsuite/gcc.dg/old-style-then-proto-1.c +++ b/gcc/testsuite/gcc.dg/old-style-then-proto-1.c @@ -7,38 +7,38 @@ void f1() {} void f1(void); /* { dg-warning "prototype for 'f1' follows non-prototype definition" } */ -void f2() {} /* { dg-message "note: previous definition of 'f2' was here" } */ +void f2() {} /* { dg-message "note: previous definition of 'f2'" "note" } */ void f2(int); /* { dg-error "prototype for 'f2' declares more arguments than previous old-style definition" } */ -void f3(a) int a; {} /* { dg-message "note: previous definition of 'f3' was here" } */ +void f3(a) int a; {} /* { dg-message "note: previous definition of 'f3'" "note" } */ void f3(void); /* { dg-error "prototype for 'f3' declares fewer arguments than previous old-style definition" } */ void f4(a) int a; {} void f4(int); /* { dg-warning "prototype for 'f4' follows non-prototype definition" } */ -void f5(a) int a; {} /* { dg-message "note: previous definition of 'f5' was here" } */ +void f5(a) int a; {} /* { dg-message "note: previous definition of 'f5'" "note" } */ void f5(int, int); /* { dg-error "prototype for 'f5' declares more arguments than previous old-style definition" } */ -void f6(a) int a; {} /* { dg-message "note: previous definition of 'f6' was here" } */ +void f6(a) int a; {} /* { dg-message "note: previous definition of 'f6'" "note" } */ void f6(int, ...); /* { dg-error "conflicting types for 'f6'" } */ -void f7(a, b) int a, b; {} /* { dg-message "note: previous definition of 'f7' was here" } */ +void f7(a, b) int a, b; {} /* { dg-message "note: previous definition of 'f7'" "note" } */ void f7(int); /* { dg-error "prototype for 'f7' declares fewer arguments than previous old-style definition" } */ -void f8(a, b) int a, b; {} /* { dg-message "note: previous definition of 'f8' was here" } */ +void f8(a, b) int a, b; {} /* { dg-message "note: previous definition of 'f8'" "note" } */ void f8(int, ...); /* { dg-error "conflicting types for 'f8'" } */ void f9(a, b) int a, b; {} void f9(int, int); /* { dg-warning "prototype for 'f9' follows non-prototype definition" } */ -void f10(a, b) int a, b; {} /* { dg-message "note: previous definition of 'f10' was here" } */ +void f10(a, b) int a, b; {} /* { dg-message "note: previous definition of 'f10'" "note" } */ void f10(int, long); /* { dg-error "prototype for 'f10' declares argument 2 with incompatible type" } */ -void f11(a, b) int a, b; {} /* { dg-message "note: previous definition of 'f11' was here" } */ +void f11(a, b) int a, b; {} /* { dg-message "note: previous definition of 'f11'" "note" } */ void f11(long, int); /* { dg-error "prototype for 'f11' declares argument 1 with incompatible type" } */ void f12(a, b) const int a; volatile int b; {} void f12(volatile int, const int); /* { dg-warning "prototype for 'f12' follows non-prototype definition" } */ -void f13(a) const int a[2][2]; {} /* { dg-message "note: previous definition of 'f13' was here" } */ +void f13(a) const int a[2][2]; {} /* { dg-message "note: previous definition of 'f13'" "note" } */ void f13(volatile int [2][2]); /* { dg-error "prototype for 'f13' declares argument 1 with incompatible type" } */ diff --git a/gcc/testsuite/gcc.dg/parm-mismatch-1.c b/gcc/testsuite/gcc.dg/parm-mismatch-1.c index 058f2e8..d7621bc 100644 --- a/gcc/testsuite/gcc.dg/parm-mismatch-1.c +++ b/gcc/testsuite/gcc.dg/parm-mismatch-1.c @@ -4,15 +4,15 @@ /* { dg-do compile } */ /* { dg-options "" } */ -void f0(); /* { dg-message "note: previous declaration of 'f0' was here" } */ +void f0(); /* { dg-message "note: previous declaration of 'f0'" "note" } */ void f0(int, ...); /* { dg-error "conflicting types for 'f0'" } */ /* { dg-message "note: a parameter list with an ellipsis cannot match an empty parameter name list declaration" "note" { target *-*-* } .-1 } */ -void f1(int, ...); /* { dg-message "note: previous declaration of 'f1' was here" } */ +void f1(int, ...); /* { dg-message "note: previous declaration of 'f1'" "note" } */ void f1(); /* { dg-error "conflicting types for 'f1'" } */ /* { dg-message "note: a parameter list with an ellipsis cannot match an empty parameter name list declaration" "note" { target *-*-* } .-1 } */ -void f2(); /* { dg-message "note: previous declaration of 'f2' was here" } */ +void f2(); /* { dg-message "note: previous declaration of 'f2'" "note" } */ void f2(char); /* { dg-error "conflicting types for 'f2'" } */ /* { dg-message "note: an argument type that has a default promotion cannot match an empty parameter name list declaration" "note" { target *-*-* } .-1 } */ -void f3(char); /* { dg-message "note: previous declaration of 'f3' was here" } */ +void f3(char); /* { dg-message "note: previous declaration of 'f3'" "note" } */ void f3(); /* { dg-error "conflicting types for 'f3'" } */ /* { dg-message "note: an argument type that has a default promotion cannot match an empty parameter name list declaration" "note" { target *-*-* } .-1 } */ diff --git a/gcc/testsuite/gcc.dg/pr35445.c b/gcc/testsuite/gcc.dg/pr35445.c index 56ca6e2..30c29f4 100644 --- a/gcc/testsuite/gcc.dg/pr35445.c +++ b/gcc/testsuite/gcc.dg/pr35445.c @@ -2,5 +2,5 @@ /* { dg-do compile } */ extern int i; -extern int i; /* { dg-message "was here" } */ +extern int i; /* { dg-message "previous declaration of 'i'" } */ int i[] = { 0 }; /* { dg-error "conflicting types" } */ diff --git a/gcc/testsuite/gcc.dg/pr97882.c b/gcc/testsuite/gcc.dg/pr97882.c new file mode 100644 index 0000000..48ea93d --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr97882.c @@ -0,0 +1,144 @@ +/* PR c/97882 - Segmentation Fault on improper redeclaration of function + { dg-do compile } + { dg-options "" } */ + +// Check pointer declaration incompatibiliies. + +extern enum E e_u; // { dg-message "note: previous declaration of 'e_u' with type 'enum E'" "note" } +unsigned e_u; // { dg-error "conflicting types for 'e_u'; have 'unsigned int'" } + + +extern enum E *p; // { dg-message "note: previous declaration of 'p' with type 'enum E \\*'" "note" } +unsigned *p; // { dg-error "conflicting types for 'p'; have 'unsigned int \\*'" } + +extern enum E **p2; // { dg-message "note: previous declaration of 'p2' with type 'enum E \\*\\*'" "note" } +unsigned **p2; // { dg-error "conflicting types for 'p2'; have 'unsigned int \\*\\*'" } + +extern enum E ***p3; // { dg-message "note: previous declaration of 'p3' with type 'enum E \\*\\*\\*'" "note" } +unsigned ***p3; // { dg-error "conflicting types for 'p3'; have 'unsigned int \\*\\*\\*'" } + +extern enum F *q; // { dg-message "note: previous declaration of 'q' with type 'enum F \\*'" "note" } +int *q; // { dg-error "conflicting types for 'q'; have 'int \\*'" } + +extern enum E* r[]; // { dg-message "note: previous declaration of 'r' with type 'enum E \\*\\\[]'" "note" } +extern unsigned *r[1]; // { dg-error "conflicting types for 'r'; have 'unsigned int \\*\\\[1]'" } + +extern enum E **r2[]; // { dg-message "note: previous declaration of 'r2' with type 'enum E \\*\\*\\\[]'" "note" } +extern unsigned **r2[2];// { dg-error "conflicting types for 'r2'; have 'unsigned int \\*\\*\\\[2]'" } + + +typedef enum E* EPAx[]; +typedef unsigned* UPAx[]; + +extern EPAx* peax; // { dg-message "note: previous declaration of 'peax' with type 'enum E \\* \\(\\*\\)\\\[]'" "note" } +extern UPAx* peax; // { dg-error "conflicting types for 'peax'; have 'unsigned int \\* \\(\\*\\)\\\[]'" } + + +/* Check incompatibilities in the return type in a redeclaration + of a function without a prototye. */ + +/* Verify the following isn't rejected. */ +void f_v (); +void f_v (void); + +enum E fE_u (); // { dg-message "previous declaration of 'fE_u' with type 'enum E\\(\\)'" "note" } +unsigned fE_u (); // { dg-error "conflicting types for 'fE_u'; have 'unsigned int\\(\\)'" } + +enum E* fpE_u (); // { dg-message "previous declaration of 'fpE_u' with type 'enum E \\*\\(\\)'" "note" } +unsigned* fpE_u (); // { dg-error "conflicting types for 'fpE_u'; have 'unsigned int \\*\\(\\)'" } + +enum E** fppE_u (); // { dg-message "previous declaration of 'fppE_u' with type 'enum E \\*\\*\\(\\)'" "note" } +unsigned** fppE_u (); // { dg-error "conflicting types for 'fppE_u'; have 'unsigned int \\*\\*\\(\\)'" } + +enum E** fppE_u (); // { dg-message "previous declaration of 'fppE_u' with type 'enum E \\*\\*\\(\\)'" "note" } +unsigned** fppE_u (); // { dg-error "conflicting types for 'fppE_u'; have 'unsigned int \\*\\*\\(\\)'" } + +enum E gE_u (); // { dg-message "previous declaration of 'gE_u' with type 'enum E\\(\\)'" "note" } +unsigned gE_u () // { dg-error "conflicting types for 'gE_u'; have 'unsigned int\\(\\)'" } +{ return 0; } + +enum E** gppE_u (); // { dg-message "previous declaration of 'gppE_u' with type 'enum E \\*\\*\\(\\)'" "note" } +unsigned** gppE_u () // { dg-error "conflicting types for 'gppE_u'; have 'unsigned int \\*\\*\\(\\)'" } +{ return 0; } + +unsigned fu_E (); // { dg-message "previous declaration of 'fu_E' with type 'unsigned int\\(\\)'" "note" } +enum E fu_E (); // { dg-error "conflicting types for 'fu_E'; have 'enum E\\(\\)'" } + +unsigned gu_E (); // { dg-message "previous declaration of 'gu_E' with type 'unsigned int\\(\\)'" "note" } +enum E gu_E () { } // { dg-error "conflicting types for 'gu_E'" } + // { dg-error "incomplete type" "return type" { target *-*-* } .-1 } + +typedef enum E FE_ (); +typedef unsigned Fuv (void); + +FE_* fpF_u (); // // { dg-message "previous declaration of 'fpF_u' with type 'enum E \\(\\*\\(\\)\\)\\(\\)'" "note" } +Fuv* fpF_u (); // { dg-error "conflicting types for 'fpF_u'; have 'unsigned int \\(\\*\\(\\)\\)\\(void\\)'" } + + +typedef void Fv_ (); +typedef void Fvv (void); + +/* Verify the following isn't rejected. */ +Fv_* f (); +Fvv* f (); + + +/* Check incompatibilities in argument types of a function redeclaration. */ + +void fvE_u (enum E); // { dg-message "note: previous declaration of 'fvE_u' with type 'void\\(enum E\\)'" "note" } +void fvE_u (unsigned); // { dg-error "conflicting types for 'fvE_u'; have 'void\\(unsigned int\\)'" } + +void fviE_u (int, enum E); // { dg-message "note: previous declaration of 'fviE_u' with type 'void\\(int, *enum E\\)'" "note" } +void fviE_u (int, unsigned); // { dg-error "conflicting types for 'fviE_u'; have 'void\\(int, *unsigned int\\)'" } + +void fvE_el (enum E, ...); // { dg-message "note: previous declaration of 'fvE_el' with type 'void\\(enum E, \\.\\.\\.\\)'" "note" } +void fvE_el (unsigned, ...); // { dg-error "conflicting types for 'fvE_el'; have 'void\\(unsigned int, \\.\\.\\.\\)'" } + + +/* Check incompatibilities in the return type in a redeclaration + of a nested function without a prototye. */ + +void f1 (void) +{ + enum G f11 (); // { dg-message "note: previous declaration of 'f11' with type 'enum G\\(\\)'" "note" } + unsigned f11 () { } // { dg-error "conflicting types for 'f11'; have 'unsigned int\\(\\)'" } +} + + +void f2 (void) +{ + const enum G f21 (); // { dg-message "note: previous declaration of 'f21' with type 'enum G\\(\\)'" "note" } + unsigned f21 () { } // { dg-error "conflicting types for 'f21'; have 'unsigned int\\(\\)'" } +} + + +void f3 (void) +{ + enum G f31 (); // { dg-message "note: previous declaration of 'f31' with type 'enum G\\(\\)'" "note" } + const unsigned f31 () { } // { dg-error "conflicting types for 'f31'; have 'unsigned int\\(\\)'" } +} + + +void f4 (void) +{ + auto enum G f31 (); // { dg-message "note: previous declaration of 'f31' with type 'enum G\\(\\)'" "note" } + const unsigned f31 () { } // { dg-error "conflicting types for 'f31'; have 'unsigned int\\(\\)'" } +} + + +void f5 (void) +{ + enum G* f51 (); // { dg-message "note: previous declaration of 'f51' with type 'enum G \\*\\(\\)'" "note" } + int* f51 () { } // { dg-error "conflicting types for 'f51'; have 'int \\*\\(\\)'" } +} + + +void f6 (void) +{ + enum G; + void f61 (enum G); // { dg-message "note: previous declaration of 'f61' with type 'void\\(enum G\\)'" "note" } + void f61 (unsigned) // { dg-error "conflicting types for 'f61'; have 'void\\(unsigned int\\)'" } + { } +} + +// { dg-prune-output "nested function '\[^\n\r ]+' declared but never defined" } diff --git a/gcc/testsuite/gcc.dg/pr97932.c b/gcc/testsuite/gcc.dg/pr97932.c new file mode 100644 index 0000000..4a0b304 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr97932.c @@ -0,0 +1,125 @@ +/* Verify that we don't emit ranges that span both + a macro definition location and a macro expansion location. */ + +/* { dg-options "-fdiagnostics-show-caret" } */ + +/* Various cases involving the ranges of the LHS and RHS operands to "-". */ + +/* Case 1 + start token is in macro definition ("&"), + end token is in macro invocation ("a" and "b"). */ + +#define M1(A, B) &A - &B /* { dg-error "invalid operands" } */ + +/* Intervening + material + that + ought + not + to + be + printed. */ + +int test_1 (float a, int b) +{ + return M1(a, b); /* { dg-message "in expansion of macro 'M1'" } */ +} + +/* { dg-begin-multiline-output "" } + #define M1(A, B) &A - &B + ^ + { dg-end-multiline-output "" } */ +/* { dg-begin-multiline-output "" } + return M1(a, b); + ^~ + { dg-end-multiline-output "" } */ + +/* Case 2: + start and end tokens are both in macro invocation ("&", and "a"/"b"). */ + +#define M2(A, B) A - B /* { dg-error "invalid operands" } */ + +/* Intervening + material + that + ought + not + to + be + printed. */ + +int test_2 (float a, int b) +{ + return M2(&a, &b); /* { dg-message "in expansion of macro 'M2'" } */ +} + +/* { dg-begin-multiline-output "" } + #define M2(A, B) A - B + ^ + { dg-end-multiline-output "" } */ +/* { dg-begin-multiline-output "" } + return M2(&a, &b); + ^~ + { dg-end-multiline-output "" } */ + +/* Case 3: + start token is in macro invocation ("&"), + end token is in macro definition ("a"). */ + +#define M3(OP) OP a - OP b /* { dg-error "invalid operands" } */ + +/* Intervening + material + that + ought + not + to + be + printed. */ + +int test_3 (float a, int b) +{ + return M3(&); /* { dg-message "in expansion of macro 'M3'" } */ +} + +/* { dg-begin-multiline-output "" } + #define M3(OP) OP a - OP b + ^ + { dg-end-multiline-output "" } */ +/* { dg-begin-multiline-output "" } + return M3(&); + ^~ + { dg-end-multiline-output "" } */ + + +/* Case 4: + start and end tokens are both in macro definition ("&a"). */ + +#define M4 &a - &b /* { dg-error "invalid operands" } */ + +/* Intervening + material + that + ought + not + to + be + printed. */ + +int test_4 (float a, int b) +{ + return M4; /* { dg-message "in expansion of macro 'M4'" } */ +} + +/* { dg-begin-multiline-output "" } + #define M4 &a - &b + ~~ ^ ~~ + | | + | int * + float * + { dg-end-multiline-output "" } */ +/* { dg-begin-multiline-output "" } + return M4; + ^~ + { dg-end-multiline-output "" } */ + diff --git a/gcc/testsuite/gcc.dg/qual-return-7.c b/gcc/testsuite/gcc.dg/qual-return-7.c new file mode 100644 index 0000000..96f7f16 --- /dev/null +++ b/gcc/testsuite/gcc.dg/qual-return-7.c @@ -0,0 +1,18 @@ +/* Same as qual-return-3.c but with nested functions. + { dg-do compile } + { dg-options "-std=gnu99" } */ + +void test_local (void) +{ + auto int foo (); /* { dg-message "note: previous declaration" "different qualifiers" } */ + + const int foo () { return 0; } /* { dg-error "conflicting types" "different qualifiers" } */ + + auto void bar (void); + volatile void bar () { } /* { dg-warning "qualified|volatile" "different qualifiers" } */ + + auto volatile void baz (void); + void baz () { } /* { dg-warning "not compatible" "different qualifiers" } */ +} + +/* { dg-prune-output "nested function 'foo' declared but never defined" } */ diff --git a/gcc/testsuite/gcc.dg/qual-return-8.c b/gcc/testsuite/gcc.dg/qual-return-8.c new file mode 100644 index 0000000..de1e7cb --- /dev/null +++ b/gcc/testsuite/gcc.dg/qual-return-8.c @@ -0,0 +1,28 @@ +/* Same as qual-return-7.c but in C11 mode. + { dg-do compile } + { dg-options "-std=gnu11" } */ + +void test_local (void) +{ +#if 0 + /* _Atomic is not considered a qualifier and so is not ignored + on a return type. As a result, the redeclaration below isn't + valid. See also qual-return-5.c. */ + auto int fi_ai (); + _Atomic int fi_ai () { return 0; } +#endif + + auto int fi_ci (); + const int fi_ci () { return 0; } + + auto enum E fe_ce (); + + enum E { e }; + const enum E fe_ce () { return 0; } + + auto void fv_vv (void); + volatile void fv_vv () { } + + auto volatile void fvv_v (void); + void fvv_v () { } +} diff --git a/gcc/testsuite/gcc.dg/redecl-11.c b/gcc/testsuite/gcc.dg/redecl-11.c index 5540e40..3c6f64f 100644 --- a/gcc/testsuite/gcc.dg/redecl-11.c +++ b/gcc/testsuite/gcc.dg/redecl-11.c @@ -5,5 +5,5 @@ /* { dg-options "" } */ int f(int (*)[]); -void g() { int f(int (*)[2]); } /* { dg-message "note: previous declaration of 'f' was here" } */ +void g() { int f(int (*)[2]); } /* { dg-message "note: previous declaration of 'f'" "note" } */ int f(int (*)[3]); /* { dg-error "conflicting types for 'f'" } */ diff --git a/gcc/testsuite/gcc.dg/redecl-12.c b/gcc/testsuite/gcc.dg/redecl-12.c index 711b8a3..9922cf4 100644 --- a/gcc/testsuite/gcc.dg/redecl-12.c +++ b/gcc/testsuite/gcc.dg/redecl-12.c @@ -5,5 +5,5 @@ /* { dg-options "" } */ extern int a[]; -void f(void) { extern int a[]; extern int a[10]; } /* { dg-message "note: previous declaration of 'a' was here" } */ +void f(void) { extern int a[]; extern int a[10]; } /* { dg-message "note: previous declaration of 'a'" "note" } */ extern int a[5]; /* { dg-error "conflicting types for 'a'" } */ diff --git a/gcc/testsuite/gcc.dg/redecl-13.c b/gcc/testsuite/gcc.dg/redecl-13.c index 3f05d0f..556a3cd 100644 --- a/gcc/testsuite/gcc.dg/redecl-13.c +++ b/gcc/testsuite/gcc.dg/redecl-13.c @@ -5,5 +5,5 @@ /* { dg-options "" } */ extern int a[]; -void f(void) { extern int a[10]; } /* { dg-message "note: previous declaration of 'a' was here" } */ +void f(void) { extern int a[10]; } /* { dg-message "note: previous declaration of 'a'" "note" } */ extern int a[5]; /* { dg-error "conflicting types for 'a'" } */ diff --git a/gcc/testsuite/gcc.dg/redecl-15.c b/gcc/testsuite/gcc.dg/redecl-15.c index ff484c9..06d6523 100644 --- a/gcc/testsuite/gcc.dg/redecl-15.c +++ b/gcc/testsuite/gcc.dg/redecl-15.c @@ -7,7 +7,7 @@ void f (void) { - g(); /* { dg-message "note: previous implicit declaration of 'g' was here" } */ + g(); /* { dg-message "note: previous implicit declaration of 'g'" } */ { void g(); /* { dg-warning "conflicting types for 'g'" } */ } diff --git a/gcc/testsuite/gcc.dg/rtl/aarch64/multi-subreg-1.c b/gcc/testsuite/gcc.dg/rtl/aarch64/multi-subreg-1.c new file mode 100644 index 0000000..d7be559 --- /dev/null +++ b/gcc/testsuite/gcc.dg/rtl/aarch64/multi-subreg-1.c @@ -0,0 +1,19 @@ +/* { dg-additional-options "-O -fdump-rtl-cse1-all" } */ + +__int128 __RTL (startwith ("vregs")) foo (void) +{ +(function "foo" + (insn-chain + (block 2 + (edge-from entry (flags "FALLTHRU")) + (cnote 1 [bb 2] NOTE_INSN_BASIC_BLOCK) + (cnote 2 NOTE_INSN_FUNCTION_BEG) + (cinsn 3 (set (subreg:TI (reg:V8HI x0) 0) (const_int -1))) + (edge-to exit (flags "FALLTHRU")) + ) + ) + (crtl (return_rtx (reg/i:TI x0))) +) +} + +/* { dg-final { scan-rtl-dump {(?n)lr *def.*\[x0\].*\[x1\]} cse1 } } */ diff --git a/gcc/testsuite/gcc.dg/tls/thr-init-1.c b/gcc/testsuite/gcc.dg/tls/thr-init-1.c index a9b6061..af51484 100644 --- a/gcc/testsuite/gcc.dg/tls/thr-init-1.c +++ b/gcc/testsuite/gcc.dg/tls/thr-init-1.c @@ -6,4 +6,4 @@ static __thread int fstat = 1 ; /* { dg-line fstat_prev } */ static __thread int fstat ; static __thread int fstat = 2; /* { dg-error "redefinition of 'fstat'" "" { target *-*-* } .-1 } */ -/* { dg-message "note: previous definition of 'fstat' was here" "" { target *-*-* } fstat_prev } */ +/* { dg-message "note: previous definition of 'fstat'" "note" { target *-*-* } fstat_prev } */ diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vpXXXq.inc b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vpXXXq.inc new file mode 100644 index 0000000..3c27d32 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vpXXXq.inc @@ -0,0 +1,96 @@ +#define FNNAME1(NAME) exec_ ## NAME +#define FNNAME(NAME) FNNAME1(NAME) + +void FNNAME (INSN_NAME) (void) +{ + /* Basic test: y=OP(x), then store the result. */ +#define TEST_VPXXXQ1(INSN, T1, T2, W, N) \ + VECT_VAR(vector_res, T1, W, N) = \ + INSN##_##T2##W(VECT_VAR(vector, T1, W, N), \ + VECT_VAR(vector, T1, W, N)); \ + vst1q##_##T2##W(VECT_VAR(result, T1, W, N), \ + VECT_VAR(vector_res, T1, W, N)) + +#define TEST_VPXXXQ(INSN, T1, T2, W, N) \ + TEST_VPXXXQ1(INSN, T1, T2, W, N) \ + + DECL_VARIABLE(vector, int, 8, 16); + DECL_VARIABLE(vector, int, 16, 8); + DECL_VARIABLE(vector, int, 32, 4); + DECL_VARIABLE(vector, int, 64, 2); + DECL_VARIABLE(vector, uint, 8, 16); + DECL_VARIABLE(vector, uint, 16, 8); + DECL_VARIABLE(vector, uint, 32, 4); + DECL_VARIABLE(vector, uint, 64, 2); +#if defined (__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) + DECL_VARIABLE(vector, float, 16, 8); +#endif + DECL_VARIABLE(vector, float, 32, 4); + DECL_VARIABLE(vector, float, 64, 2); + + DECL_VARIABLE(vector_res, int, 8, 16); + DECL_VARIABLE(vector_res, int, 16, 8); + DECL_VARIABLE(vector_res, int, 32, 4); + DECL_VARIABLE(vector_res, int, 64, 2); + DECL_VARIABLE(vector_res, uint, 8, 16); + DECL_VARIABLE(vector_res, uint, 16, 8); + DECL_VARIABLE(vector_res, uint, 32, 4); + DECL_VARIABLE(vector_res, uint, 64, 2); +#if defined (__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) + DECL_VARIABLE(vector_res, float, 16, 8); +#endif + DECL_VARIABLE(vector_res, float, 32, 4); + DECL_VARIABLE(vector_res, float, 64, 2); + + clean_results (); + + /* Initialize input "vector" from "buffer". */ + VLOAD(vector, buffer, q, int, s, 8, 16); + VLOAD(vector, buffer, q, int, s, 16, 8); + VLOAD(vector, buffer, q, int, s, 32, 4); + VLOAD(vector, buffer, q, int, s, 64, 2); + VLOAD(vector, buffer, q, uint, u, 8, 16); + VLOAD(vector, buffer, q, uint, u, 16, 8); + VLOAD(vector, buffer, q, uint, u, 32, 4); + VLOAD(vector, buffer, q, uint, u, 64, 2); +#if defined (__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) + VLOAD(vector, buffer, q, float, f, 16, 8); +#endif + VLOAD(vector, buffer, q, float, f, 32, 4); + VLOAD(vector, buffer, q, float, f, 64, 2); + + /* Apply a binary operator named INSN_NAME. */ + TEST_VPXXXQ(INSN_NAME, int, s, 8, 16); + TEST_VPXXXQ(INSN_NAME, int, s, 16, 8); + TEST_VPXXXQ(INSN_NAME, int, s, 32, 4); + TEST_VPXXXQ(INSN_NAME, int, s, 64, 2); + TEST_VPXXXQ(INSN_NAME, uint, u, 8, 16); + TEST_VPXXXQ(INSN_NAME, uint, u, 16, 8); + TEST_VPXXXQ(INSN_NAME, uint, u, 32, 4); + TEST_VPXXXQ(INSN_NAME, uint, u, 64, 2); +#if defined (__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) + TEST_VPXXXQ(INSN_NAME, float, f, 16, 8); +#endif + TEST_VPXXXQ(INSN_NAME, float, f, 32, 4); + TEST_VPXXXQ(INSN_NAME, float, f, 64, 2); + + CHECK(TEST_MSG, int, 8, 16, PRIx8, expected, ""); + CHECK(TEST_MSG, int, 16, 8, PRIx16, expected, ""); + CHECK(TEST_MSG, int, 32, 4, PRIx32, expected, ""); + CHECK(TEST_MSG, int, 64, 2, PRIx64, expected, ""); + CHECK(TEST_MSG, uint, 8, 16, PRIx8, expected, ""); + CHECK(TEST_MSG, uint, 16, 8, PRIx16, expected, ""); + CHECK(TEST_MSG, uint, 32, 4, PRIx32, expected, ""); + CHECK(TEST_MSG, uint, 64, 2, PRIx64, expected, ""); +#if defined (__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) + CHECK_FP(TEST_MSG, float, 16, 8, PRIx16, expected, ""); +#endif + CHECK_FP(TEST_MSG, float, 32, 4, PRIx32, expected, ""); + CHECK_FP(TEST_MSG, float, 64, 2, PRIx64, expected, ""); +} + +int main (void) +{ + FNNAME (INSN_NAME) (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vpaddq.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vpaddq.c new file mode 100644 index 0000000..f15ada8 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vpaddq.c @@ -0,0 +1,40 @@ +/* { dg-skip-if "" { arm*-*-* } } */ + +#include <arm_neon.h> +#include "arm-neon-ref.h" +#include "compute-ref-data.h" + +#define INSN_NAME vpaddq +#define TEST_MSG "VPADDQ" + +/* Expected results. */ +VECT_VAR_DECL(expected, int, 8, 16) [] = { 0xe1, 0xe5, 0xe9, 0xed, + 0xf1, 0xf5, 0xf9, 0xfd, + 0xe1, 0xe5, 0xe9, 0xed, + 0xf1, 0xf5, 0xf9, 0xfd }; +VECT_VAR_DECL(expected, int, 16, 8) [] = { 0xffe1, 0xffe5, 0xffe9, 0xffed, + 0xffe1, 0xffe5, 0xffe9, 0xffed }; +VECT_VAR_DECL(expected, int, 32, 4) [] = { 0xffffffe1, 0xffffffe5, + 0xffffffe1, 0xffffffe5 }; +VECT_VAR_DECL(expected, int, 64, 2) [] = { 0xffffffffffffffe1, + 0xffffffffffffffe1 }; +VECT_VAR_DECL(expected, uint, 8, 16) [] = { 0xe1, 0xe5, 0xe9, 0xed, + 0xf1, 0xf5, 0xf9, 0xfd, + 0xe1, 0xe5, 0xe9, 0xed, + 0xf1, 0xf5, 0xf9, 0xfd }; +VECT_VAR_DECL(expected, uint, 16, 8) [] = { 0xffe1, 0xffe5, 0xffe9, 0xffed, + 0xffe1, 0xffe5, 0xffe9, 0xffed }; +VECT_VAR_DECL(expected, uint, 32, 4) [] = { 0xffffffe1, 0xffffffe5, + 0xffffffe1, 0xffffffe5}; +VECT_VAR_DECL(expected, uint, 64, 2) [] = { 0xffffffffffffffe1, + 0xffffffffffffffe1 }; +#if defined (__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) +VECT_VAR_DECL(expected, hfloat, 16, 8) [] = { 0xcfc0, 0xcec0, 0xcdc0, 0xccc0, + 0xcfc0, 0xcec0, 0xcdc0, 0xccc0 }; +#endif +VECT_VAR_DECL(expected, hfloat, 32, 4) [] = { 0xc1f80000, 0xc1d80000, + 0xc1f80000, 0xc1d80000 }; +VECT_VAR_DECL(expected, hfloat, 64, 2) [] = { 0xc03f000000000000, + 0xc03f000000000000 }; + +#include "vpXXXq.inc" diff --git a/gcc/testsuite/gcc.target/aarch64/asimd-mul-to-shl-sub.c b/gcc/testsuite/gcc.target/aarch64/asimd-mul-to-shl-sub.c new file mode 100644 index 0000000..d7c5e5f --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/asimd-mul-to-shl-sub.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target vect_int } */ +/* { dg-options "-Ofast" } */ + +/* +**foo: +** shl v1.4s, v0.4s, 16 +** sub v0.4s, v1.4s, v0.4s +** ret +*/ +#include <arm_neon.h> +uint32x4_t foo (uint32x4_t a) +{ + return a * 65535; +} + +/* { dg-final { check-function-bodies "**" "" "" } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/pr98772.c b/gcc/testsuite/gcc.target/aarch64/pr98772.c new file mode 100644 index 0000000..6632215 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr98772.c @@ -0,0 +1,155 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -save-temps" } */ +#include <stdint.h> +#include <string.h> + +#define DSIZE 16 +#define PIXSIZE 64 + +extern void +wplus (uint16_t *d, uint8_t *restrict pix1, uint8_t *restrict pix2 ) +{ + for (int y = 0; y < 4; y++ ) + { + for (int x = 0; x < 4; x++ ) + d[x + y*4] = pix1[x] + pix2[x]; + pix1 += 16; + pix2 += 16; + } +} +extern void __attribute__((optimize (0))) +wplus_no_opt (uint16_t *d, uint8_t *restrict pix1, uint8_t *restrict pix2 ) +{ + for (int y = 0; y < 4; y++ ) + { + for (int x = 0; x < 4; x++ ) + d[x + y*4] = pix1[x] + pix2[x]; + pix1 += 16; + pix2 += 16; + } +} + +extern void +wminus (uint16_t *d, uint8_t *restrict pix1, uint8_t *restrict pix2 ) +{ + for (int y = 0; y < 4; y++ ) + { + for (int x = 0; x < 4; x++ ) + d[x + y*4] = pix1[x] - pix2[x]; + pix1 += 16; + pix2 += 16; + } +} +extern void __attribute__((optimize (0))) +wminus_no_opt (uint16_t *d, uint8_t *restrict pix1, uint8_t *restrict pix2 ) +{ + for (int y = 0; y < 4; y++ ) + { + for (int x = 0; x < 4; x++ ) + d[x + y*4] = pix1[x] - pix2[x]; + pix1 += 16; + pix2 += 16; + } +} + +extern void +wmult (uint16_t *d, uint8_t *restrict pix1, uint8_t *restrict pix2 ) +{ + for (int y = 0; y < 4; y++ ) + { + for (int x = 0; x < 4; x++ ) + d[x + y*4] = pix1[x] * pix2[x]; + pix1 += 16; + pix2 += 16; + } +} +extern void __attribute__((optimize (0))) +wmult_no_opt (uint16_t *d, uint8_t *restrict pix1, uint8_t *restrict pix2 ) +{ + for (int y = 0; y < 4; y++ ) + { + for (int x = 0; x < 4; x++ ) + d[x + y*4] = pix1[x] * pix2[x]; + pix1 += 16; + pix2 += 16; + } +} + +extern void +wlshift (uint16_t *d, uint8_t *restrict pix1) + +{ + for (int y = 0; y < 4; y++ ) + { + for (int x = 0; x < 4; x++ ) + d[x + y*4] = pix1[x] << 8; + pix1 += 16; + } +} +extern void __attribute__((optimize (0))) +wlshift_no_opt (uint16_t *d, uint8_t *restrict pix1) + +{ + for (int y = 0; y < 4; y++ ) + { + for (int x = 0; x < 4; x++ ) + d[x + y*4] = pix1[x] << 8; + pix1 += 16; + } +} + +void __attribute__((optimize (0))) +init_arrays (uint16_t *d_a, uint16_t *d_b, uint8_t *pix1, uint8_t *pix2) +{ + for (int i = 0; i < DSIZE; i++) + { + d_a[i] = (1074 * i)%17; + d_b[i] = (1074 * i)%17; + } + for (int i = 0; i < PIXSIZE; i++) + { + pix1[i] = (1024 * i)%17; + pix2[i] = (1024 * i)%17; + } +} + +/* Don't optimize main so we don't get confused over where the vector + instructions are generated. */ +__attribute__((optimize (0))) +int main () +{ + uint16_t d_a[DSIZE]; + uint16_t d_b[DSIZE]; + uint8_t pix1[PIXSIZE]; + uint8_t pix2[PIXSIZE]; + + init_arrays (d_a, d_b, pix1, pix2); + wplus (d_a, pix1, pix2); + wplus_no_opt (d_b, pix1, pix2); + if (memcmp (d_a,d_b, DSIZE) != 0) + return 1; + + init_arrays (d_a, d_b, pix1, pix2); + wminus (d_a, pix1, pix2); + wminus_no_opt (d_b, pix1, pix2); + if (memcmp (d_a,d_b, DSIZE) != 0) + return 2; + + init_arrays (d_a, d_b, pix1, pix2); + wmult (d_a, pix1, pix2); + wmult_no_opt (d_b, pix1, pix2); + if (memcmp (d_a,d_b, DSIZE) != 0) + return 3; + + init_arrays (d_a, d_b, pix1, pix2); + wlshift (d_a, pix1); + wlshift_no_opt (d_b, pix1); + if (memcmp (d_a,d_b, DSIZE) != 0) + return 4; + +} + +/* { dg-final { scan-assembler-times "uaddl\\tv" 2 } } */ +/* { dg-final { scan-assembler-times "usubl\\tv" 2 } } */ +/* { dg-final { scan-assembler-times "umull\\tv" 2 } } */ +/* { dg-final { scan-assembler-times "shl\\tv" 2 } } */ diff --git a/gcc/testsuite/gcc.target/arm/pr98931.c b/gcc/testsuite/gcc.target/arm/pr98931.c new file mode 100644 index 0000000..66070ad --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pr98931.c @@ -0,0 +1,17 @@ +/* { dg-do assemble } */ +/* { dg-skip-if "avoid conflicting multilib options" { *-*-* } { "-marm" "-mcpu=*" } } */ +/* { dg-options "-march=armv8.1-m.main -O3 --param=max-completely-peeled-insns=1300 --save-temps -mthumb" } */ + +extern long long a[][20][26][26][22]; + +void +foo () +{ + for (short d = 0; d + 1; d++) + for (unsigned e = 0; e < 25; e += 4) + for (unsigned f = 0; f < 25; f += 4) + for (int g = 0; g < 21; g += 4) + a[4][d][e][f][g] = 0; +} + +/* { dg-final { scan-assembler-not {le\slr,\s\S*} } } */ diff --git a/gcc/testsuite/gcc.target/arm/simd/vmmla_1.c b/gcc/testsuite/gcc.target/arm/simd/vmmla_1.c index aeb4a35..d33ebf3 100644 --- a/gcc/testsuite/gcc.target/arm/simd/vmmla_1.c +++ b/gcc/testsuite/gcc.target/arm/simd/vmmla_1.c @@ -1,6 +1,6 @@ /* { dg-do assemble } */ /* { dg-require-effective-target arm_v8_2a_i8mm_ok } */ -/* { dg-options "-save-temps -O2 -march=armv8.2-a+i8mm -mfloat-abi=hard" } */ +/* { dg-options "-save-temps -O2 -march=armv8.2-a+i8mm -mfpu=auto -mfloat-abi=hard" } */ #include "arm_neon.h" diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-pr88547-1.c b/gcc/testsuite/gcc.target/i386/avx512vl-pr88547-1.c index a3ffeca..af15a63 100644 --- a/gcc/testsuite/gcc.target/i386/avx512vl-pr88547-1.c +++ b/gcc/testsuite/gcc.target/i386/avx512vl-pr88547-1.c @@ -1,12 +1,14 @@ /* PR target/88547 */ /* { dg-do compile } */ -/* { dg-options "-O2 -mno-xop -mavx512vl -mno-avx512bw -mno-avx512dq" } */ +/* { dg-options "-O2 -mno-xop -mavx512vl -mavx512bw -mavx512dq" } */ /* { dg-final { scan-assembler-not "vpmingt\[bwdq]\[\t ]" } } */ +/* { dg-final { scan-assembler-not "%k\[0-9\]" } } */ /* { dg-final { scan-assembler-times "vpminub\[\t ]" 2 } } */ /* { dg-final { scan-assembler-times "vpminsb\[\t ]" 2 } } */ /* { dg-final { scan-assembler-times "vpminuw\[\t ]" 2 } } */ /* { dg-final { scan-assembler-times "vpminsw\[\t ]" 2 } } */ -/* { dg-final { scan-assembler-times "vpcmp\[dq\]\[\t ]" 4 } } */ -/* { dg-final { scan-assembler-times "vpcmpu\[dq\]\[\t ]" 4 } } */ -/* { dg-final { scan-assembler-times "vpternlog\[qd\]\[\t ]" 8 } } */ +/* { dg-final { scan-assembler-times "vpminud\[\t ]" 2 } } */ +/* { dg-final { scan-assembler-times "vpminsd\[\t ]" 2 } } */ +/* { dg-final { scan-assembler-times "vpminuq\[\t ]" 2 } } */ +/* { dg-final { scan-assembler-times "vpminsq\[\t ]" 2 } } */ #include "avx2-pr88547-1.c" diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-pr92686-vpcmp-1.c b/gcc/testsuite/gcc.target/i386/avx512vl-pr92686-vpcmp-1.c deleted file mode 100644 index 5b79d4d..0000000 --- a/gcc/testsuite/gcc.target/i386/avx512vl-pr92686-vpcmp-1.c +++ /dev/null @@ -1,112 +0,0 @@ -/* PR target/88547 */ -/* { dg-do compile } */ -/* { dg-options "-O2 -mavx512bw -mavx512vl -mno-avx512dq -mno-xop" } */ -/* { dg-final { scan-assembler-times "vpcmp\[bwdq\]\[\t ]" 8 } } */ -/* { dg-final { scan-assembler-times "vpcmpu\[bwdq\]\[\t ]" 8 } } */ -/* { dg-final { scan-assembler-times "vpmovm2\[bw\]\[\t ]" 8 } } */ -/* { dg-final { scan-assembler-times "vpternlog\[dq\]\[\t ]" 8 } } */ - -typedef signed char v32qi __attribute__((vector_size(32))); -typedef unsigned char v32uqi __attribute__((vector_size(32))); -typedef short v16hi __attribute__((vector_size(32))); -typedef unsigned short v16uhi __attribute__((vector_size(32))); -typedef int v8si __attribute__((vector_size(32))); -typedef unsigned v8usi __attribute__((vector_size(32))); -typedef long long v4di __attribute__((vector_size(32))); -typedef unsigned long long v4udi __attribute__((vector_size(32))); - -__attribute__((noipa)) v32qi -f1 (v32qi x, v32qi y) -{ - return x >= y; -} - -__attribute__((noipa)) v32uqi -f2 (v32uqi x, v32uqi y) -{ - return x >= y; -} - -__attribute__((noipa)) v32qi -f3 (v32qi x, v32qi y) -{ - return x <= y; -} - -__attribute__((noipa)) v32uqi -f4 (v32uqi x, v32uqi y) -{ - return x <= y; -} - -__attribute__((noipa)) v16hi -f5 (v16hi x, v16hi y) -{ - return x >= y; -} - -__attribute__((noipa)) v16uhi -f6 (v16uhi x, v16uhi y) -{ - return x >= y; -} - -__attribute__((noipa)) v16hi -f7 (v16hi x, v16hi y) -{ - return x <= y; -} - -__attribute__((noipa)) v16uhi -f8 (v16uhi x, v16uhi y) -{ - return x <= y; -} - -__attribute__((noipa)) v8si -f9 (v8si x, v8si y) -{ - return x >= y; -} - -__attribute__((noipa)) v8usi -f10 (v8usi x, v8usi y) -{ - return x >= y; -} - -__attribute__((noipa)) v8si -f11 (v8si x, v8si y) -{ - return x <= y; -} - -__attribute__((noipa)) v8usi -f12 (v8usi x, v8usi y) -{ - return x <= y; -} - -__attribute__((noipa)) v4di -f13 (v4di x, v4di y) -{ - return x >= y; -} - -__attribute__((noipa)) v4udi -f14 (v4udi x, v4udi y) -{ - return x >= y; -} - -__attribute__((noipa)) v4di -f15 (v4di x, v4di y) -{ - return x <= y; -} - -__attribute__((noipa)) v4udi -f16 (v4udi x, v4udi y) -{ - return x <= y; -} diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-pr92686-vpcmp-2.c b/gcc/testsuite/gcc.target/i386/avx512vl-pr92686-vpcmp-2.c deleted file mode 100644 index 6be24ff..0000000 --- a/gcc/testsuite/gcc.target/i386/avx512vl-pr92686-vpcmp-2.c +++ /dev/null @@ -1,91 +0,0 @@ -/* { dg-do run } */ -/* { dg-require-effective-target avx512bw } */ -/* { dg-require-effective-target avx512vl } */ -/* { dg-options "-O2 -mavx512bw -mavx512vl" } */ - -#ifndef CHECK -#define CHECK "avx512f-helper.h" -#endif - -#include CHECK - -#ifndef TEST -#define TEST avx512vl_test -#endif - -#include "avx512vl-pr92686-vpcmp-1.c" - -#define NUM 256 - -#define TEST_SIGNED(vtype, type, N, fn, op) \ -do \ - { \ - union { vtype x[NUM / N]; type i[NUM]; } dst, src1, src2; \ - int i, sign = 1; \ - type res; \ - for (i = 0; i < NUM; i++) \ - { \ - src1.i[i] = i * i * sign; \ - src2.i[i] = (i + 20) * sign; \ - sign = -sign; \ - } \ - for (i = 0; i < NUM; i += N) \ - dst.x[i / N] = fn (src1.x[i / N], src2.x[i / N]); \ - \ - for (i = 0; i < NUM; i++) \ - { \ - res = src1.i[i] op src2.i[i] ? -1 : 0; \ - if (res != dst.i[i]) \ - abort (); \ - } \ - } \ -while (0) - -#define TEST_UNSIGNED(vtype, type, N, fn, op) \ -do \ - { \ - union { vtype x[NUM / N]; type i[NUM]; } dst, src1, src2; \ - int i; \ - type res; \ - \ - for (i = 0; i < NUM; i++) \ - { \ - src1.i[i] = i * i; \ - src2.i[i] = i + 20; \ - if ((i % 4)) \ - src2.i[i] |= (1ULL << (sizeof (type) \ - * __CHAR_BIT__ - 1)); \ - } \ - \ - for (i = 0; i < NUM; i += N) \ - dst.x[i / N] = fn (src1.x[i / N], src2.x[i / N]); \ - \ - for (i = 0; i < NUM; i++) \ - { \ - res = src1.i[i] op src2.i[i] ? -1 : 0; \ - if (res != dst.i[i]) \ - abort (); \ - } \ - } \ -while (0) - -static void -TEST (void) -{ - TEST_SIGNED (v32qi, signed char, 32, f1, >=); - TEST_UNSIGNED (v32uqi, unsigned char, 32, f2, >=); - TEST_SIGNED (v32qi, signed char, 32, f3, <=); - TEST_UNSIGNED (v32uqi, unsigned char, 32, f4, <=); - TEST_SIGNED (v16hi, short int, 16, f5, >=); - TEST_UNSIGNED (v16uhi, unsigned short int, 16, f6, >=); - TEST_SIGNED (v16hi, short int, 16, f7, <=); - TEST_UNSIGNED (v16uhi, unsigned short int, 16, f8, <=); - TEST_SIGNED (v8si, int, 8, f9, >=); - TEST_UNSIGNED (v8usi, unsigned int, 8, f10, >=); - TEST_SIGNED (v8si, int, 8, f11, <=); - TEST_UNSIGNED (v8usi, unsigned int, 8, f12, <=); - TEST_SIGNED (v4di, long long int, 4, f13, >=); - TEST_UNSIGNED (v4udi, unsigned long long int, 4, f14, >=); - TEST_SIGNED (v4di, long long int, 4, f15, <=); - TEST_UNSIGNED (v4udi, unsigned long long int, 4, f16, <=); -} diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-pr92686-vpcmp-intelasm-1.c b/gcc/testsuite/gcc.target/i386/avx512vl-pr92686-vpcmp-intelasm-1.c deleted file mode 100644 index 907386d..0000000 --- a/gcc/testsuite/gcc.target/i386/avx512vl-pr92686-vpcmp-intelasm-1.c +++ /dev/null @@ -1,111 +0,0 @@ -/* PR target/88547 */ -/* { dg-do assemble } */ -/* { dg-require-effective-target masm_intel } */ -/* { dg-options "-O2 -mavx512bw -mavx512vl -mno-avx512dq -mno-xop -masm=intel" } */ -/* { dg-require-effective-target avx512bw } */ -/* { dg-require-effective-target avx512vl } */ - -typedef signed char v32qi __attribute__((vector_size(32))); -typedef unsigned char v32uqi __attribute__((vector_size(32))); -typedef short v16hi __attribute__((vector_size(32))); -typedef unsigned short v16uhi __attribute__((vector_size(32))); -typedef int v8si __attribute__((vector_size(32))); -typedef unsigned v8usi __attribute__((vector_size(32))); -typedef long long v4di __attribute__((vector_size(32))); -typedef unsigned long long v4udi __attribute__((vector_size(32))); - -__attribute__((noipa)) v32qi -f1 (v32qi x, v32qi y) -{ - return x >= y; -} - -__attribute__((noipa)) v32uqi -f2 (v32uqi x, v32uqi y) -{ - return x >= y; -} - -__attribute__((noipa)) v32qi -f3 (v32qi x, v32qi y) -{ - return x <= y; -} - -__attribute__((noipa)) v32uqi -f4 (v32uqi x, v32uqi y) -{ - return x <= y; -} - -__attribute__((noipa)) v16hi -f5 (v16hi x, v16hi y) -{ - return x >= y; -} - -__attribute__((noipa)) v16uhi -f6 (v16uhi x, v16uhi y) -{ - return x >= y; -} - -__attribute__((noipa)) v16hi -f7 (v16hi x, v16hi y) -{ - return x <= y; -} - -__attribute__((noipa)) v16uhi -f8 (v16uhi x, v16uhi y) -{ - return x <= y; -} - -__attribute__((noipa)) v8si -f9 (v8si x, v8si y) -{ - return x >= y; -} - -__attribute__((noipa)) v8usi -f10 (v8usi x, v8usi y) -{ - return x >= y; -} - -__attribute__((noipa)) v8si -f11 (v8si x, v8si y) -{ - return x <= y; -} - -__attribute__((noipa)) v8usi -f12 (v8usi x, v8usi y) -{ - return x <= y; -} - -__attribute__((noipa)) v4di -f13 (v4di x, v4di y) -{ - return x >= y; -} - -__attribute__((noipa)) v4udi -f14 (v4udi x, v4udi y) -{ - return x >= y; -} - -__attribute__((noipa)) v4di -f15 (v4di x, v4di y) -{ - return x <= y; -} - -__attribute__((noipa)) v4udi -f16 (v4udi x, v4udi y) -{ - return x <= y; -} diff --git a/gcc/testsuite/gcc.target/i386/pr99025.c b/gcc/testsuite/gcc.target/i386/pr99025.c new file mode 100644 index 0000000..288538d --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr99025.c @@ -0,0 +1,17 @@ +/* PR target/99025 */ +/* { dg-do compile } */ +/* { dg-options "-O3 -msse4" } */ + +long v[16]; +int w; +union U { float u; int r; } x; + +void +foo (float y) +{ + union U z; + x.u = w; + v[5] = x.r; + z.u = y; + v[6] = z.r; +} diff --git a/gcc/testsuite/gcc.target/i386/prefer-vector-width-attr.c b/gcc/testsuite/gcc.target/i386/prefer-vector-width-attr.c new file mode 100644 index 0000000..3929f90 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/prefer-vector-width-attr.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ + +#pragma GCC push_options +#pragma GCC target("prefer-vector-width=512") + +int +__attribute__((target("prefer-vector-width=none"))) +main() +{ + return 0; +} diff --git a/gcc/testsuite/gdc.dg/intrinsics.d b/gcc/testsuite/gdc.dg/intrinsics.d index a775237..d9ccc0e 100644 --- a/gcc/testsuite/gdc.dg/intrinsics.d +++ b/gcc/testsuite/gdc.dg/intrinsics.d @@ -3,6 +3,7 @@ import core.bitop; import core.checkedint; import core.math; +import core.volatile; import core.stdc.stdarg; ////////////////////////////////////////////////////// @@ -24,6 +25,8 @@ int test_btc(size_t *a, size_t b) { return btc(a, b); } int test_btr(size_t *a, size_t b) { return btr(a, b); } // { dg-final { scan-tree-dump-not " <retval> = bts " "original" } } int test_bts(size_t *a, size_t b) { return bts(a, b); } +// { dg-final { scan-tree-dump " __builtin_bswap16 " "original" } } +ushort test_byteswap(ushort a) { return byteswap(a); } // { dg-final { scan-tree-dump " __builtin_bswap32 " "original" } } uint test_bswap(uint a) { return bswap(a); } // { dg-final { scan-tree-dump " __builtin_bswap64 " "original" } } diff --git a/gcc/testsuite/gfortran.dg/assumed_rank_20.f90 b/gcc/testsuite/gfortran.dg/assumed_rank_20.f90 new file mode 100644 index 0000000..10ad1fc --- /dev/null +++ b/gcc/testsuite/gfortran.dg/assumed_rank_20.f90 @@ -0,0 +1,36 @@ +! { dg-do run } +! +! PR fortran/99043 +! +module assumed_rank_module + implicit none + private + + public :: rank_of_pointer_level1 +contains + subroutine rank_of_pointer_level1(ap,aa) + real, dimension(..), intent(in), pointer :: ap + real, dimension(..), intent(in), allocatable :: aa + if (rank(ap) /= 3) stop 1 + if (rank(aa) /= 3) stop 2 + call rank_of_pointer_level2(ap, aa) + end subroutine rank_of_pointer_level1 + + subroutine rank_of_pointer_level2(ap,aa) + real, dimension(..), intent(in), pointer :: ap + real, dimension(..), intent(in), allocatable :: aa + + if (rank(ap) /= 3) stop 3 + if (rank(aa) /= 3) stop 4 + end subroutine rank_of_pointer_level2 +end module assumed_rank_module + +program assumed_rank + use :: assumed_rank_module, only : rank_of_pointer_level1 + implicit none + real, dimension(:,:,:), pointer :: ap + real, dimension(:,:,:), allocatable :: aa + + ap => null() + call rank_of_pointer_level1(ap, aa) +end program assumed_rank diff --git a/gcc/testsuite/gfortran.dg/dollar_edit_descriptor_4.f b/gcc/testsuite/gfortran.dg/dollar_edit_descriptor_4.f new file mode 100644 index 0000000..c8453ce --- /dev/null +++ b/gcc/testsuite/gfortran.dg/dollar_edit_descriptor_4.f @@ -0,0 +1,16 @@ +! { dg-do run } +! { dg-options "-std=gnu" } +! PR98825 Test for fix of '$' edit descriptor. + character(30) :: line + 10 format (i3,$) + + open(10, status='scratch') + write (10,10) 1 + write (10,10) 2,3,4,5 +! Check the result. + line = 'abcdefg' + rewind(10) + read(10, '(a)') line + close(10) + if (line .ne. ' 1 2 3 4 5') call abort + end diff --git a/gcc/testsuite/gfortran.dg/goacc/array-with-dt-2.f90 b/gcc/testsuite/gfortran.dg/goacc/array-with-dt-2.f90 new file mode 100644 index 0000000..e4a6f31 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc/array-with-dt-2.f90 @@ -0,0 +1,11 @@ +type t + integer, allocatable :: A(:,:) +end type t + +type(t), allocatable :: b(:) + +! TODO: Remove expected errors when this is supported. +!$acc update host(b(::2)) ! { dg-error "Stride should not be specified for array section in MAP clause" } +!$acc update host(b(1)%A(::3,::4)) ! { dg-error "Stride should not be specified for array section in MAP clause" } +end + diff --git a/gcc/testsuite/gfortran.dg/goacc/derived-chartypes-1.f90 b/gcc/testsuite/gfortran.dg/goacc/derived-chartypes-1.f90 new file mode 100644 index 0000000..f7aafbf --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc/derived-chartypes-1.f90 @@ -0,0 +1,132 @@ +! This currently ICEs. Avoid that. +! { dg-skip-if "PR98979" { *-*-* } } + +type :: type1 + character(len=35) :: a +end type type1 + +type :: type2 + character(len=35), pointer :: b +end type type2 + +type :: aux1 + character(len=22) :: y +end type aux1 + +type, extends(aux1) :: aux + character(len=33) :: x +end type aux + +type :: type3 + class(aux), pointer :: c(:) +end type type3 + +type :: type4 + integer, pointer :: d(:) +end type type4 + +type :: type5 + type(aux1) :: e +end type type5 + +type :: type6 + type(aux1), pointer :: f +end type type6 + +type :: type7 + class(aux), pointer :: g +end type type7 + +type(type1) :: foo +type(type2) :: bar +type(type3) :: qux +type(type4) :: quux +type(type5) :: fred +type(type6) :: jim +type(type7) :: shiela + +type(type1), pointer :: pfoo +type(type2), pointer :: pbar +type(type3), pointer :: pqux +type(type4), pointer :: pquux +type(type5), pointer :: pfred +type(type6), pointer :: pjim +type(type7), pointer :: pshiela + +class(type1), pointer :: cfoo +class(type2), pointer :: cbar +class(type3), pointer :: cqux +class(type4), pointer :: cquux +class(type5), pointer :: cfred +class(type6), pointer :: cjim +class(type7), pointer :: cshiela + +class(type1), allocatable :: acfoo +class(type2), allocatable :: acbar +class(type3), allocatable :: acqux +class(type4), allocatable :: acquux +class(type5), allocatable :: acfred +class(type6), allocatable :: acjim +class(type7), allocatable :: acshiela + +!$acc enter data copyin(foo) +!$acc enter data copyin(foo%a) +!$acc enter data copyin(bar) +!$acc enter data copyin(bar%b) +!$acc enter data copyin(qux) +!$acc enter data copyin(qux%c) +!$acc enter data copyin(quux) +!$acc enter data copyin(quux%d) +!$acc enter data copyin(fred) +!$acc enter data copyin(fred%e) +!$acc enter data copyin(jim) +!$acc enter data copyin(jim%f) +!$acc enter data copyin(shiela) +!$acc enter data copyin(shiela%g) + +!$acc enter data copyin(pfoo) +!$acc enter data copyin(pfoo%a) +!$acc enter data copyin(pbar) +!$acc enter data copyin(pbar%b) +!$acc enter data copyin(pqux) +!$acc enter data copyin(pqux%c) +!$acc enter data copyin(pquux) +!$acc enter data copyin(pquux%d) +!$acc enter data copyin(pfred) +!$acc enter data copyin(pfred%e) +!$acc enter data copyin(pjim) +!$acc enter data copyin(pjim%f) +!$acc enter data copyin(pshiela) +!$acc enter data copyin(pshiela%g) + +!$acc enter data copyin(cfoo) +!$acc enter data copyin(cfoo%a) +!$acc enter data copyin(cbar) +!$acc enter data copyin(cbar%b) +!$acc enter data copyin(cqux) +!$acc enter data copyin(cqux%c) +!$acc enter data copyin(cquux) +!$acc enter data copyin(cquux%d) +!$acc enter data copyin(cfred) +!$acc enter data copyin(cfred%e) +!$acc enter data copyin(cjim) +!$acc enter data copyin(cjim%f) +!$acc enter data copyin(cshiela) +!$acc enter data copyin(cshiela%g) + +!$acc enter data copyin(acfoo) +!$acc enter data copyin(acfoo%a) +!$acc enter data copyin(acbar) +!$acc enter data copyin(acbar%b) +!$acc enter data copyin(acqux) +!$acc enter data copyin(acqux%c) +!$acc enter data copyin(acquux) +!$acc enter data copyin(acquux%d) +!$acc enter data copyin(acfred) +!$acc enter data copyin(acfred%e) +!$acc enter data copyin(acjim) +!$acc enter data copyin(acjim%f) +!$acc enter data copyin(acshiela) +!$acc enter data copyin(acshiela%g) + +end diff --git a/gcc/testsuite/gfortran.dg/goacc/derived-chartypes-2.f90 b/gcc/testsuite/gfortran.dg/goacc/derived-chartypes-2.f90 new file mode 100644 index 0000000..e22fc67 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc/derived-chartypes-2.f90 @@ -0,0 +1,132 @@ +! This currently ICEs. Avoid that. +! { dg-skip-if "PR98979" { *-*-* } } + +type :: type1 + character(len=35,kind=4) :: a +end type type1 + +type :: type2 + character(len=35,kind=4), pointer :: b +end type type2 + +type :: aux1 + character(len=22,kind=4) :: y +end type aux1 + +type, extends(aux1) :: aux + character(len=33,kind=4) :: x +end type aux + +type :: type3 + class(aux), pointer :: c(:) +end type type3 + +type :: type4 + integer, pointer :: d(:) +end type type4 + +type :: type5 + type(aux1) :: e +end type type5 + +type :: type6 + type(aux1), pointer :: f +end type type6 + +type :: type7 + class(aux), pointer :: g +end type type7 + +type(type1) :: foo +type(type2) :: bar +type(type3) :: qux +type(type4) :: quux +type(type5) :: fred +type(type6) :: jim +type(type7) :: shiela + +type(type1), pointer :: pfoo +type(type2), pointer :: pbar +type(type3), pointer :: pqux +type(type4), pointer :: pquux +type(type5), pointer :: pfred +type(type6), pointer :: pjim +type(type7), pointer :: pshiela + +class(type1), pointer :: cfoo +class(type2), pointer :: cbar +class(type3), pointer :: cqux +class(type4), pointer :: cquux +class(type5), pointer :: cfred +class(type6), pointer :: cjim +class(type7), pointer :: cshiela + +class(type1), allocatable :: acfoo +class(type2), allocatable :: acbar +class(type3), allocatable :: acqux +class(type4), allocatable :: acquux +class(type5), allocatable :: acfred +class(type6), allocatable :: acjim +class(type7), allocatable :: acshiela + +!$acc enter data copyin(foo) +!$acc enter data copyin(foo%a) +!$acc enter data copyin(bar) +!$acc enter data copyin(bar%b) +!$acc enter data copyin(qux) +!$acc enter data copyin(qux%c) +!$acc enter data copyin(quux) +!$acc enter data copyin(quux%d) +!$acc enter data copyin(fred) +!$acc enter data copyin(fred%e) +!$acc enter data copyin(jim) +!$acc enter data copyin(jim%f) +!$acc enter data copyin(shiela) +!$acc enter data copyin(shiela%g) + +!$acc enter data copyin(pfoo) +!$acc enter data copyin(pfoo%a) +!$acc enter data copyin(pbar) +!$acc enter data copyin(pbar%b) +!$acc enter data copyin(pqux) +!$acc enter data copyin(pqux%c) +!$acc enter data copyin(pquux) +!$acc enter data copyin(pquux%d) +!$acc enter data copyin(pfred) +!$acc enter data copyin(pfred%e) +!$acc enter data copyin(pjim) +!$acc enter data copyin(pjim%f) +!$acc enter data copyin(pshiela) +!$acc enter data copyin(pshiela%g) + +!$acc enter data copyin(cfoo) +!$acc enter data copyin(cfoo%a) +!$acc enter data copyin(cbar) +!$acc enter data copyin(cbar%b) +!$acc enter data copyin(cqux) +!$acc enter data copyin(cqux%c) +!$acc enter data copyin(cquux) +!$acc enter data copyin(cquux%d) +!$acc enter data copyin(cfred) +!$acc enter data copyin(cfred%e) +!$acc enter data copyin(cjim) +!$acc enter data copyin(cjim%f) +!$acc enter data copyin(cshiela) +!$acc enter data copyin(cshiela%g) + +!$acc enter data copyin(acfoo) +!$acc enter data copyin(acfoo%a) +!$acc enter data copyin(acbar) +!$acc enter data copyin(acbar%b) +!$acc enter data copyin(acqux) +!$acc enter data copyin(acqux%c) +!$acc enter data copyin(acquux) +!$acc enter data copyin(acquux%d) +!$acc enter data copyin(acfred) +!$acc enter data copyin(acfred%e) +!$acc enter data copyin(acjim) +!$acc enter data copyin(acjim%f) +!$acc enter data copyin(acshiela) +!$acc enter data copyin(acshiela%g) + +end diff --git a/gcc/testsuite/gfortran.dg/goacc/derived-chartypes-3.f90 b/gcc/testsuite/gfortran.dg/goacc/derived-chartypes-3.f90 new file mode 100644 index 0000000..2bab497 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc/derived-chartypes-3.f90 @@ -0,0 +1,38 @@ +! { dg-additional-options "-fdump-tree-gimple" } + +type :: type1 + character(len=35) :: a +end type type1 + +type :: type2 + character(len=46), pointer :: b +end type type2 + +type(type1) :: foo +type(type2) :: bar + +type(type1), pointer :: pfoo +type(type2), pointer :: pbar + +class(type1), pointer :: cfoo +class(type2), pointer :: cbar + +class(type1), allocatable :: acfoo +class(type2), allocatable :: acbar + +!$acc enter data copyin(foo%a) +!$acc enter data copyin(bar%b) + +!$acc enter data copyin(pfoo%a) +!$acc enter data copyin(pbar%b) + +!$acc enter data copyin(cfoo%a) +!$acc enter data copyin(cbar%b) + +!$acc enter data copyin(acfoo%a) +!$acc enter data copyin(acbar%b) + +! { dg-final { scan-tree-dump-times "to:\[^\\\[\]*\\\[len: 35\\\]" 4 "gimple" } } +! { dg-final { scan-tree-dump-times "to:\[^\\\[\]*\\\[len: 46\\\]" 4 "gimple" } } + +end diff --git a/gcc/testsuite/gfortran.dg/goacc/derived-chartypes-4.f90 b/gcc/testsuite/gfortran.dg/goacc/derived-chartypes-4.f90 new file mode 100644 index 0000000..cfe4006 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc/derived-chartypes-4.f90 @@ -0,0 +1,38 @@ +! { dg-additional-options "-fdump-tree-gimple" } + +type :: type1 + character(len=35,kind=4) :: a +end type type1 + +type :: type2 + character(len=46,kind=4), pointer :: b +end type type2 + +type(type1) :: foo +type(type2) :: bar + +type(type1), pointer :: pfoo +type(type2), pointer :: pbar + +class(type1), pointer :: cfoo +class(type2), pointer :: cbar + +class(type1), allocatable :: acfoo +class(type2), allocatable :: acbar + +!$acc enter data copyin(foo%a) +!$acc enter data copyin(bar%b) + +!$acc enter data copyin(pfoo%a) +!$acc enter data copyin(pbar%b) + +!$acc enter data copyin(cfoo%a) +!$acc enter data copyin(cbar%b) + +!$acc enter data copyin(acfoo%a) +!$acc enter data copyin(acbar%b) + +! { dg-final { scan-tree-dump-times "to:\[^\\\[\]*\\\[len: 140\\\]" 4 "gimple" } } +! { dg-final { scan-tree-dump-times "to:\[^\\\[\]*\\\[len: 184\\\]" 4 "gimple" } } + +end diff --git a/gcc/testsuite/gfortran.dg/goacc/derived-classtypes-1.f95 b/gcc/testsuite/gfortran.dg/goacc/derived-classtypes-1.f95 new file mode 100644 index 0000000..e6cf09c --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc/derived-classtypes-1.f95 @@ -0,0 +1,129 @@ +type :: type1 + integer :: a +end type type1 + +type :: type2 + integer, pointer :: b +end type type2 + +type :: aux1 + integer :: y +end type aux1 + +type, extends(aux1) :: aux + integer :: x +end type aux + +type :: type3 + class(aux), pointer :: c(:) +end type type3 + +type :: type4 + integer, pointer :: d(:) +end type type4 + +type :: type5 + type(aux) :: e +end type type5 + +type :: type6 + type(aux), pointer :: f +end type type6 + +type :: type7 + class(aux), pointer :: g +end type type7 + +type(type1) :: foo +type(type2) :: bar +type(type3) :: qux +type(type4) :: quux +type(type5) :: fred +type(type6) :: jim +type(type7) :: shiela + +type(type1), pointer :: pfoo +type(type2), pointer :: pbar +type(type3), pointer :: pqux +type(type4), pointer :: pquux +type(type5), pointer :: pfred +type(type6), pointer :: pjim +type(type7), pointer :: pshiela + +class(type1), pointer :: cfoo +class(type2), pointer :: cbar +class(type3), pointer :: cqux +class(type4), pointer :: cquux +class(type5), pointer :: cfred +class(type6), pointer :: cjim +class(type7), pointer :: cshiela + +class(type1), allocatable :: acfoo +class(type2), allocatable :: acbar +class(type3), allocatable :: acqux +class(type4), allocatable :: acquux +class(type5), allocatable :: acfred +class(type6), allocatable :: acjim +class(type7), allocatable :: acshiela + +!$acc enter data copyin(foo) +!$acc enter data copyin(foo%a) +!$acc enter data copyin(bar) +!$acc enter data copyin(bar%b) +!$acc enter data copyin(qux) +!!$acc enter data copyin(qux%c) +!$acc enter data copyin(quux) +!$acc enter data copyin(quux%d) +!$acc enter data copyin(fred) +!$acc enter data copyin(fred%e) +!$acc enter data copyin(jim) +!$acc enter data copyin(jim%f) +!$acc enter data copyin(shiela) +!$acc enter data copyin(shiela%g) + +!$acc enter data copyin(pfoo) +!$acc enter data copyin(pfoo%a) +!$acc enter data copyin(pbar) +!$acc enter data copyin(pbar%b) +!$acc enter data copyin(pqux) +!!$acc enter data copyin(pqux%c) +!$acc enter data copyin(pquux) +!$acc enter data copyin(pquux%d) +!$acc enter data copyin(pfred) +!$acc enter data copyin(pfred%e) +!$acc enter data copyin(pjim) +!$acc enter data copyin(pjim%f) +!$acc enter data copyin(pshiela) +!$acc enter data copyin(pshiela%g) + +!$acc enter data copyin(cfoo) +!$acc enter data copyin(cfoo%a) +!$acc enter data copyin(cbar) +!$acc enter data copyin(cbar%b) +!$acc enter data copyin(cqux) +!!$acc enter data copyin(cqux%c) +!$acc enter data copyin(cquux) +!$acc enter data copyin(cquux%d) +!$acc enter data copyin(cfred) +!$acc enter data copyin(cfred%e) +!$acc enter data copyin(cjim) +!$acc enter data copyin(cjim%f) +!$acc enter data copyin(cshiela) +!$acc enter data copyin(cshiela%g) + +!$acc enter data copyin(acfoo) +!$acc enter data copyin(acfoo%a) +!$acc enter data copyin(acbar) +!$acc enter data copyin(acbar%b) +!$acc enter data copyin(acqux) +!!$acc enter data copyin(acqux%c) +!$acc enter data copyin(acquux) +!$acc enter data copyin(acquux%d) +!$acc enter data copyin(acfred) +!$acc enter data copyin(acfred%e) +!$acc enter data copyin(acjim) +!$acc enter data copyin(acjim%f) +!$acc enter data copyin(acshiela) +!$acc enter data copyin(acshiela%g) + +end diff --git a/gcc/testsuite/gfortran.dg/goacc/substring.f90 b/gcc/testsuite/gfortran.dg/goacc/substring.f90 new file mode 100644 index 0000000..25031da --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc/substring.f90 @@ -0,0 +1,27 @@ +implicit none +character(len=10) :: str1, str2(5,5) + +type t + character(len=10) :: str1, str2(5,5) +end type t +type(t) :: v + +!$acc enter data copyin(v%str1) ! OK +!$acc enter data copyin(v%str2) ! OK +!$acc enter data copyin(v%str2(1,2)) ! OK +!$acc enter data copyin(str1) ! OK +!$acc enter data copyin(str2) ! OK +!$acc enter data copyin(str2(1,2)) ! OK + +!$acc enter data copyin(v%str1(2:5)) ! { dg-error "Unexpected substring reference in MAP clause" } +!$acc enter data copyin(v%str2(1,2)(2:4)) ! { dg-error "Unexpected substring reference in MAP clause" } +!$acc enter data copyin(str1(2:5)) ! { dg-error "Unexpected substring reference in MAP clause" } +!$acc enter data copyin(str2(1,2)(2:4)) ! { dg-error "Unexpected substring reference in MAP clause" } + +!$acc parallel +!$acc update host(v%str1(2:5)) ! { dg-error "Unexpected substring reference in MAP clause" } +!$acc update host(v%str2(1,2)(2:4)) ! { dg-error "Unexpected substring reference in MAP clause" } +!$acc update host(str1(2:5)) ! { dg-error "Unexpected substring reference in MAP clause" } +!$acc update host(str2(1,2)(2:4)) ! { dg-error "Unexpected substring reference in MAP clause" } +!$acc end parallel +end diff --git a/gcc/testsuite/gfortran.dg/gomp/substring.f90 b/gcc/testsuite/gfortran.dg/gomp/substring.f90 new file mode 100644 index 0000000..23d7fb7 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/substring.f90 @@ -0,0 +1,22 @@ +implicit none +character(len=10) :: str1, str2(5,5) + +type t + character(len=10) :: str1, str2(5,5) +end type t +type(t) :: v + +!$omp target enter data map(to: str1) ! OK +!$omp target enter data map(to: str2) ! OK +!$omp target enter data map(to: str2(2,5)) ! OK + +!$omp target enter data map(to: str1(2,5)) ! { dg-error "Syntax error in OpenMP variable list" } +!$omp target enter data map(to: str2(1,2)(2:4)) ! { dg-error "Unexpected substring reference in MAP clause" } + +!$omp target enter data map(to: v%str1) ! OK +!$omp target enter data map(to: v%str2) ! OK +!$omp target enter data map(to: v%str2(1,2)) ! OK + +!$omp target enter data map(to: v%str1(2:5)) ! { dg-error "Unexpected substring reference in MAP clause" } +!$omp target enter data map(to: v%str2(1,2)(2:4)) ! { dg-error "Unexpected substring reference in MAP clause" } +end diff --git a/gcc/testsuite/gfortran.dg/ieee/ieee_12.f90 b/gcc/testsuite/gfortran.dg/ieee/ieee_12.f90 new file mode 100644 index 0000000..139a701 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/ieee/ieee_12.f90 @@ -0,0 +1,24 @@ +! { dg-do run } +! PR95647 operator(.eq.) and operator(==) treated differently +program test + use, intrinsic :: ieee_arithmetic, only : & +& ieee_class, & +& ieee_class_type, & +& ieee_negative_normal, & +& ieee_positive_normal, & +& operator(.eq.), operator(.ne.) + integer :: good + real(4) r4 + type(ieee_class_type) class1 + good = 0 + r4 = 1.0 + class1 = ieee_class(r4) + if (class1 .eq. ieee_positive_normal) good = good + 1 + if (class1 .ne. ieee_negative_normal) good = good + 1 + r4 = -1.0 + class1 = ieee_class(r4) + if (class1 .eq. ieee_negative_normal) good = good + 1 + if (class1 .ne. ieee_positive_normal) good = good + 1 + if (good /= 4) call abort +end program test + diff --git a/gcc/testsuite/gfortran.dg/pr98974.F90 b/gcc/testsuite/gfortran.dg/pr98974.F90 new file mode 100644 index 0000000..296adad --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr98974.F90 @@ -0,0 +1,21 @@ +! PR middle-end/98974 +! { dg-do compile } +! { dg-options "-Ofast" } +! { dg-additional-options "-mcpu=neoverse-v1" { target aarch64*-*-* } } + +module module_foobar + integer,parameter :: fp_kind = selected_real_kind(15) +contains + subroutine foobar( foo, ix ,jx ,kx,iy,ky) + real, dimension( ix, kx, jx ) :: foo + real(fp_kind), dimension( iy, ky, 3 ) :: bar, baz + do k=1,ky + do i=1,iy + if ( baz(i,k,1) > 0. ) then + bar(i,k,1) = 0 + endif + foo(i,nk,j) = baz0 * bar(i,k,1) + enddo + enddo + end +end diff --git a/gcc/testsuite/gfortran.dg/pr99060.f90 b/gcc/testsuite/gfortran.dg/pr99060.f90 new file mode 100644 index 0000000..fdf3b1a --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr99060.f90 @@ -0,0 +1,10 @@ +! { dg-do compile } +! +! Test the fix for PR99060 in which the expression caused an ICE after the error. +! +! Contributed by Gerhard Steinmetz <gscfq@t-online.de> +! +program p + real :: a + print *, a%kind%n ! { dg-error "not an inquiry reference" } +end diff --git a/gcc/testsuite/gfortran.dg/typebound_call_32.f90 b/gcc/testsuite/gfortran.dg/typebound_call_32.f90 new file mode 100644 index 0000000..88ddae4 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/typebound_call_32.f90 @@ -0,0 +1,39 @@ +! { dg-do run } +! +! Test the fix for PR98897 in which typebound subroutines of associate names +! were not recognised in a call. Functions were OK but this is tested below. +! +! Contributed by Damian Rouson <damian@sourceryinstitute.org> +! +module output_data_m + implicit none + + type output_data_t + integer, private :: i = 0 + contains + procedure output, return_value + end type + + +contains + subroutine output(self) + implicit none + class(output_data_t) self + self%i = 1234 + end subroutine + + integer function return_value(self) + implicit none + class(output_data_t) self + return_value = self%i + end function +end module + + use output_data_m + implicit none + associate(output_data => output_data_t()) + call output_data%output + if (output_data%return_value() .ne. 1234) stop 1 + end associate +end + diff --git a/gcc/testsuite/lib/scanasm.exp b/gcc/testsuite/lib/scanasm.exp index 65e3118..e723608 100644 --- a/gcc/testsuite/lib/scanasm.exp +++ b/gcc/testsuite/lib/scanasm.exp @@ -275,6 +275,9 @@ proc dg-scan-symbol-section { name testcase output_file orig_args } { foreach symbol_name [lsort [array names section_by_symbol]] { if { [regexp -- $symbol_pattern $symbol_name] } { set section $section_by_symbol($symbol_name) + if { [istarget powerpc*-*-*] && $section == ".opd" } { + set section $section_by_symbol(.L.$symbol_name) + } set description "$testcase $name symbol $printable_symbol_pattern (found $symbol_name) has section $printable_expected_section_pattern" if { $section == "" } { fail "$description (no section detected)" @@ -321,13 +324,16 @@ proc parse_section_of_symbols { filename result } { set section_pattern {^\s*(?:(?:\.section|\.csect)\s+(.*)|(\.const|\.data|\.text)\s*)$} set label_pattern {^(\S+):$} + set previous_pattern {^\s*\.previous\s*$} set fd [open $filename r] set current_section "" + set prev_section "" while { [gets $fd line] >= 0 } { if { [regexp -- $label_pattern $line dummy symbol_name] } { set up_result($symbol_name) $current_section } elseif { [regexp -- $section_pattern $line dummy section_directive_arguments full_section_directive] } { + set prev_section $current_section if { $full_section_directive eq "" } { # Example: .section .text,"ax",progbits # Example: .section ".text",#alloc,#execinstr,#progbits @@ -344,7 +350,11 @@ proc parse_section_of_symbols { filename result } { # Example: .text set current_section "$full_section_directive" } - } + } elseif { [regexp -- $previous_pattern $line dummy] } { + set sect $prev_section + set prev_section $current_section + set current_section $sect + } } close $fd } diff --git a/gcc/testsuite/objc.dg/id-1.m b/gcc/testsuite/objc.dg/id-1.m index 2bfcc63..271dbe6 100644 --- a/gcc/testsuite/objc.dg/id-1.m +++ b/gcc/testsuite/objc.dg/id-1.m @@ -2,6 +2,6 @@ /* { dg-do compile } */ typedef int id; /* { dg-error "conflicting types for .id." } */ -/* { dg-message "previous declaration of .id. was here" "" { target *-*-* } 0 } */ +/* { dg-message "previous declaration of .id." "" { target *-*-* } 0 } */ id b; diff --git a/gcc/testsuite/objc.dg/tls/diag-3.m b/gcc/testsuite/objc.dg/tls/diag-3.m index c71f66f..b39d565 100644 --- a/gcc/testsuite/objc.dg/tls/diag-3.m +++ b/gcc/testsuite/objc.dg/tls/diag-3.m @@ -1,10 +1,10 @@ /* Report invalid extern and __thread combinations. */ /* { dg-require-effective-target tls } */ -extern int j; /* { dg-message "previous declaration of 'j' was here" } */ +extern int j; /* { dg-message "previous declaration of 'j'" } */ __thread int j; /* { dg-error "follows non-thread-local" } */ -extern __thread int i; /* { dg-message "previous declaration of 'i' was here" } */ +extern __thread int i; /* { dg-message "previous declaration of 'i'" } */ int i; /* { dg-error "follows thread-local" } */ extern __thread int k; /* This is fine. */ |