diff options
author | Martin Liska <mliska@suse.cz> | 2022-10-19 15:25:12 +0200 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2022-10-19 15:25:12 +0200 |
commit | 4465e2a047c3b175bf6c4ca500547eb6b12df52f (patch) | |
tree | 3159c8256f9907538f186ce7c1087c83825b5519 /gcc/testsuite | |
parent | 6c22519f33270a689fc8730ceff9212b376ed40d (diff) | |
parent | 09fed44cabd50f3d8e050f91cc2db02364ce9176 (diff) | |
download | gcc-4465e2a047c3b175bf6c4ca500547eb6b12df52f.zip gcc-4465e2a047c3b175bf6c4ca500547eb6b12df52f.tar.gz gcc-4465e2a047c3b175bf6c4ca500547eb6b12df52f.tar.bz2 |
Merge branch 'master' into devel/sphinx
Diffstat (limited to 'gcc/testsuite')
59 files changed, 1317 insertions, 16 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f717614..763e88a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,130 @@ +2022-10-18 Joseph Myers <joseph@codesourcery.com> + + PR c/107164 + * gcc.dg/c99-tag-4.c, gcc.dg/c99-tag-5.c, gcc.dg/c99-tag-6.c: New + tests. + +2022-10-18 Marek Polacek <polacek@redhat.com> + + PR testsuite/107213 + * c-c++-common/pointer-to-fn1.c: Only run on i?86/x86_64. + +2022-10-18 Patrick Palka <ppalka@redhat.com> + + PR c++/105045 + * g++.dg/modules/pr105045_a.C: New test. + * g++.dg/modules/pr105045_b.C: New test. + +2022-10-18 Joseph Myers <joseph@codesourcery.com> + + PR c/36113 + * gcc.dg/c11-enum-1.c, gcc.dg/c11-enum-2.c, gcc.dg/c11-enum-3.c, + gcc.dg/c2x-enum-1.c, gcc.dg/c2x-enum-2.c, gcc.dg/c2x-enum-3.c, + gcc.dg/c2x-enum-4.c, gcc.dg/c2x-enum-5.c: New tests. + * gcc.dg/pr30260.c: Explicitly use -std=gnu11. Update expected + diagnostics. + * gcc.dg/torture/pr25183.c: Update expected diagnostics. + +2022-10-18 Martin Jambor <mjambor@suse.cz> + + * gcc.dg/ipa/ipcp-agg-11.c: Adjust dumps. + * gcc.dg/ipa/ipcp-agg-8.c: Likewise. + +2022-10-18 Richard Biener <rguenther@suse.de> + + PR tree-optimization/107302 + * gcc.dg/vect/pr107302.c: New testcase. + +2022-10-18 Andre Vieira <andre.simoesdiasvieira@arm.com> + + * gcc.dg/vect/pr107275.c: New test. + +2022-10-18 Jakub Jelinek <jakub@redhat.com> + + PR c++/106654 + * g++.dg/cpp23/attr-assume5.C: New test. + * g++.dg/cpp23/attr-assume6.C: New test. + * g++.dg/cpp23/attr-assume7.C: New test. + +2022-10-18 Richard Biener <rguenther@suse.de> + + PR tree-optimization/107301 + * gcc.dg/torture/pr107301.c: New testcase. + +2022-10-18 Liwei Xu <liwei.xu@intel.com> + + PR testsuite/107220 + * gcc.dg/tree-ssa/forwprop-19.c: Move scanning pass from + forwprop1 to dse1, This fixs the test case fail. + +2022-10-18 Andrew MacLeod <amacleod@redhat.com> + + PR tree-optimization/107273 + * gcc.dg/tree-ssa/pr107273-1.c: New. + * gcc.dg/tree-ssa/pr107273-2.c: New. + +2022-10-17 Steve Kargl <kargl@gcc.gnu.org> + + PR fortran/104330 + * gfortran.dg/pr104330.f90: New test. + +2022-10-17 Aldy Hernandez <aldyh@redhat.com> + + PR tree-optimization/107293 + * gcc.dg/tree-ssa/pr107293.c: New test. + +2022-10-17 Harald Anlauf <anlauf@gmx.de> + Mikael Morin <mikael@gcc.gnu.org> + + PR fortran/93483 + PR fortran/107216 + PR fortran/107219 + * gfortran.dg/array_constructor_56.f90: New test. + * gfortran.dg/array_constructor_57.f90: New test. + +2022-10-17 Harald Anlauf <anlauf@gmx.de> + + PR fortran/107272 + * gfortran.dg/pr107272.f90: New test. + +2022-10-17 Tobias Burnus <tobias@codesourcery.com> + + PR fortran/107266 + * gfortran.dg/char4_decl.f90: New test. + * gfortran.dg/char4_decl-2.f90: New test. + +2022-10-17 Patrick Palka <ppalka@redhat.com> + + PR c++/101449 + * g++.dg/modules/cexpr-3_a.C: New test. + * g++.dg/modules/cexpr-3_b.C: New test. + +2022-10-17 Aldy Hernandez <aldyh@redhat.com> + + PR tree-optimization/105820 + * g++.dg/tree-ssa/pr105820.c: New test. + +2022-10-17 Aldy Hernandez <aldyh@redhat.com> + + * gcc.dg/tree-ssa/vrp-float-3a.c: New. + * gcc.dg/tree-ssa/vrp-float-4a.c: New. + * gcc.dg/tree-ssa/vrp-float-5a.c: New. + +2022-10-17 Richard Biener <rguenther@suse.de> + Ju-Zhe Zhong <juzhe.zhong@rivai.ai> + + PR tree-optimization/99409 + PR tree-optimization/99394 + * gcc.dg/vect/vect-recurr-1.c: New testcase. + * gcc.dg/vect/vect-recurr-2.c: Likewise. + * gcc.dg/vect/vect-recurr-3.c: Likewise. + * gcc.dg/vect/vect-recurr-4.c: Likewise. + * gcc.dg/vect/vect-recurr-5.c: Likewise. + * gcc.dg/vect/vect-recurr-6.c: Likewise. + * gcc.dg/vect/tsvc/vect-tsvc-s252.c: Un-XFAIL. + * gcc.dg/vect/tsvc/vect-tsvc-s254.c: Likewise. + * gcc.dg/vect/tsvc/vect-tsvc-s291.c: Likewise. + 2022-10-14 Joseph Myers <joseph@codesourcery.com> * gcc.dg/cpp/c2x-ucnid-1-utf8.c, gcc.dg/cpp/c2x-ucnid-1.c: New diff --git a/gcc/testsuite/c-c++-common/pointer-to-fn1.c b/gcc/testsuite/c-c++-common/pointer-to-fn1.c index 9758854..e2f948d 100644 --- a/gcc/testsuite/c-c++-common/pointer-to-fn1.c +++ b/gcc/testsuite/c-c++-common/pointer-to-fn1.c @@ -1,4 +1,5 @@ /* PR c++/106937 */ +/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ /* { dg-options "-fcf-protection" } */ /* { dg-additional-options "-std=c++11 -fpermissive" { target c++ } } */ /* Test printing a pointer to function with attribute. */ diff --git a/gcc/testsuite/c-c++-common/ubsan/pr106990.c b/gcc/testsuite/c-c++-common/ubsan/pr106990.c new file mode 100644 index 0000000..5bd46af --- /dev/null +++ b/gcc/testsuite/c-c++-common/ubsan/pr106990.c @@ -0,0 +1,29 @@ +/* PR tree-optimization/106990 */ +/* { dg-do run { target int32 } } */ +/* { dg-options "-fsanitize=signed-integer-overflow" } */ + +__attribute__((noipa)) int +foo (void) +{ + int x = -1956816001; + int y = 1999200512; + return ~x - ~y; +} + +__attribute__((noipa)) int +bar (void) +{ + int x = -__INT_MAX__ - 1; + return -x & 1; +} + +int +main () +{ + foo (); + bar (); + return 0; +} + +/* { dg-output "signed integer overflow: 1956816000 - -1999200513 cannot be represented in type 'int'\[^\n\r]*(\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself" } */ diff --git a/gcc/testsuite/g++.dg/cpp23/attr-assume5.C b/gcc/testsuite/g++.dg/cpp23/attr-assume5.C new file mode 100644 index 0000000..fec2209 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp23/attr-assume5.C @@ -0,0 +1,5 @@ +// P1774R8 - Portable assumptions +// { dg-do run { target c++11 } } +// { dg-options "-O2" } + +#include "attr-assume1.C" diff --git a/gcc/testsuite/g++.dg/cpp23/attr-assume6.C b/gcc/testsuite/g++.dg/cpp23/attr-assume6.C new file mode 100644 index 0000000..4a81df1 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp23/attr-assume6.C @@ -0,0 +1,5 @@ +// P1774R8 - Portable assumptions +// { dg-do run { target c++11 } } +// { dg-options "-O2" } + +#include "attr-assume3.C" diff --git a/gcc/testsuite/g++.dg/cpp23/attr-assume7.C b/gcc/testsuite/g++.dg/cpp23/attr-assume7.C new file mode 100644 index 0000000..441242c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp23/attr-assume7.C @@ -0,0 +1,56 @@ +// P1774R8 - Portable assumptions +// { dg-do compile { target c++11 } } +// { dg-options "-O2" } + +int +foo (int x) +{ + [[assume (x == 42)]]; + return x; +} + +int +bar (int x) +{ + [[assume (++x == 43)]]; + return x; +} + +int +baz (int x) +{ + [[assume (({ int z = ++x; static int w; ++w; if (z == 51) return -1; if (z == 53) goto lab1; if (z == 64) throw 1; z == 43; }))]]; +lab1: + return x; +} + +struct S { S (); S (const S &); ~S (); int a, b; int foo (); }; + +int +qux () +{ + S s; + [[assume (s.a == 42 && s.b == 43)]]; + return s.a + s.b; +} + +int +S::foo () +{ + [[assume (a == 42 && b == 43)]]; + return a + b; +} + +int +corge (int x) +{ + [[assume (({ [[assume (x < 42)]]; x > -42; }))]]; + return x < 42; +} + +int +garply (int x) +{ + [[assume (({ [[assume (++x < 43)]]; x > -42; }))]]; + return x < 42; +} diff --git a/gcc/testsuite/g++.dg/modules/cexpr-3_a.C b/gcc/testsuite/g++.dg/modules/cexpr-3_a.C new file mode 100644 index 0000000..be24bb4 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/cexpr-3_a.C @@ -0,0 +1,14 @@ +// PR c++/101449 +// { dg-additional-options -fmodules-ts } +// { dg-module-cmi pr101449 } + +export module pr101449; + +struct X { + bool b = true; + constexpr X() { } + constexpr X(const X&) { } +}; + +export constexpr X f() { return {}; } +export constexpr bool g(X x) { return x.b; } diff --git a/gcc/testsuite/g++.dg/modules/cexpr-3_b.C b/gcc/testsuite/g++.dg/modules/cexpr-3_b.C new file mode 100644 index 0000000..cbf3be4 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/cexpr-3_b.C @@ -0,0 +1,7 @@ +// PR c++/101449 +// { dg-additional-options -fmodules-ts } + +import pr101449; + +static_assert(f().b); +static_assert(g(f())); diff --git a/gcc/testsuite/g++.dg/modules/pr105045_a.C b/gcc/testsuite/g++.dg/modules/pr105045_a.C new file mode 100644 index 0000000..597f929 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr105045_a.C @@ -0,0 +1,7 @@ +// PR c++/105045 +// { dg-additional-options -fmodules-ts } +// { dg-module-cmi pr105045 } + +export module pr105045; + +export template<int T=0, class U> void f(U) { } diff --git a/gcc/testsuite/g++.dg/modules/pr105045_b.C b/gcc/testsuite/g++.dg/modules/pr105045_b.C new file mode 100644 index 0000000..77c94d4 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr105045_b.C @@ -0,0 +1,6 @@ +// PR c++/105045 +// { dg-additional-options -fmodules-ts } + +import pr105045; + +int main() { f(0); } diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr105820.c b/gcc/testsuite/g++.dg/tree-ssa/pr105820.c new file mode 100644 index 0000000..507950f --- /dev/null +++ b/gcc/testsuite/g++.dg/tree-ssa/pr105820.c @@ -0,0 +1,26 @@ +// { dg-do compile } +// { dg-options "-O2 -fstrict-enums --param case-values-threshold=1"} + +typedef int basic_block; + +enum gimple_code {}; + +struct omp_region { + omp_region *outer; + basic_block cont; +}; + +void +oof (void); + +void +build_omp_regions_1 (omp_region *parent, basic_block bb, gimple_code code) +{ + if (code == 2) + parent = parent->outer; + else if (code != 0) + parent->cont = bb; + + if (parent) + oof (); +} diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr107206.C b/gcc/testsuite/g++.dg/tree-ssa/pr107206.C new file mode 100644 index 0000000..34810ad --- /dev/null +++ b/gcc/testsuite/g++.dg/tree-ssa/pr107206.C @@ -0,0 +1,27 @@ +// { dg-do compile } +// { dg-require-effective-target c++17 } +// { dg-options "-O -Wuninitialized" } + +#include <optional> +struct X { + X() = default; + X(X const& r) : i(r.i) {} + int i; +}; +struct Y { + Y() : x() {} + X x; + std::optional<int> o; +}; +struct Z { + Y y; + explicit Z(Y y) : y(y) {} +}; +void f(Y const&); +void test() { + Y const y; + Z z(y); + z.y.o = 1; + auto const w = z; + f(w.y); +} diff --git a/gcc/testsuite/gcc.dg/c11-enum-1.c b/gcc/testsuite/gcc.dg/c11-enum-1.c new file mode 100644 index 0000000..571041d --- /dev/null +++ b/gcc/testsuite/gcc.dg/c11-enum-1.c @@ -0,0 +1,14 @@ +/* Test C2x enumerations with values not representable in int are diagnosed for + C11. */ +/* { dg-do compile } */ +/* { dg-options "-std=c11 -pedantic-errors" } */ + +enum e1 { e1a = -__LONG_LONG_MAX__ - 1 }; /* { dg-error "ISO C restricts enumerator values" } */ + +enum e2 { e2a = __LONG_LONG_MAX__ }; /* { dg-error "ISO C restricts enumerator values" } */ + +enum e3 { e3a = (unsigned int) -1 }; /* { dg-error "ISO C restricts enumerator values" } */ + +enum e4 { e4a = (long long) -__INT_MAX__ - 1, e4b = (unsigned int) __INT_MAX__ }; + +enum e5 { e5a = __INT_MAX__, e5b }; /* { dg-error "ISO C restricts enumerator values" } */ diff --git a/gcc/testsuite/gcc.dg/c11-enum-2.c b/gcc/testsuite/gcc.dg/c11-enum-2.c new file mode 100644 index 0000000..5b07c8d --- /dev/null +++ b/gcc/testsuite/gcc.dg/c11-enum-2.c @@ -0,0 +1,14 @@ +/* Test C2x enumerations with values not representable in int are diagnosed for + C11. */ +/* { dg-do compile } */ +/* { dg-options "-std=c11 -pedantic" } */ + +enum e1 { e1a = -__LONG_LONG_MAX__ - 1 }; /* { dg-warning "ISO C restricts enumerator values" } */ + +enum e2 { e2a = __LONG_LONG_MAX__ }; /* { dg-warning "ISO C restricts enumerator values" } */ + +enum e3 { e3a = (unsigned int) -1 }; /* { dg-warning "ISO C restricts enumerator values" } */ + +enum e4 { e4a = (long long) -__INT_MAX__ - 1, e4b = (unsigned int) __INT_MAX__ }; + +enum e5 { e5a = __INT_MAX__, e5b }; /* { dg-warning "ISO C restricts enumerator values" } */ diff --git a/gcc/testsuite/gcc.dg/c11-enum-3.c b/gcc/testsuite/gcc.dg/c11-enum-3.c new file mode 100644 index 0000000..8266d4e --- /dev/null +++ b/gcc/testsuite/gcc.dg/c11-enum-3.c @@ -0,0 +1,14 @@ +/* Test C2x enumerations with values not representable in int are not diagnosed + for C11 with -pedantic-errors -Wno-c11-c2x-compat. */ +/* { dg-do compile } */ +/* { dg-options "-std=c11 -pedantic-errors -Wno-c11-c2x-compat" } */ + +enum e1 { e1a = -__LONG_LONG_MAX__ - 1 }; + +enum e2 { e2a = __LONG_LONG_MAX__ }; + +enum e3 { e3a = (unsigned int) -1 }; + +enum e4 { e4a = (long long) -__INT_MAX__ - 1, e4b = (unsigned int) __INT_MAX__ }; + +enum e5 { e5a = __INT_MAX__, e5b }; diff --git a/gcc/testsuite/gcc.dg/c2x-enum-1.c b/gcc/testsuite/gcc.dg/c2x-enum-1.c new file mode 100644 index 0000000..c4371fa --- /dev/null +++ b/gcc/testsuite/gcc.dg/c2x-enum-1.c @@ -0,0 +1,104 @@ +/* Test C2x enumerations with values not representable in int. */ +/* { dg-do compile } */ +/* { dg-options "-std=c2x -pedantic-errors" } */ + +/* Check a type while defining an enum (via a diagnostic for incompatible + pointer types if the wrong type was chosen). */ +#define TYPE_CHECK(cst, type) \ + cst ## _type_check = sizeof (1 ? (type *) 0 : (typeof (cst) *) 0) + +/* Test various explicit values not representable in int. */ + +enum e1 { e1a = -__LONG_LONG_MAX__ - 1, TYPE_CHECK (e1a, long long), + e1b = 0, TYPE_CHECK (e1b, int), + e1c = __LONG_LONG_MAX__, TYPE_CHECK (e1c, long long), + e1d = 1, TYPE_CHECK (e1d, int) }; +extern enum e1 e1v; +extern typeof (e1a) e1v; +extern typeof (e1b) e1v; +extern typeof (e1c) e1v; +extern typeof (e1d) e1v; +static_assert (sizeof (enum e1) >= sizeof (long long)); +static_assert (e1a == -__LONG_LONG_MAX__ - 1); +static_assert (e1b == 0); +static_assert (e1c == __LONG_LONG_MAX__); +static_assert (e1d == 1); +static_assert (e1a < 0); +static_assert (e1c > 0); + +/* This is a test where values are representable in int. */ +enum e2 { e2a = (long long) -__INT_MAX__ - 1, TYPE_CHECK (e2a, int), + e2b = (unsigned int) __INT_MAX__, TYPE_CHECK (e2b, int), + e2c = 2, TYPE_CHECK (e2c, int) }; +extern int e2v; +extern typeof (e2a) e2v; +extern typeof (e2b) e2v; +extern typeof (e2c) e2v; +static_assert (e2a == -__INT_MAX__ - 1); +static_assert (e2b == __INT_MAX__); +static_assert (e2c == 2); +static_assert (e2a < 0); +static_assert (e2b > 0); + +enum e3 { e3a = 0, TYPE_CHECK (e3a, int), + e3b = (unsigned int) -1, TYPE_CHECK (e3b, unsigned int) }; +extern enum e3 e3v; +extern typeof (e3a) e3v; +extern typeof (e3b) e3v; +static_assert (e3a == 0u); +static_assert (e3b == (unsigned int) -1); +static_assert (e3b > 0); + +/* Test handling of overflow and wraparound (choosing a wider type). */ +#if __LONG_LONG_MAX__ > __INT_MAX__ +enum e4 { e4a = __INT_MAX__, + e4b, e4c, e4d = ((typeof (e4b)) -1) < 0, + e4e = (unsigned int) -1, + e4f, e4g = ((typeof (e4e)) -1) > 0, + TYPE_CHECK (e4a, int), TYPE_CHECK (e4e, unsigned int) }; +extern enum e4 e4v; +extern typeof (e4a) e4v; +extern typeof (e4b) e4v; +extern typeof (e4c) e4v; +extern typeof (e4d) e4v; +extern typeof (e4e) e4v; +extern typeof (e4f) e4v; +extern typeof (e4g) e4v; +static_assert (e4a == __INT_MAX__); +static_assert (e4b == (long long) __INT_MAX__ + 1); +static_assert (e4c == (long long) __INT_MAX__ + 2); +static_assert (e4f == (unsigned long long) (unsigned int) -1 + 1); +/* Verify the type chosen on overflow of a signed type while parsing was + signed. */ +static_assert (e4d == 1); +/* Verify the type chosen on wraparound of an unsigned type while parsing was + unsigned. */ +static_assert (e4g == 1); +#endif + +/* Likewise, for overflow from long to long long. */ +#if __LONG_LONG_MAX__ > __LONG_MAX__ +enum e5 { e5a = __LONG_MAX__, + e5b, e5c, e5d = ((typeof (e5b)) -1) < 0, + e5e = (unsigned long) -1, + e5f, e5g = ((typeof (e5e)) -1) > 0, + TYPE_CHECK (e5a, long), TYPE_CHECK (e5e, unsigned long) }; +extern enum e5 e5v; +extern typeof (e5a) e5v; +extern typeof (e5b) e5v; +extern typeof (e5c) e5v; +extern typeof (e5d) e5v; +extern typeof (e5e) e5v; +extern typeof (e5f) e5v; +extern typeof (e5g) e5v; +static_assert (e5a == __LONG_MAX__); +static_assert (e5b == (long long) __LONG_MAX__ + 1); +static_assert (e5c == (long long) __LONG_MAX__ + 2); +static_assert (e5f == (unsigned long long) (unsigned long) -1 + 1); +/* Verify the type chosen on overflow of a signed type while parsing was + signed. */ +static_assert (e5d == 1); +/* Verify the type chosen on wraparound of an unsigned type while parsing was + unsigned. */ +static_assert (e5g == 1); +#endif diff --git a/gcc/testsuite/gcc.dg/c2x-enum-2.c b/gcc/testsuite/gcc.dg/c2x-enum-2.c new file mode 100644 index 0000000..15dcf9a --- /dev/null +++ b/gcc/testsuite/gcc.dg/c2x-enum-2.c @@ -0,0 +1,14 @@ +/* Test C2x enumerations with values not representable in int. Test values + outside the range of standard or extended integer types are diagnosed, even + when they can be represented in __int128. */ +/* { dg-do compile { target int128 } } */ +/* { dg-options "-std=c2x -pedantic-errors" } */ + +enum e1 { e1a = __LONG_LONG_MAX__, e1b }; /* { dg-error "enumerator value outside the range" } */ + +enum e2 { e2a = __LONG_LONG_MAX__ * 2ULL + 1ULL, e2b }; /* { dg-error "enumerator value outside the range" } */ + +/* Likewise, when it's the enum as a whole that can't fit in any standard or + extended type, but the individual enumerators fit (some fitting a signed + type and some fitting an unsigned type). */ +enum e3 { e3a = -__LONG_LONG_MAX__ - 1, e3b = __LONG_LONG_MAX__ * 2ULL + 1ULL }; /* { dg-error "enumeration values exceed range of 'intmax_t'" } */ diff --git a/gcc/testsuite/gcc.dg/c2x-enum-3.c b/gcc/testsuite/gcc.dg/c2x-enum-3.c new file mode 100644 index 0000000..532d977 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c2x-enum-3.c @@ -0,0 +1,14 @@ +/* Test C2x enumerations with values not representable in int. Test values + outside the range of standard or extended integer types are diagnosed, + when __int128 is unsupported. */ +/* { dg-do compile { target { ! int128 } } } */ +/* { dg-options "-std=c2x -pedantic-errors" } */ + +enum e1 { e1a = __LONG_LONG_MAX__, e1b }; /* { dg-error "overflow in enumeration values" } */ + +enum e2 { e2a = __LONG_LONG_MAX__ * 2ULL + 1ULL, e2b }; /* { dg-error "overflow in enumeration values" } */ + +/* Likewise, when it's the enum as a whole that can't fit in any standard or + extended type, but the individual enumerators fit (some fitting a signed + type and some fitting an unsigned type). */ +enum e3 { e3a = -__LONG_LONG_MAX__ - 1, e3b = __LONG_LONG_MAX__ * 2ULL + 1ULL }; /* { dg-error "enumeration values exceed range of largest integer" } */ diff --git a/gcc/testsuite/gcc.dg/c2x-enum-4.c b/gcc/testsuite/gcc.dg/c2x-enum-4.c new file mode 100644 index 0000000..c2e58bf --- /dev/null +++ b/gcc/testsuite/gcc.dg/c2x-enum-4.c @@ -0,0 +1,14 @@ +/* Test C2x enumerations with values not representable in int. Test overflow + of __int128 is diagnosed. */ +/* { dg-do compile { target { int128 } } } */ +/* { dg-options "-std=c2x" } */ + +enum e1 { e1a = (__int128) (((unsigned __int128) -1) >> 1), e1b }; /* { dg-error "overflow in enumeration values" } */ + +enum e2 { e2a = (unsigned __int128) -1, e2b }; /* { dg-error "overflow in enumeration values" } */ + +/* Likewise, when it's the enum as a whole that can't fit in __int128 or + unsigned __int128, but the individual enumerators fit (some fitting __int128 + and some fitting unsigned __int128). */ +enum e3 { e3a = -(__int128) (((unsigned __int128) -1) >> 1) - 1, + e3b = (unsigned __int128) -1 }; /* { dg-warning "enumeration values exceed range of largest integer" } */ diff --git a/gcc/testsuite/gcc.dg/c2x-enum-5.c b/gcc/testsuite/gcc.dg/c2x-enum-5.c new file mode 100644 index 0000000..a4290f0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c2x-enum-5.c @@ -0,0 +1,12 @@ +/* Test C2x enumerations with values not representable in int. Test + -Wc11-c2x-compat warnings. */ +/* { dg-do compile } */ +/* { dg-options "-std=c2x -pedantic-errors -Wc11-c2x-compat" } */ + +enum e1 { e1a = -__LONG_LONG_MAX__ - 1 }; /* { dg-warning "ISO C restricts enumerator values" } */ + +enum e2 { e2a = __LONG_LONG_MAX__ }; /* { dg-warning "ISO C restricts enumerator values" } */ + +enum e3 { e3a = (unsigned int) -1 }; /* { dg-warning "ISO C restricts enumerator values" } */ + +enum e4 { e4a = (long long) -__INT_MAX__ - 1, e4b = (unsigned int) __INT_MAX__ }; diff --git a/gcc/testsuite/gcc.dg/c99-tag-4.c b/gcc/testsuite/gcc.dg/c99-tag-4.c new file mode 100644 index 0000000..9ff3ccb --- /dev/null +++ b/gcc/testsuite/gcc.dg/c99-tag-4.c @@ -0,0 +1,8 @@ +/* Test for handling of tags. "enum foo;" is invalid after an existing + declaration (does not redeclare the tag) as well as before: bug 107164. */ +/* { dg-do compile } */ +/* { dg-options "-std=c99 -pedantic-errors" } */ + +enum e1; /* { dg-error "ISO C forbids forward references to 'enum' types" } */ +enum e2 { E }; +enum e2; /* { dg-error "empty declaration of 'enum' type does not redeclare tag" } */ diff --git a/gcc/testsuite/gcc.dg/c99-tag-5.c b/gcc/testsuite/gcc.dg/c99-tag-5.c new file mode 100644 index 0000000..97fcc75 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c99-tag-5.c @@ -0,0 +1,8 @@ +/* Test for handling of tags. "enum foo;" is invalid after an existing + declaration (does not redeclare the tag) as well as before: bug 107164. */ +/* { dg-do compile } */ +/* { dg-options "-std=c99 -pedantic" } */ + +enum e1; /* { dg-warning "ISO C forbids forward references to 'enum' types" } */ +enum e2 { E }; +enum e2; /* { dg-warning "empty declaration of 'enum' type does not redeclare tag" } */ diff --git a/gcc/testsuite/gcc.dg/c99-tag-6.c b/gcc/testsuite/gcc.dg/c99-tag-6.c new file mode 100644 index 0000000..8307217 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c99-tag-6.c @@ -0,0 +1,9 @@ +/* Test for handling of tags. "enum foo;" is invalid after an existing + declaration (does not redeclare the tag) as well as before: bug 107164. + Test this is not diagnosed without -pedantic. */ +/* { dg-do compile } */ +/* { dg-options "-std=c99" } */ + +enum e1; +enum e2 { E }; +enum e2; diff --git a/gcc/testsuite/gcc.dg/ipa/ipcp-agg-11.c b/gcc/testsuite/gcc.dg/ipa/ipcp-agg-11.c index 3c496ee..48bf772 100644 --- a/gcc/testsuite/gcc.dg/ipa/ipcp-agg-11.c +++ b/gcc/testsuite/gcc.dg/ipa/ipcp-agg-11.c @@ -73,5 +73,5 @@ entry () /* { dg-final { scan-ipa-dump "offset: 0, type: int, CONST: 101" "cp" } } */ /* { dg-final { scan-ipa-dump "offset: 32, type: int, PASS THROUGH: 0, op trunc_mod_expr 7" "cp" } } */ /* { dg-final { scan-ipa-dump "offset: 64, type: int, LOAD AGG: 1 \\\[offset: 0, by reference], op plus_expr 6" "cp" } } */ -/* { dg-final { scan-ipa-dump "Aggregate replacements: 0\\\[0]=1, 0\\\[32]=105, 0\\\[64]=-18" "cp" } } */ -/* { dg-final { scan-ipa-dump "Aggregate replacements: 0\\\[0]=101, 0\\\[32]=2, 0\\\[64]=9" "cp" } } */ +/* { dg-final { scan-ipa-dump "Aggregate replacements: 0\\\[0]=1\\(by_ref\\), 0\\\[4]=105\\(by_ref\\), 0\\\[8]=-18\\(by_ref\\)" "cp" } } */ +/* { dg-final { scan-ipa-dump "Aggregate replacements: 0\\\[0]=101, 0\\\[4]=2, 0\\\[8]=9" "cp" } } */ diff --git a/gcc/testsuite/gcc.dg/ipa/ipcp-agg-8.c b/gcc/testsuite/gcc.dg/ipa/ipcp-agg-8.c index 2d9c82f..8234702 100644 --- a/gcc/testsuite/gcc.dg/ipa/ipcp-agg-8.c +++ b/gcc/testsuite/gcc.dg/ipa/ipcp-agg-8.c @@ -48,5 +48,5 @@ entry (int c) foo (4, i, &s); } } -/* { dg-final { scan-ipa-dump "Aggregate replacements: 1\\\[32]=64, 1\\\[64]=32" "cp" } } */ -/* { dg-final { scan-ipa-dump "Aggregate replacements: 1\\\[32]=0" "cp" } } */ +/* { dg-final { scan-ipa-dump "Aggregate replacements: 1\\\[4]=64\\(by_ref\\), 1\\\[8]=32\\(by_ref\\)" "cp" } } */ +/* { dg-final { scan-ipa-dump "Aggregate replacements: 1\\\[4]=0\\(by_ref\\)" "cp" } } */ diff --git a/gcc/testsuite/gcc.dg/pr106781.c b/gcc/testsuite/gcc.dg/pr106781.c new file mode 100644 index 0000000..339c28c --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr106781.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -Wno-div-by-zero" } */ + +int n; + +__attribute__ ((noinline, returns_twice)) static int +bar (int) +{ + n /= 0; + + return n; +} + +int +foo (int x) +{ + return bar (x); +} diff --git a/gcc/testsuite/gcc.dg/pr107262.c b/gcc/testsuite/gcc.dg/pr107262.c new file mode 100644 index 0000000..2ced047 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr107262.c @@ -0,0 +1,13 @@ +/* PR middle-end/107262 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -ffast-math" } */ +/* { dg-add-options bfloat16 } */ +/* { dg-require-effective-target bfloat16_runtime } */ + +__bf16 +foo (__bf16 a) +{ + __bf16 b = 0; + b /= a; + return b; +} diff --git a/gcc/testsuite/gcc.dg/pr30260.c b/gcc/testsuite/gcc.dg/pr30260.c index e04a8be..3fac38e 100644 --- a/gcc/testsuite/gcc.dg/pr30260.c +++ b/gcc/testsuite/gcc.dg/pr30260.c @@ -1,6 +1,6 @@ /* PR 30260 */ /* { dg-do link } */ -/* { dg-options "-pedantic -O" } */ +/* { dg-options "-std=gnu11 -pedantic -O" } */ #include <limits.h> void link_error (void); @@ -30,5 +30,5 @@ int main(void) return 0; } -enum E1 { e10 = INT_MAX, e11 }; /* { dg-error "overflow in enumeration values" } */ -enum E2 { e20 = (unsigned) INT_MAX, e21 }; /* { dg-error "overflow in enumeration values" } */ +enum E1 { e10 = INT_MAX, e11 }; /* { dg-warning "ISO C restricts enumerator values to range of 'int' before C2X" } */ +enum E2 { e20 = (unsigned) INT_MAX, e21 }; /* { dg-warning "ISO C restricts enumerator values to range of 'int' before C2X" } */ diff --git a/gcc/testsuite/gcc.dg/torture/pr107301.c b/gcc/testsuite/gcc.dg/torture/pr107301.c new file mode 100644 index 0000000..5f0afcc --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr107301.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ + +__attribute__ ((pure, returns_twice)) int +foo (int x) +{ + int a; + + a = x ? 3 : 0; + x /= a; + a = foo (x); + if (x == a) + __builtin_unreachable (); + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr25183.c b/gcc/testsuite/gcc.dg/torture/pr25183.c index 0157b80..84b4c8f 100644 --- a/gcc/testsuite/gcc.dg/torture/pr25183.c +++ b/gcc/testsuite/gcc.dg/torture/pr25183.c @@ -3,10 +3,10 @@ enum err { err_IO = 0x8a450000, /* { dg-warning "int" } */ - err_NM, - err_EOF, - err_SE, - err_PT + err_NM, /* { dg-warning "int" } */ + err_EOF, /* { dg-warning "int" } */ + err_SE, /* { dg-warning "int" } */ + err_PT /* { dg-warning "int" } */ }; static enum err E_; int error() diff --git a/gcc/testsuite/gcc.dg/tree-ssa/forwprop-19.c b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-19.c index 4d77138..6ca81cb 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/forwprop-19.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-19.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O -fdump-tree-forwprop1" } */ +/* { dg-options "-O -fdump-tree-dse1" } */ typedef int vec __attribute__((vector_size (4 * sizeof (int)))); void f (vec *x1, vec *x2) @@ -11,4 +11,4 @@ void f (vec *x1, vec *x2) *x1 = z; } -/* { dg-final { scan-tree-dump-not "VEC_PERM_EXPR" "forwprop1" } } */ +/* { dg-final { scan-tree-dump-not "VEC_PERM_EXPR" "dse1" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr107273-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr107273-1.c new file mode 100644 index 0000000..db2e2c0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr107273-1.c @@ -0,0 +1,31 @@ +/* { dg-do run } */ +/* { dg-options "-O3" } */ + +int printf(const char *, ...); +int a[1] = {1}; +short b, c = 5500; +int d; +long e; +char f = 1; +int main() { + while (1) { + long g = b < 1; + e = g; + break; + } + for (; f; f--) { + if (e) { + d = -(6L | -(c & 1000)); + } + char h = d; + if (b) + b = 0; + if (d < 200) + while (1) + printf("%d", a[c]); + short i = h * 210; + c = i; + } + return 0; +} + diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr107273-2.c b/gcc/testsuite/gcc.dg/tree-ssa/pr107273-2.c new file mode 100644 index 0000000..3374507 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr107273-2.c @@ -0,0 +1,27 @@ +/* { dg-do run } */ +/* { dg-options "-Os" } */ + +int a, d, f; +char b, g; +unsigned i; +int main() { + int c = 300, h = 40; + char e = 1; + for (; a < 1; a++) { + c = ~((i - ~c) | e); + L1: + e = f = c; + if (c) + if (c > -200) + e = g % (1 << h); + char k = 0; + L2:; + } + if (b) { + if (d) + goto L2; + if (!b) + goto L1; + } + return 0; +} diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr107293.c b/gcc/testsuite/gcc.dg/tree-ssa/pr107293.c new file mode 100644 index 0000000..724c31a --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr107293.c @@ -0,0 +1,32 @@ +// { dg-do run } +// { dg-options "-w -Os" } + +short a; +int b[1]; + +int c(int p) { + return (p < 0) ? 0 : 10 + ((p / 100 - 16) / 4); +} + +void f(int n) { + while (1) { + int m = n; + while ((m ) ) + m /= 2; + break; + } +} + +void g() { + int h = a = 0; + for (; h + a <= 0; a++) { + if (b[c(a - 6)]) + break; + f(a); + } +} +int main() { + g(); + if (a != 1) + __builtin_abort (); +} diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-3a.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-3a.c new file mode 100644 index 0000000..5aadaa7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-3a.c @@ -0,0 +1,19 @@ +// { dg-do compile } +// { dg-options "-O2 -fno-thread-jumps -fdisable-tree-fre1 -fdump-tree-evrp" } + +void link_error (); +void bar (); + +float +foo (float x) +{ + if (x != x) + { + // The true side of x != x implies NAN, so we should be able to + // fold this. + if (!__builtin_isnan (x)) + link_error (); + } +} + +// { dg-final { scan-tree-dump-not "link_error" "evrp" } } diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-4a.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-4a.c new file mode 100644 index 0000000..7d3187b --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-4a.c @@ -0,0 +1,23 @@ +// { dg-do compile } +// { dg-options "-O2 -fno-thread-jumps -fdisable-tree-fre1 -fdump-tree-evrp" } + +void link_error (); +void bar (); + +float +foo (float x) +{ + if (x == x) + { + bar (); + } + else + { + // The false side of x == x implies NAN, so we should be able to + // fold this. + if (!__builtin_isnan (x)) + link_error (); + } +} + +// { dg-final { scan-tree-dump-not "link_error" "evrp" } } diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-5a.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-5a.c new file mode 100644 index 0000000..0833230 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp-float-5a.c @@ -0,0 +1,16 @@ +// { dg-do compile } +// { dg-options "-O2 -fno-thread-jumps -fdisable-tree-fre1 -fdump-tree-evrp" } + +void link_error (); + +float +foo (float x) +{ + if (__builtin_isnan (x)) + { + if (!__builtin_isnan (x)) + link_error (); + } +} + +// { dg-final { scan-tree-dump-not "link_error" "evrp" } } diff --git a/gcc/testsuite/gcc.dg/vect/pr107275.c b/gcc/testsuite/gcc.dg/vect/pr107275.c new file mode 100644 index 0000000..16327c4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr107275.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +struct st +{ + int a : 1; +}; + +void +foo (struct st *s, int n) +{ + for (int i = 0; i < n; ++i) + { + s[i].a = i; + __asm__ __volatile__ ("":::"memory"); + } +} diff --git a/gcc/testsuite/gcc.dg/vect/pr107302.c b/gcc/testsuite/gcc.dg/vect/pr107302.c new file mode 100644 index 0000000..293f7e4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr107302.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-fno-tree-pre" } */ + +int a[2000]; +int s292_im1; + +void +s292() { + for (int i = 0; i < 2000; i++) { + a[i] = s292_im1; + s292_im1 = i; + } +} diff --git a/gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s252.c b/gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s252.c index f1302b6..83eaa7a 100644 --- a/gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s252.c +++ b/gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s252.c @@ -40,4 +40,4 @@ int main (int argc, char **argv) return 0; } -/* { dg-final { scan-tree-dump "vectorized 1 loops" "vect" { xfail *-*-* } } } */ +/* { dg-final { scan-tree-dump "vectorized 1 loops" "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s254.c b/gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s254.c index bdc8a01..06e9b0a 100644 --- a/gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s254.c +++ b/gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s254.c @@ -39,4 +39,4 @@ int main (int argc, char **argv) return 0; } -/* { dg-final { scan-tree-dump "vectorized 1 loops" "vect" { xfail *-*-* } } } */ +/* { dg-final { scan-tree-dump "vectorized 1 loops" "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s291.c b/gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s291.c index 0b474c2..91cdc12 100644 --- a/gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s291.c +++ b/gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s291.c @@ -39,4 +39,4 @@ int main (int argc, char **argv) return 0; } -/* { dg-final { scan-tree-dump "vectorized 1 loops" "vect" { xfail *-*-* } } } */ +/* { dg-final { scan-tree-dump "vectorized 1 loops" "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-recurr-1.c b/gcc/testsuite/gcc.dg/vect/vect-recurr-1.c new file mode 100644 index 0000000..6eb59fd --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-recurr-1.c @@ -0,0 +1,38 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vect_int } */ + +#include "tree-vect.h" + +void __attribute__((noipa)) +foo (int * __restrict__ a, int * __restrict__ b, int * __restrict__ c) +{ + int t = *c; + for (int i = 0; i < 64; ++i) + { + b[i] = a[i] - t; + t = a[i]; + } +} + +int a[64], b[64]; + +int +main () +{ + check_vect (); + for (int i = 0; i < 64; ++i) + { + a[i] = i; + __asm__ volatile ("" ::: "memory"); + } + int c = 7; + foo (a, b, &c); + for (int i = 1; i < 64; ++i) + if (b[i] != a[i] - a[i-1]) + abort (); + if (b[0] != -7) + abort (); + return 0; +} + +/* { dg-final { scan-tree-dump "vectorized 1 loops in function" "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-recurr-2.c b/gcc/testsuite/gcc.dg/vect/vect-recurr-2.c new file mode 100644 index 0000000..97efaaa --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-recurr-2.c @@ -0,0 +1,39 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vect_int } */ + +#include "tree-vect.h" + +void __attribute__((noipa)) +foo (int * __restrict__ a, short * __restrict__ b, int * __restrict__ c) +{ + int t = *c; + for (int i = 0; i < 64; ++i) + { + b[i] = a[i] - t; + t = a[i]; + } +} + +int a[64]; +short b[64]; + +int +main () +{ + check_vect (); + for (int i = 0; i < 64; ++i) + { + a[i] = i; + __asm__ volatile ("" ::: "memory"); + } + int c = 7; + foo (a, b, &c); + for (int i = 1; i < 64; ++i) + if (b[i] != a[i] - a[i-1]) + abort (); + if (b[0] != -7) + abort (); + return 0; +} + +/* { dg-final { scan-tree-dump "vectorized 1 loops in function" "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-recurr-3.c b/gcc/testsuite/gcc.dg/vect/vect-recurr-3.c new file mode 100644 index 0000000..621a5d8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-recurr-3.c @@ -0,0 +1,39 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vect_int } */ + +#include "tree-vect.h" + +void __attribute__((noipa)) +foo (int * __restrict__ a, signed char * __restrict__ b, int * __restrict__ c) +{ + int t = *c; + for (int i = 0; i < 64; ++i) + { + b[i] = a[i] - t; + t = a[i]; + } +} + +int a[64]; +signed char b[64]; + +int +main () +{ + check_vect (); + for (int i = 0; i < 64; ++i) + { + a[i] = i; + __asm__ volatile ("" ::: "memory"); + } + int c = 7; + foo (a, b, &c); + for (int i = 1; i < 64; ++i) + if (b[i] != a[i] - a[i-1]) + abort (); + if (b[0] != -7) + abort (); + return 0; +} + +/* { dg-final { scan-tree-dump "vectorized 1 loops in function" "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-recurr-4.c b/gcc/testsuite/gcc.dg/vect/vect-recurr-4.c new file mode 100644 index 0000000..f6dbc49 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-recurr-4.c @@ -0,0 +1,42 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vect_int } */ + +#include "tree-vect.h" + +void __attribute__((noipa)) +foo (int * __restrict__ a, int * __restrict__ b, int * __restrict__ c) +{ + int t1 = *c; + int t2 = *c; + for (int i = 0; i < 64; i+=2) + { + b[i] = a[i] - t1; + t1 = a[i]; + b[i+1] = a[i+1] - t2; + t2 = a[i+1]; + } +} + +int a[64], b[64]; + +int +main () +{ + check_vect (); + for (int i = 0; i < 64; ++i) + { + a[i] = i; + __asm__ volatile ("" ::: "memory"); + } + int c = 7; + foo (a, b, &c); + for (int i = 2; i < 64; i+=2) + if (b[i] != a[i] - a[i-2] + || b[i+1] != a[i+1] - a[i-1]) + abort (); + if (b[0] != -7 || b[1] != -6) + abort (); + return 0; +} + +/* { dg-final { scan-tree-dump "vectorized 1 loops in function" "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-recurr-5.c b/gcc/testsuite/gcc.dg/vect/vect-recurr-5.c new file mode 100644 index 0000000..19c56df --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-recurr-5.c @@ -0,0 +1,43 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vect_int } */ + +#include "tree-vect.h" + +void __attribute__((noipa)) +foo (int * __restrict__ a, short * __restrict__ b, int * __restrict__ c) +{ + int t1 = *c; + int t2 = *c; + for (int i = 0; i < 64; i+=2) + { + b[i] = a[i] - t1; + t1 = a[i]; + b[i+1] = a[i+1] - t2; + t2 = a[i+1]; + } +} + +int a[64]; +short b[64]; + +int +main () +{ + check_vect (); + for (int i = 0; i < 64; ++i) + { + a[i] = i; + __asm__ volatile ("" ::: "memory"); + } + int c = 7; + foo (a, b, &c); + for (int i = 2; i < 64; i+=2) + if (b[i] != a[i] - a[i-2] + || b[i+1] != a[i+1] - a[i-1]) + abort (); + if (b[0] != -7 || b[1] != -6) + abort (); + return 0; +} + +/* { dg-final { scan-tree-dump "vectorized 1 loops in function" "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-recurr-6.c b/gcc/testsuite/gcc.dg/vect/vect-recurr-6.c new file mode 100644 index 0000000..e771268 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-recurr-6.c @@ -0,0 +1,39 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vect_int } */ + +#include "tree-vect.h" + +void __attribute__((noipa)) +foo (int * __restrict__ a, int * __restrict__ b, int * __restrict__ c, int n) +{ + int t = *c; + for (int i = 0; i < n; ++i) + { + b[i] = a[i] - t; + t = a[i]; + } +} + +int a[64], b[64]; + +int +main () +{ + check_vect (); + for (int i = 0; i < 64; ++i) + { + a[i] = i; + __asm__ volatile ("" ::: "memory"); + } + int c = 7; + foo (a, b, &c, 63); + for (int i = 1; i < 63; ++i) + if (b[i] != a[i] - a[i-1]) + abort (); + if (b[0] != -7) + abort (); + return 0; +} + +/* ??? We miss epilogue handling for first order recurrences. */ +/* { dg-final { scan-tree-dump "vectorized 1 loops in function" "vect" { target vect_fully_masked } } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr107271.c b/gcc/testsuite/gcc.target/i386/pr107271.c new file mode 100644 index 0000000..fe89c9a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr107271.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +typedef int __attribute__((__vector_size__ (16))) V; + +static inline __attribute__((__always_inline__)) V +bar (V v128u32_0) +{ + return __builtin_shuffle ((V){}, v128u32_0, v128u32_0); +} + +V +foo (void) +{ + return bar ((V){7, 4, 4}); +} diff --git a/gcc/testsuite/gcc.target/s390/pr106355-1.c b/gcc/testsuite/gcc.target/s390/pr106355-1.c new file mode 100644 index 0000000..1ec0f6b --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/pr106355-1.c @@ -0,0 +1,42 @@ +/* { dg-do compile } */ +/* { dg-options "-foptimize-sibling-calls" } */ +/* { dg-final { scan-assembler {brasl\t%r\d+,bar4} } } */ +/* { dg-final { scan-assembler {brasl\t%r\d+,bar8} } } */ + +/* Parameter E is passed in GPR 6 which is call-saved which prohibits + sibling call optimization. This must hold true also if the mode of the + parameter is BLKmode. */ + +/* 4 byte */ + +typedef struct +{ + char x; + char y[3]; +} t4; + +extern t4 e4; + +extern void bar4 (int a, int b, int c, int d, t4 e4); + +void foo4 (int a, int b, int c, int d) +{ + bar4 (a, b, c, d, e4); +} + +/* 8 byte */ + +typedef struct +{ + short x; + char y[6]; +} t8; + +extern t8 e8; + +extern void bar8 (int a, int b, int c, int d, t8 e8); + +void foo8 (int a, int b, int c, int d) +{ + bar8 (a, b, c, d, e8); +} diff --git a/gcc/testsuite/gcc.target/s390/pr106355-2.c b/gcc/testsuite/gcc.target/s390/pr106355-2.c new file mode 100644 index 0000000..ddbdba5 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/pr106355-2.c @@ -0,0 +1,8 @@ +/* { dg-do compile { target { s390-*-* } } } */ +/* { dg-options "-foptimize-sibling-calls -mzarch" } */ +/* { dg-final { scan-assembler {brasl\t%r\d+,bar} } } */ + +/* This tests function s390_call_saved_register_used where + GET_CODE (parm_rtx) == PARALLEL holds. */ + +#include "pr106355.h" diff --git a/gcc/testsuite/gcc.target/s390/pr106355-3.c b/gcc/testsuite/gcc.target/s390/pr106355-3.c new file mode 100644 index 0000000..39daea4 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/pr106355-3.c @@ -0,0 +1,8 @@ +/* { dg-do compile { target { s390-*-* } } } */ +/* { dg-options "-foptimize-sibling-calls -mesa" } */ +/* { dg-final { scan-assembler {brasl\t%r\d+,bar} } } */ + +/* This tests function s390_call_saved_register_used where + REG_P (parm_rtx) and nregs == 2 holds. */ + +#include "pr106355.h" diff --git a/gcc/testsuite/gcc.target/s390/pr106355.h b/gcc/testsuite/gcc.target/s390/pr106355.h new file mode 100644 index 0000000..362908e --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/pr106355.h @@ -0,0 +1,18 @@ +/* For the S/390 ABI parameter D is passed in GPR 5 and 6 and the latter is + call-saved which prohibits sibling call optimization. This must hold true + also if the mode of the parameter is BLKmode. */ + +typedef struct +{ + short x; + char y[6]; +} t; + +extern t d; + +extern void bar (int a, int b, int c, t d); + +void foo (int a, int b, int c) +{ + bar (a, b, c, d); +} diff --git a/gcc/testsuite/gfortran.dg/array_constructor_56.f90 b/gcc/testsuite/gfortran.dg/array_constructor_56.f90 new file mode 100644 index 0000000..4701fb3 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/array_constructor_56.f90 @@ -0,0 +1,22 @@ +! { dg-do compile } +! +! Test the fix for the following: +! PR fortran/93483 +! PR fortran/107216 +! PR fortran/107219 +! +! Contributed by G.Steinmetz + +program p + real, parameter :: r0(*) = +[real :: +(1) ] + real, parameter :: r1(*) = +[real :: +[1] ] + real, parameter :: r2(*) = -[real :: [(1)]] + real, parameter :: r3(*) = +[real :: [-(1)]] + real, parameter :: r4(*) = -[real :: [[(1)]]] + real, parameter :: r5(*) = -[real :: -[1, 2]] + real, parameter :: r6(*) = +[real :: +[1, 2]] + real, parameter :: r7(*) = [real :: 1, 2] * [real :: 1, (2)] + real, parameter :: r8(*) = [real :: 1, (2)] * [real :: 1, 2] + real, parameter :: r9(*) = +[real :: 1, 2] * [real :: 1, (2)] + real, parameter :: rr(*) = -[real :: 1, (2)] * [real :: 1, 2] +end diff --git a/gcc/testsuite/gfortran.dg/array_constructor_57.f90 b/gcc/testsuite/gfortran.dg/array_constructor_57.f90 new file mode 100644 index 0000000..1298c09 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/array_constructor_57.f90 @@ -0,0 +1,30 @@ +! { dg-do run } +! PR fortran/93483 +! +! Verify that resolution (host associated parameter vs. contained function) works. +! +! Contributed by Mikael Morin + +module m + implicit none + integer, parameter :: a(*) = [ 7, 11 ] +contains + subroutine bug + real :: b(1), c(1) + b = [ real :: (a(1)) ] + c = [ real :: a(1) ] + print *, b, c + if (any (b /= [ 14. ])) stop 1 + if (any (c /= [ 14. ])) stop 2 + contains + function a(c) + integer :: a, c + a = c + 13 + end function a + end subroutine bug +end module m + +program p + use m + call bug +end program p diff --git a/gcc/testsuite/gfortran.dg/char4_decl-2.f90 b/gcc/testsuite/gfortran.dg/char4_decl-2.f90 new file mode 100644 index 0000000..d646161 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/char4_decl-2.f90 @@ -0,0 +1,63 @@ +! { dg-do run } +! { dg-additional-options "-fdump-tree-original" } + +! In this program shall be no kind=1, +! except for the 'argv' of the 'main' program. + +! PR fortran/107266 + +! { dg-final { scan-tree-dump-times "kind=1" 1 "original" } } +! { dg-final { scan-tree-dump-times "character\\(kind=1\\) \\* \\* argv\\)" 1 "original" } } + + +! { dg-final { scan-tree-dump-times "character\\(kind=4\\) f \\(character\\(kind=4\\) x\\)" 1 "original" } } + +character(kind=4) function f(x) bind(C) + character(kind=4), value :: x +end + +program testit + implicit none (type, external) + character (kind=4, len=:), allocatable :: aa + character (kind=4, len=:), pointer :: pp + + pp => NULL () + + call frobf (aa, pp) + if (.not. allocated (aa)) stop 101 + if (storage_size(aa) /= storage_size(4_'foo')) stop 1 + if (aa .ne. 4_'foo') stop 102 + if (.not. associated (pp)) stop 103 + if (storage_size(pp) /= storage_size(4_'bar')) stop 2 + if (pp .ne. 4_'bar') stop 104 + + pp => NULL () + + call frobc (aa, pp) + if (.not. allocated (aa)) stop 105 + if (storage_size(aa) /= storage_size(4_'frog')) stop 3 + if (aa .ne. 4_'frog') stop 106 + if (.not. associated (pp)) stop 107 + if (storage_size(pp) /= storage_size(4_'toad')) stop 4 + if (pp .ne. 4_'toad') stop 108 + + + contains + + subroutine frobf (a, p) Bind(C) + character (kind=4, len=:), allocatable :: a + character (kind=4, len=:), pointer :: p + allocate (character(kind=4, len=3) :: p) + a = 4_'foo' + p = 4_'bar' + end subroutine + + subroutine frobc (a, p) Bind(C) + character (kind=4, len=:), allocatable :: a + character (kind=4, len=:), pointer :: p + allocate (character(kind=4, len=4) :: p) + a = 4_'frog' + p = 4_'toad' + end subroutine + +end program diff --git a/gcc/testsuite/gfortran.dg/char4_decl.f90 b/gcc/testsuite/gfortran.dg/char4_decl.f90 new file mode 100644 index 0000000..bb6b6a8 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/char4_decl.f90 @@ -0,0 +1,56 @@ +! { dg-do run } +! { dg-additional-options "-fdump-tree-original" } + +! In this program shall be no kind=1, +! except for the 'argv' of the 'main' program. + +! Related PR fortran/107266 + +! { dg-final { scan-tree-dump-times "kind=1" 1 "original" } } +! { dg-final { scan-tree-dump-times "character\\(kind=1\\) \\* \\* argv\\)" 1 "original" } } + +program testit + implicit none (type, external) + character (kind=4, len=:), allocatable :: aa + character (kind=4, len=:), pointer :: pp + + pp => NULL () + + call frobf (aa, pp) + if (.not. allocated (aa)) stop 101 + if (storage_size(aa) /= storage_size(4_'foo')) stop 1 + if (aa .ne. 4_'foo') stop 102 + if (.not. associated (pp)) stop 103 + if (storage_size(pp) /= storage_size(4_'bar')) stop 2 + if (pp .ne. 4_'bar') stop 104 + + pp => NULL () + + call frobc (aa, pp) + if (.not. allocated (aa)) stop 105 + if (storage_size(aa) /= storage_size(4_'frog')) stop 3 + if (aa .ne. 4_'frog') stop 106 + if (.not. associated (pp)) stop 107 + if (storage_size(pp) /= storage_size(4_'toad')) stop 4 + if (pp .ne. 4_'toad') stop 108 + + + contains + + subroutine frobf (a, p) + character (kind=4, len=:), allocatable :: a + character (kind=4, len=:), pointer :: p + allocate (character(kind=4, len=3) :: p) + a = 4_'foo' + p = 4_'bar' + end subroutine + + subroutine frobc (a, p) + character (kind=4, len=:), allocatable :: a + character (kind=4, len=:), pointer :: p + allocate (character(kind=4, len=4) :: p) + a = 4_'frog' + p = 4_'toad' + end subroutine + +end program diff --git a/gcc/testsuite/gfortran.dg/pr104330.f90 b/gcc/testsuite/gfortran.dg/pr104330.f90 new file mode 100644 index 0000000..9ff48e2 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr104330.f90 @@ -0,0 +1,20 @@ +! { dg-do compile } +! { dg-options "-fcoarray=lib" } +! +! PR fortran/104330 - ICE in gfc_simplify_image_index +! Contributed by G.Steinmetz + +program p + implicit none + type t + end type t + class(*), allocatable :: x[:] + class(t), allocatable :: y[:] + type(t), allocatable :: z[:] + allocate (real :: x[*]) + print *, image_index(x, [1]) + allocate (t :: y[*]) + print *, image_index(y, [1]) + allocate (t :: z[*]) + print *, image_index(z, [1]) +end diff --git a/gcc/testsuite/gfortran.dg/pr107272.f90 b/gcc/testsuite/gfortran.dg/pr107272.f90 new file mode 100644 index 0000000..4b5c6a0 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr107272.f90 @@ -0,0 +1,21 @@ +! { dg-do compile } +! PR fortran/107272 - followup of PR/107217 for non-numeric types + +program p + print *, 2 <= [real :: (['1'])] ! { dg-error "Cannot convert" } + print *, 2 < [real :: (['1'])] ! { dg-error "Cannot convert" } + print *, 2 == [real :: (['1'])] ! { dg-error "Cannot convert" } + print *, 2 /= [real :: (['1'])] ! { dg-error "Cannot convert" } + print *, 2 >= [real :: (['1'])] ! { dg-error "Cannot convert" } + print *, 2 > [real :: (['1'])] ! { dg-error "Cannot convert" } + print *, [real :: (['1'])] >= 2 ! { dg-error "Cannot convert" } + print *, [real :: (['1'])] > 2 ! { dg-error "Cannot convert" } + print *, [real :: (['1'])] == 2 ! { dg-error "Cannot convert" } + print *, [real :: (['1'])] /= 2 ! { dg-error "Cannot convert" } + print *, [real :: (['1'])] <= 2 ! { dg-error "Cannot convert" } + print *, [real :: (['1'])] < 2 ! { dg-error "Cannot convert" } + print *, [logical :: (['1'])] .and. .true. ! { dg-error "Cannot convert" } + print *, [logical :: (['1'])] .or. .true. ! { dg-error "Cannot convert" } + print *, [logical :: (['1'])] .eqv. .true. ! { dg-error "Cannot convert" } + print *, [logical :: (['1'])] .neqv. .true. ! { dg-error "Cannot convert" } +end |