diff options
author | Edward Smith-Rowland <3dw4rd@verizon.net> | 2016-03-01 03:45:21 +0000 |
---|---|---|
committer | Edward Smith-Rowland <3dw4rd@verizon.net> | 2016-03-01 03:45:21 +0000 |
commit | 5a7001adec5f69d43a2e841a80cef6d810b58d2d (patch) | |
tree | 2d98873d48f01b32358a9133eb43aabdd880d778 /gcc/testsuite | |
parent | 57ad99eba091ed72352561ab9c2a07a5034c17a5 (diff) |
Merged r233676 through r233838 to the branch
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/tr29124@233839 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite')
64 files changed, 1570 insertions, 121 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7db6b61f86a..38c73816368 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,217 @@ +2016-03-01 Patrick Palka <ppalka@gcc.gnu.org> + + PR c++/69961 + * g++.dg/template/pr69961a.C: New test. + * g++.dg/template/pr69961b.C: New test. + +2016-02-29 David Malcolm <dmalcolm@redhat.com> + + PR preprocessor/69985 + * gcc.dg/cpp/pr69985.c: New test case. + +2016-02-29 Jeff Law <law@redhat.com> + + PR tree-optimization/70005 + * gcc.c-torture/execute/pr70005.c New test. + + PR tree-optimization/69999 + * gcc.c-torture/compile/pr69999.c: New test. + +2016-02-29 Yuri Rumyantsev <ysrumyan@gmail.com> + + PR tree-optimization/69652 + * gcc.dg/torture/pr69652.c: Delete test. + * gcc.dg/vect/pr69652.c: New test. + +2016-02-19 Richard Biener <rguenther@suse.de> + + PR tree-optimization/69980 + * gfortran.dg/vect/pr69980.f90: New testcase. + +2016-02-29 Eric Botcazou <ebotcazou@adacore.com> + + * gcc.target/sparc/20160229-1.c: New test. + +2016-02-29 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/stack_usage3.adb: New test. + * gnat.dg/stack_usage3_pkg.ads: New helper. + +2016-02-29 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/renaming8.adb: New test. + * gnat.dg/renaming8_pkg1.ads: New helper. + * gnat.dg/renaming8_pkg2.ad[sb]: Likewise. + * gnat.dg/renaming8_pkg3.ad[sb]: Likewise. + +2016-02-29 Richard Biener <rguenther@suse.de> + + PR tree-optimization/69720 + * gcc.dg/vect/vect-outer-pr69720.c: New testcase. + +2016-02-28 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR fortran/68147 + PR fortran/47674 + * gfortran.dg/realloc_on_assign_26.f90: New test case. + +2016-02-28 Harald Anlauf <anlauf@gmx.de> + Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR fortran/56007 + * gfortran.dg/coarray_8.f90: Adjust error message. + * gfortran.dg/pr56007.f90: New test. + * gfortran.dg/pr56007.f: New test. + +2016-02-28 H.J. Lu <hongjiu.lu@intel.com> + + PR tree-optimization/69989 + * gcc.dg/torture/pr69989.c: New test. + +2016-02-28 Eric Botcazou <ebotcazou@adacore.com> + + * gcc.target/i386/stack-realign-win.c: New test. + +2016-02-28 Harald Anlauf <anlauf@gmx.de> + + PR fortran/60126 + * gfortran.dg/pr60126.f90: New test. + +2016-02-27 Jeff Law <law@redhat.com> + + Revert + 2016-02-26 Richard Biener <rguenther@suse.de> + Jeff Law <law@redhat.com> + + PR tree-optimization/69740 + * gcc.c-torture/compile/pr69740-1.c: New test. + * gcc.c-torture/compile/pr69740-2.c: New test. + +2016-02-27 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR fortran/69910 + * gfortran.dg/newunit_4.f90: New test. + +2016-02-27 Jakub Jelinek <jakub@redhat.com> + + PR target/69613 + PR rtl-optimization/69886 + * gcc.dg/torture/pr69886.c: Add -w -Wno-psabi to dg-options. + * gcc.dg/torture/pr69613.c: Likewise. Guard -mavx with avx_runtime + target. + +2016-02-26 Martin Sebor <msebor@redhat.com> + + PR tree-optimization/15826 + * gcc.dg/tree-ssa/pr15826.c: New test. + +2016-02-26 Jakub Jelinek <jakub@redhat.com> + + PR target/69969 + * gcc.target/powerpc/pr69969.c: New test. + +2016-02-26 Martin Sebor <msebor@redhat.com> + + PR c++/15766 + * g++.old-deja/g++.other/decl5.C: Add a test case. + +2016-02-26 Segher Boessenkool <segher@kernel.crashing.org> + + PR target/69946 + * gcc.target/powerpc/pr69946.c: New file. + +2016-02-26 Richard Biener <rguenther@suse.de> + Jeff Law <law@redhat.com> + + PR tree-optimization/69740 + * gcc.c-torture/compile/pr69740-1.c: New test. + * gcc.c-torture/compile/pr69740-2.c: New test. + +2016-02-26 Martin Jambor <mjambor@suse.cz> + + PR middle-end/69920 + * gcc.dg/torture/pr69932.c: New test. + * gcc.dg/torture/pr69936.c: Likewise. + +2016-02-26 Andreas Krebbel <krebbel@linux.vnet.ibm.com> + + PR target/69709 + * gcc.target/s390/pr69709.c: New test. + +2016-02-26 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + PR target/69245 + * gcc.target/aarch64/pr69245_1.c: New test. + +2016-02-26 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + PR target/69613 + * gcc.dg/torture/pr69613.c: New test. + +2016-02-26 Jakub Jelinek <jakub@redhat.com> + + PR rtl-optimization/69891 + * gcc.target/i386/pr69891.c: New test. + +2016-02-26 Michael Meissner <meissner@linux.vnet.ibm.com> + Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + PR target/61397 + * gcc.target/powerpc/p8vector-ldst.c: Adjust to test desired + functionality for both 32-bit and 64-bit. + +2016-02-26 Richard Biener <rguenther@suse.de> + + PR tree-optimization/69551 + * gcc.dg/torture/pr69951.c: New testcase. + +2016-02-25 Richard Biener <rguenther@suse.de> + + PR tree-optimization/48795 + * gcc.dg/Warray-bounds-18.c: New testcase. + +2016-02-25 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + * g++.dg/ext/attr-constructor1.C: Require init_priority support. + +2016-02-25 Jakub Jelinek <jakub@redhat.com> + + PR rtl-optimization/69896 + * gcc.dg/pr69896.c: New test. + +2016-02-25 Patrick Palka <ppalka@gcc.gnu.org> + + PR c++/69736 + * g++.dg/cpp1y/paren2.C: New test. + +2016-02-24 Martin Sebor <msebor@redhat.com> + + PR c/51147 + * gcc.dg/enum-mode-2.c: New test. + +2016-02-24 Jakub Jelinek <jakub@redhat.com> + + PR c++/69922 + * g++.dg/warn/Wnonnull-compare-6.C: New test. + * g++.dg/warn/Wnonnull-compare-7.C: New test. + * g++.dg/ubsan/pr69922.C: New test. + +2016-02-24 Marek Polacek <polacek@redhat.com> + + PR c/69819 + * gcc.dg/pr69819.c: New test. + +2016-02-24 Martin Sebor <msebor@redhat.com> + + PR c++/69912 + * g++.dg/ext/flexary15.C: New test. + +2016-02-24 Martin Sebor <msebor@redhat.com> + + * gcc.dg/builtins-68.c: Avoid making unportable + assumptions about the relationship between SIZE_MAX and UINT_MAX. + * g++.dg/ext/builtin_alloca.C: Same. + 2016-02-24 Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> Charles Baylis <charles.baylis@linaro.org> @@ -5,7 +219,7 @@ * g++.dg/pr61033.C: Add a regression testcase for PR debug/61033. 2016-02-24 Richard Biener <rguenther@suse.de> - Jakub Jelinek <jakub@redhat.com> + Jakub Jelinek <jakub@redhat.com> PR middle-end/69760 * gcc.dg/torture/pr69760.c: New testcase. diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-empty10.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-empty10.C new file mode 100644 index 00000000000..694ed3d1277 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-empty10.C @@ -0,0 +1,17 @@ +// PR c++/67364 +// { dg-do compile { target c++11 } } + +template <typename Xn> +struct element : Xn { + constexpr element() : Xn() { } +}; + +template <typename Xn> +struct closure { + element<Xn> member; + constexpr closure() { } +}; + +struct empty { }; +constexpr closure<empty> tup{}; +constexpr empty first = tup.member; diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv10.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv10.C new file mode 100644 index 00000000000..8e806c849ae --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv10.C @@ -0,0 +1,34 @@ +// PR c++/69889 +// { dg-do compile { target c++11 } } + +template <typename F> struct Tag { + static void fp() { f()(0); } + static F f() {} +}; + +struct Dispatch { + template <typename F> Dispatch(F&&) : f(Tag<F>::fp) {} + void (*f)(); +}; + +struct Empty { Empty(Empty&&); }; + +struct Value { + Value(); + template <typename U> Value(U); + void call(Dispatch); + Empty e; +}; + +struct EmptyValue { + EmptyValue(EmptyValue&&); + EmptyValue(); +}; + +struct User { + User() { + Value().call([](Value) { return EmptyValue(); }); + } +}; + +User user; diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-sizeof4.C b/gcc/testsuite/g++.dg/cpp0x/variadic-sizeof4.C new file mode 100644 index 00000000000..1187429650c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/variadic-sizeof4.C @@ -0,0 +1,33 @@ +// PR c++/69958 +// { dg-do compile { target c++11 } } + +typedef decltype(sizeof(int)) size_t; + +template <typename...Ts> +struct list { }; + +template <size_t N> +struct size { }; + +template <typename...Ts> +using size_for = size<sizeof...(Ts)>; + +template<class T, class U> struct assert_same; +template<class T> struct assert_same<T,T> {}; + +template <typename T, typename...Ts> +using wrapped = list<T, size_for<T, Ts...>>; + +// This assertion fails (produces size<4>) +assert_same< + list<float, size<5>>, + wrapped<float, int, double, char, unsigned>> a3; + + +template <typename T, typename...Ts> +using wrapped2 = list<T, size_for<Ts..., T>>; + +// This assertion fails (produces size<2>) +assert_same< + list<float, size<5>>, + wrapped2<float, int, double, char, unsigned>> a4; diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-sizeof4a.C b/gcc/testsuite/g++.dg/cpp0x/variadic-sizeof4a.C new file mode 100644 index 00000000000..0e8096de2fc --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/variadic-sizeof4a.C @@ -0,0 +1,33 @@ +// PR c++/69958 +// { dg-do compile { target c++11 } } + +typedef decltype(sizeof(int)) size_t; + +template <typename...Ts> +struct list { }; + +template <size_t N> +struct size { }; + +template <unsigned...Ts> +using size_for = size<sizeof...(Ts)>; + +template<class T, class U> struct assert_same; +template<class T> struct assert_same<T,T> {}; + +template <typename T, unsigned...Ts> +using wrapped = list<T, size_for<0, Ts...>>; + +// This assertion fails (produces size<4>) +assert_same< + list<float, size<5>>, + wrapped<float,2,3,4,5>> a3; + + +template <typename T, unsigned...Ts> +using wrapped2 = list<T, size_for<Ts..., 0>>; + +// This assertion fails (produces size<2>) +assert_same< + list<float, size<5>>, + wrapped2<float,2,3,4,5>> a4; diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-array3.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-array3.C new file mode 100644 index 00000000000..8cea41a1cb7 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-array3.C @@ -0,0 +1,43 @@ +// PR c++/69995 +// { dg-do compile { target c++14 } } + +#define assert(X) static_assert((X),#X) + +#define CONSTEXPR constexpr + +template <typename T, unsigned long Size> +struct array { + T elems_[Size]; + + constexpr T const& operator[](unsigned long n) const + { return elems_[n]; } + + constexpr T& operator[](unsigned long n) + { return elems_[n]; } +}; + +template <typename T> +CONSTEXPR void my_swap(T& a, T& b) { + T tmp = a; + a = b; + b = tmp; +} + +CONSTEXPR auto rotate2() { + array<array<int, 2>, 2> result{}; + array<int, 2> a{{0, 1}}; + + result[0] = a; + my_swap(a[0], a[1]); + result[1] = a; + + return result; +} + +int main() { + CONSTEXPR auto indices = rotate2(); + assert(indices[0][0] == 0); + assert(indices[0][1] == 1); + assert(indices[1][0] == 1); + assert(indices[1][1] == 0); +} diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-variadic4.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-variadic4.C new file mode 100644 index 00000000000..0b65f56fa87 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-variadic4.C @@ -0,0 +1,20 @@ +// PR c++/69842 +// { dg-do compile { target c++14 } } + +template <class T, class U> struct assert_same; +template <class T> struct assert_same<T,T> {}; + +template<typename T> +void sink(T &&) +{ + assert_same<int,T> a; +} + +int main() +{ + auto const g([](auto &&... _var) { + sink(static_cast<decltype(_var)>(_var)...); + }); + + g(0); +} diff --git a/gcc/testsuite/g++.dg/cpp1y/paren2.C b/gcc/testsuite/g++.dg/cpp1y/paren2.C new file mode 100644 index 00000000000..b4a721f1150 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/paren2.C @@ -0,0 +1,31 @@ +// PR c++/69736 +// { dg-do compile { target c++14 } } + +void fn1(bool = true) +{ + (fn1)(); +} + +template <typename T> +void fn2(T a = true) +{ + (fn1)(); +} + +void foo () +{ + (fn2<bool>)(); +} + +struct X +{ + static void fn3(bool = true) + { + (X::fn3)(); + } + + void fn4(bool = true) + { + (X::fn4)(); + } +}; diff --git a/gcc/testsuite/g++.dg/ext/attr-constructor1.C b/gcc/testsuite/g++.dg/ext/attr-constructor1.C index ed522d3d551..93218713cfa 100644 --- a/gcc/testsuite/g++.dg/ext/attr-constructor1.C +++ b/gcc/testsuite/g++.dg/ext/attr-constructor1.C @@ -1,5 +1,5 @@ // PR c++/59281 -// { dg-do compile { target c++11 } } +// { dg-do compile { target { c++11 && init_priority } } } enum class E : int { prio = 666 }; void f (int) __attribute__((constructor(E::prio))); // { dg-error "integer" } diff --git a/gcc/testsuite/g++.dg/ext/attribute-may-alias-3.C b/gcc/testsuite/g++.dg/ext/attribute-may-alias-3.C new file mode 100644 index 00000000000..ba6091b6d72 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/attribute-may-alias-3.C @@ -0,0 +1,22 @@ +// PR c++/68049 +// { dg-do compile { target c++11 } } + +template <typename T> struct Bar +{ + using type = T; +}; +template <typename T> struct Foo +{ + typedef typename Bar<T>::type alias_type [[gnu::may_alias]]; + + alias_type operator()() { return {}; } +}; + +template <typename T> void print(T) {} + +int main() +{ + print(Foo<int>()()); + print(0); + return 0; +} diff --git a/gcc/testsuite/g++.dg/ext/builtin_alloca.C b/gcc/testsuite/g++.dg/ext/builtin_alloca.C index 10a9bdce474..7a0d331ced0 100644 --- a/gcc/testsuite/g++.dg/ext/builtin_alloca.C +++ b/gcc/testsuite/g++.dg/ext/builtin_alloca.C @@ -4,10 +4,23 @@ // { dg-do compile } #define CHAR_BIT __CHAR_BIT__ -#define INT_MAX __INT_MAX__ -#define INT_MIN (-INT_MAX - 1) -#define LONG_MAX __LONG_MAX__ -#define LLONG_MAX __LONG_LONG_MAX__ +#define SIZE_MAX __SIZE_MAX__ +#define UINT_MAX (__INT_MAX__ + 1U) + +/* The largest valid alignment is undocumented and subject to change + but for the purposes of white box testing we rely on knowing that + it happens to be defined to (UINT_MAX >> 1) + 1. */ +#define ALIGN_MAX ((UINT_MAX >> 1) + 1) + +#if UINT_MAX < SIZE_MAX +/* Define a constant to exercise an alignment that is valid a power + of 2 in excess of the maximum. */ +# define MAX_X_2 (ALIGN_MAX << 1) +#else +/* For targets where UINT_MAX is the same as SIZE_MAX, use an invalid + alignment that's less than the maximum to elicit the same errors. */ +# define MAX_X_2 (ALIGN_MAX + 1) +#endif static void* p; @@ -122,10 +135,6 @@ void test_arg2_non_const (int n, int a1) // of CHAR_BIT must be rejected. void test_arg2_non_pow2 (int n) { - p = __builtin_alloca_with_align (n, INT_MIN); // { dg-error "must be a constant integer" } - p = __builtin_alloca_with_align (n, -1); // { dg-error "must be a constant integer" } - p = __builtin_alloca_with_align (n, !1); // { dg-error "must be a constant integer" } - p = __builtin_alloca_with_align (n, !0); // { dg-error "must be a constant integer" } p = __builtin_alloca_with_align (n, 0); // { dg-error "must be a constant integer" } p = __builtin_alloca_with_align (n, 1); // { dg-error "must be a constant integer" } p = __builtin_alloca_with_align (n, 2); // { dg-error "must be a constant integer" } @@ -146,13 +155,8 @@ void test_arg2_non_pow2 (int n) p = __builtin_alloca_with_align (n, 33); // { dg-error "must be a constant integer" } p = __builtin_alloca_with_align (n, 63); // { dg-error "must be a constant integer" } p = __builtin_alloca_with_align (n, 65); // { dg-error "must be a constant integer" } - p = __builtin_alloca_with_align (n, INT_MAX); // { dg-error "must be a constant integer" } - p = __builtin_alloca_with_align (n, ~0U); // { dg-error "must be a constant integer" } - p = __builtin_alloca_with_align (n, LONG_MAX); // { dg-error "must be a constant integer" } - p = __builtin_alloca_with_align (n, ~0LU); // { dg-error "must be a constant integer" } - p = __builtin_alloca_with_align (n, 1LLU << 34); // { dg-error "must be a constant integer" } - p = __builtin_alloca_with_align (n, LLONG_MAX); // { dg-error "must be a constant integer" } - p = __builtin_alloca_with_align (n, ~0LLU); // { dg-error "must be a constant integer" } + p = __builtin_alloca_with_align (n, SIZE_MAX); /* { dg-error "must be a constant integer" } */ + p = __builtin_alloca_with_align (n, MAX_X_2); /* { dg-error "must be a constant integer" } */ } // Exercise invalid alignment specified by a template argument. diff --git a/gcc/testsuite/g++.dg/ext/flexary15.C b/gcc/testsuite/g++.dg/ext/flexary15.C new file mode 100644 index 00000000000..c03a60e7b50 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/flexary15.C @@ -0,0 +1,14 @@ +// PR c++/69912 - [6 regression] ICE in build_ctor_subob_ref initializing +// a flexible array member +// { dg-do compile } +// { dg-options "-Wno-pedantic -Wno-write-strings -fpermissive" } + +struct S { + int n; + char *a[]; +}; + +void foo (const char *a) +{ + const S s = { 1, { a, "b" } }; // { dg-warning "invalid conversion" } +} diff --git a/gcc/testsuite/g++.dg/template/crash34.C b/gcc/testsuite/g++.dg/template/crash34.C index ef4d21b60d8..83dcc78f37f 100644 --- a/gcc/testsuite/g++.dg/template/crash34.C +++ b/gcc/testsuite/g++.dg/template/crash34.C @@ -7,6 +7,6 @@ class Foo; -template <typename T> class Foo { }; // { dg-error "not a template type" } +template <typename T> class Foo { }; // { dg-error "not a template" } Foo<int> x; // { dg-error "not a template|incomplete type" } diff --git a/gcc/testsuite/g++.dg/template/friend61.C b/gcc/testsuite/g++.dg/template/friend61.C new file mode 100644 index 00000000000..1604f5c904e --- /dev/null +++ b/gcc/testsuite/g++.dg/template/friend61.C @@ -0,0 +1,12 @@ +// PR c++/69323 + +template<int VALUE> +struct Outer +{ + struct StupidValueTrick + { + template<int VAL> friend struct Outer<VAL>::StupidValueTrick; + }; +}; +typedef Outer<42>::StupidValueTrick GoodValue; +GoodValue good; diff --git a/gcc/testsuite/g++.dg/template/friend61a.C b/gcc/testsuite/g++.dg/template/friend61a.C new file mode 100644 index 00000000000..d38e53ae4bb --- /dev/null +++ b/gcc/testsuite/g++.dg/template/friend61a.C @@ -0,0 +1,12 @@ +// PR c++/69323 + +template<int VALUE> +struct Outer +{ + struct StupidValueTrick + { + template<int VAL> friend struct StupidValueTrick; // { dg-error "not a template" } + }; +}; +typedef Outer<42>::StupidValueTrick GoodValue; +GoodValue good; diff --git a/gcc/testsuite/g++.dg/template/friend61b.C b/gcc/testsuite/g++.dg/template/friend61b.C new file mode 100644 index 00000000000..2da5d60b55e --- /dev/null +++ b/gcc/testsuite/g++.dg/template/friend61b.C @@ -0,0 +1,12 @@ +// PR c++/69323 + +template<int VALUE> +struct Outer +{ + struct StupidValueTrick + { + template<int VAL> friend struct Outer::StupidValueTrick; // { dg-error "not a template" } + }; +}; +typedef Outer<42>::StupidValueTrick GoodValue; +GoodValue good; diff --git a/gcc/testsuite/g++.dg/template/pr69961a.C b/gcc/testsuite/g++.dg/template/pr69961a.C new file mode 100644 index 00000000000..b0c5d41b27c --- /dev/null +++ b/gcc/testsuite/g++.dg/template/pr69961a.C @@ -0,0 +1,25 @@ +// PR c++/69961 +// { dg-do compile { target c++11 } } + +#include <string> + +using std::string; + +class Format { + public: + explicit Format(string formatted) {} + string buffer; +}; + +string StrCat(const string& a) { + return ""; +} + +template <typename... AV> +Format Message(string msg, const AV&... args) { + return Format::Format(StrCat(msg, args...)); // { dg-error "cannot call constructor" } +} + +int main(int, char**) { + Message("msg"); +} diff --git a/gcc/testsuite/g++.dg/template/pr69961b.C b/gcc/testsuite/g++.dg/template/pr69961b.C new file mode 100644 index 00000000000..5fff1c90837 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/pr69961b.C @@ -0,0 +1,15 @@ +// PR c++/69961 + +struct A { A (int); }; + +template <typename T> +void foo () +{ + A::A ((T)0); // { dg-error "cannot call constructor .A::A. directly" } +} + +void +bar () +{ + foo<int> (); +} diff --git a/gcc/testsuite/g++.dg/ubsan/pr69922.C b/gcc/testsuite/g++.dg/ubsan/pr69922.C new file mode 100644 index 00000000000..0392750427e --- /dev/null +++ b/gcc/testsuite/g++.dg/ubsan/pr69922.C @@ -0,0 +1,18 @@ +// PR c++/69922 +// { dg-do compile } +// { dg-options "-fsanitize=vptr -Wnonnull-compare" } + +struct S { virtual ~S (); }; +struct T : S { T *bar (); T *baz (); T *q; bool b; }; + +T * +T::bar () +{ + return static_cast<T*>(reinterpret_cast<S*>(this)); // { dg-bogus "nonnull argument" } +} + +T * +T::baz () +{ + return static_cast<T*>(reinterpret_cast<S*>(b ? this : q)); // { dg-bogus "nonnull argument" } +} diff --git a/gcc/testsuite/g++.dg/warn/Wnonnull-compare-6.C b/gcc/testsuite/g++.dg/warn/Wnonnull-compare-6.C new file mode 100644 index 00000000000..d327df9ab64 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wnonnull-compare-6.C @@ -0,0 +1,13 @@ +// PR c++/69922 +// { dg-do compile } +// { dg-options "-Wnonnull-compare" } + +struct T { virtual ~T (); }; +struct S { virtual ~S (); T *f (bool); }; +struct U : S, T {}; + +T * +S::f (bool b) +{ + return b ? static_cast<U *> (this) : (U *) 0; // { dg-bogus "nonnull argument" } +} diff --git a/gcc/testsuite/g++.dg/warn/Wnonnull-compare-7.C b/gcc/testsuite/g++.dg/warn/Wnonnull-compare-7.C new file mode 100644 index 00000000000..6c19a4339a5 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wnonnull-compare-7.C @@ -0,0 +1,19 @@ +// PR c++/69922 +// { dg-do compile } +// { dg-options "-Wnonnull-compare" } + +struct S { virtual ~S (); }; +struct T { virtual ~T (); }; +bool b, c; +S *p; +T *q, *r; + +S::~S () +{ + delete (b ? this : p); // { dg-bogus "nonnull argument" } +} + +T::~T () +{ + delete (b ? (c ? this : q) : r); // { dg-bogus "nonnull argument" } +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/decl5.C b/gcc/testsuite/g++.old-deja/g++.other/decl5.C index d13f7b1d0af..2a7a5f2560e 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/decl5.C +++ b/gcc/testsuite/g++.old-deja/g++.other/decl5.C @@ -77,3 +77,9 @@ void NMS::fn() { i = 3; } + +// From PR c++/15766 - bad parse error recovery (2 bugs) +void confusion1(const UndefinedType& a) // { dg-error "does not name a type" } +{ +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr69999.c b/gcc/testsuite/gcc.c-torture/compile/pr69999.c new file mode 100644 index 00000000000..5659ce48a17 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr69999.c @@ -0,0 +1,16 @@ +int uh; + +void +ha(void) +{ + while (uh) { + for (uh = 0; uh < 1; ++uh) { + uh = 0; + if (uh != 0) + ts: + uh %= uh; + } + ++uh; + } + goto ts; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr70005.c b/gcc/testsuite/gcc.c-torture/execute/pr70005.c new file mode 100644 index 00000000000..bc37efe00cb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr70005.c @@ -0,0 +1,25 @@ + +unsigned char a = 6; +int b, c; + +static void +fn1 () +{ + int i = a > 1 ? 1 : a, j = 6 & (c = a && (b = a)); + int d = 0, e = a, f = ~c, g = b || a; + unsigned char h = ~a; + if (a) + f = j; + if (h && g) + d = a; + i = -~(f * d * h) + c && (e || i) ^ f; + if (i != 1) + __builtin_abort (); +} + +int +main () +{ + fn1 (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-18.c b/gcc/testsuite/gcc.dg/Warray-bounds-18.c new file mode 100644 index 00000000000..888fb80e7b9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/Warray-bounds-18.c @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -Warray-bounds" } */ + +typedef struct +{ + int len; + char data[1]; +} rec; + +int +p(rec *r, int len); + +int +f (char prm1, char prm2) +{ + char buf[10]; + + rec *r1 = (rec *)&buf; + + r1->len = 10; + r1->data[0] = prm1; + r1->data[1] = prm2; /* { dg-bogus "above array bounds" } */ + + return p(r1, r1->len); +} diff --git a/gcc/testsuite/gcc.dg/builtins-68.c b/gcc/testsuite/gcc.dg/builtins-68.c index d2e65d08060..c0cc1ebdcb9 100644 --- a/gcc/testsuite/gcc.dg/builtins-68.c +++ b/gcc/testsuite/gcc.dg/builtins-68.c @@ -5,10 +5,23 @@ /* { dg-options "-Wno-long-long" } */ #define CHAR_BIT __CHAR_BIT__ -#define INT_MAX __INT_MAX__ -#define INT_MIN (-INT_MAX - 1) -#define LONG_MAX __LONG_MAX__ -#define LLONG_MAX __LONG_LONG_MAX__ +#define SIZE_MAX __SIZE_MAX__ +#define UINT_MAX (__INT_MAX__ + 1U) + +/* The largest valid alignment is undocumented and subject to change + but for the purposes of white box testing we rely on knowing that + it happens to be defined to (UINT_MAX >> 1) + 1. */ +#define ALIGN_MAX ((UINT_MAX >> 1) + 1) + +#if UINT_MAX < SIZE_MAX +/* Define a constant to exercise an alignment that is valid a power + of 2 in excess of the maximum. */ +# define MAX_X_2 (ALIGN_MAX << 1) +#else +/* For targets where UINT_MAX is the same as SIZE_MAX, use an invalid + alignment that's less than the maximum to elicit the same errors. */ +# define MAX_X_2 (ALIGN_MAX + 1) +#endif static void* p; @@ -76,10 +89,6 @@ void test_arg2_non_const (int n, int a1) of CHAR_BIT less than (1LLU << 32) must be rejected. */ void test_arg2_non_pow2 (int n) { - p = __builtin_alloca_with_align (n, INT_MIN); /* { dg-error "must be a constant integer" } */ - p = __builtin_alloca_with_align (n, -1); /* { dg-error "must be a constant integer" } */ - p = __builtin_alloca_with_align (n, !1); /* { dg-error "must be a constant integer" } */ - p = __builtin_alloca_with_align (n, !0); /* { dg-error "must be a constant integer" } */ p = __builtin_alloca_with_align (n, 0); /* { dg-error "must be a constant integer" } */ p = __builtin_alloca_with_align (n, 1); /* { dg-error "must be a constant integer" } */ p = __builtin_alloca_with_align (n, 2); /* { dg-error "must be a constant integer" } */ @@ -100,11 +109,6 @@ void test_arg2_non_pow2 (int n) p = __builtin_alloca_with_align (n, 33); /* { dg-error "must be a constant integer" } */ p = __builtin_alloca_with_align (n, 63); /* { dg-error "must be a constant integer" } */ p = __builtin_alloca_with_align (n, 65); /* { dg-error "must be a constant integer" } */ - p = __builtin_alloca_with_align (n, INT_MAX); /* { dg-error "must be a constant integer" } */ - p = __builtin_alloca_with_align (n, ~0U); /* { dg-error "must be a constant integer" } */ - p = __builtin_alloca_with_align (n, LONG_MAX); /* { dg-error "must be a constant integer" } */ - p = __builtin_alloca_with_align (n, ~0LU); /* { dg-error "must be a constant integer" } */ - p = __builtin_alloca_with_align (n, 1LLU << 34); /* { dg-error "must be a constant integer" } */ - p = __builtin_alloca_with_align (n, LLONG_MAX); /* { dg-error "must be a constant integer" } */ - p = __builtin_alloca_with_align (n, ~0LLU); /* { dg-error "must be a constant integer" } */ + p = __builtin_alloca_with_align (n, SIZE_MAX); /* { dg-error "must be a constant integer" } */ + p = __builtin_alloca_with_align (n, MAX_X_2); /* { dg-error "must be a constant integer" } */ } diff --git a/gcc/testsuite/gcc.dg/cpp/pr69985.c b/gcc/testsuite/gcc.dg/cpp/pr69985.c new file mode 100644 index 00000000000..28f17e956a5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/pr69985.c @@ -0,0 +1,7 @@ +/* { dg-options "-Wformat" } */ +extern int printf (const char *__restrict __format, ...); +void test (void) +{ + /* A very long line, so that we start a new line map. */ + printf ("%llu01233456789012334567890123345678901233456789012334567890123345678901233456789012334567890123345678901233456789012334567890123345678901233456789"); /* { dg-warning "15: format .%llu. expects a matching" } */ +} diff --git a/gcc/testsuite/gcc.dg/enum-mode-2.c b/gcc/testsuite/gcc.dg/enum-mode-2.c new file mode 100644 index 00000000000..8dba3c53c69 --- /dev/null +++ b/gcc/testsuite/gcc.dg/enum-mode-2.c @@ -0,0 +1,22 @@ +/* PR c/51147 - attribute((mode(byte))) on an enum generates wrong code */ + +/* { dg-do compile } */ +/* { dg-additional-options "-O2 -fdump-tree-optimized" } */ + +enum _eq_bool +{ + false, + true +} __attribute__((mode (byte))); + +typedef enum _eq_bool bool; + +bool foo (void); +bool bar (void); + +bool test (void) +{ + return foo () || bar (); +} + +/* { dg-final { scan-tree-dump-times "foo|bar" 2 "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/pr69819.c b/gcc/testsuite/gcc.dg/pr69819.c new file mode 100644 index 00000000000..a9594dd0501 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr69819.c @@ -0,0 +1,5 @@ +/* PR c/69819 */ +/* { dg-do compile } */ + +void foo () { } +int foo[] = { 0 }; /* { dg-error ".foo. redeclared as different kind of symbol" } */ diff --git a/gcc/testsuite/gcc.dg/pr69896.c b/gcc/testsuite/gcc.dg/pr69896.c new file mode 100644 index 00000000000..af141adbf5e --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr69896.c @@ -0,0 +1,33 @@ +/* PR rtl-optimization/69896 */ +/* { dg-do run { target int128 } } */ +/* { dg-options "-w -O -fcaller-saves -fno-dse -frename-registers -fno-tree-ter" } */ +/* { dg-additional-options "-mno-sse" { target x86_64-*-* i?86-*-* } } */ + +typedef unsigned short A; +typedef unsigned short B __attribute__ ((vector_size (32))); +typedef unsigned int C; +typedef unsigned int D __attribute__ ((vector_size (32))); +typedef unsigned long long E; +typedef unsigned long long F __attribute__ ((vector_size (32))); +typedef unsigned __int128 G; +typedef unsigned __int128 H __attribute__ ((vector_size (32))); + +G __attribute__ ((noinline, noclone)) +foo (A a, C b, E c, G d, A e, C f, E g, G h, B i, D j, F k, H l, B m, D n, F o, H p) +{ + j /= (D) { -c, -c, ~h, 1, ~l[0], -m[0], p[0], 1} | 1; + l %= (H) o | 1; + l[1] = (l[1] << (e & 127)) | (l[1] >> (e & 127)); + return j[6] + l[0] + l[1] + n[7] + o[0] + o[2] + o[3] + p[0] + p[1]; +} + +int +main () +{ + if (__CHAR_BIT__ != 8 || sizeof (A) != 2 || sizeof (C) != 4 || sizeof (E) != 8 || sizeof (G) != 16) + return 0; + G x = foo (0, 1, 2, 3, 4, 5, 6, 7, (B) {}, (D) {}, (F) {}, (H) {}, (B) {}, (D) {}, (F) {}, (H) { 0xffffffffffffffffULL, 0x74a3e4aULL }); + if ((E) x != 0x00000000074a3e49ULL || (E) (x >> 64) != 1) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr69613.c b/gcc/testsuite/gcc.dg/torture/pr69613.c new file mode 100644 index 00000000000..d903c85811e --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr69613.c @@ -0,0 +1,41 @@ +/* PR target/69613. */ +/* { dg-do run { target int128 } } */ +/* { dg-options "-w -Wno-psabi" } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ + +typedef unsigned short u16; +typedef unsigned short v32u16 __attribute__ ((vector_size (32))); +typedef unsigned int u32; +typedef unsigned int v32u32 __attribute__ ((vector_size (32))); +typedef unsigned long long u64; +typedef unsigned long long v32u64 __attribute__ ((vector_size (32))); +typedef unsigned __int128 u128; +typedef unsigned __int128 v32u128 __attribute__ ((vector_size (32))); + +u128 __attribute__ ((noinline, noclone)) +foo (u32 u32_0, u64 u64_1, u128 u128_1, v32u16 v32u16_0, v32u128 v32u128_0, + v32u16 v32u16_1, v32u32 v32u32_1, v32u64 v32u64_1, v32u128 v32u128_1) +{ + u128 temp = (v32u128_1[0] << ((-u32_0) & 127)); + u32 t2 = (u32_0 & 127); + v32u128_1[0] = (v32u128_1[0] >> t2); + + v32u128_1[0] ^= temp; + v32u128_1 |= (v32u128){ v32u128_0[1] }; + + return u64_1 + u128_1 + v32u16_0[0] + v32u16_0[1] + v32u16_1[11] + + v32u16_1[12] + v32u16_1[13] + v32u32_1[0] + v32u32_1[1] + + v32u32_1[2] + v32u64_1[1] + v32u64_1[2] + v32u64_1[3] + v32u128_1[0] + + v32u128_1[1]; +} + +int +main () +{ + u128 x + = foo (1, 1, 1, (v32u16){ 1, 1, 1 }, (v32u128){ 1 }, (v32u16){ 1, 1, 1 }, + (v32u32){ 1 }, (v32u64){ 1, 1, 1 }, (v32u128){ -1 }); + if (x != 6) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr69886.c b/gcc/testsuite/gcc.dg/torture/pr69886.c index d896d4fec9b..cc88a952483 100644 --- a/gcc/testsuite/gcc.dg/torture/pr69886.c +++ b/gcc/testsuite/gcc.dg/torture/pr69886.c @@ -1,6 +1,6 @@ /* PR rtl-optimization/69886. */ /* { dg-do compile } */ -/* { dg-options "--param=gcse-unrestricted-cost=0" } */ +/* { dg-options "--param=gcse-unrestricted-cost=0 -w -Wno-psabi" } */ /* { dg-additional-options "-mavx" { target { i?86-*-* x86_64-*-* } } } */ typedef unsigned v32su __attribute__ ((vector_size (32))); diff --git a/gcc/testsuite/gcc.dg/torture/pr69932.c b/gcc/testsuite/gcc.dg/torture/pr69932.c new file mode 100644 index 00000000000..4b82130157b --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr69932.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ + +int a; +void fn1() { + int b = 4; + short c[4]; + c[b] = c[a]; + if (c[2]) {} + +} diff --git a/gcc/testsuite/gcc.dg/torture/pr69936.c b/gcc/testsuite/gcc.dg/torture/pr69936.c new file mode 100644 index 00000000000..3023bbbb1c4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr69936.c @@ -0,0 +1,24 @@ +/* { dg-do compile } */ + +int a; +char b; +void fn1(int p1) {} + +int fn2() { return 5; } + +void fn3() { + if (fn2()) + ; + else { + char c[5]; + c[0] = 5; + lbl_608: + fn1(c[9]); + int d = c[9]; + c[2] | a; + d = c[b]; + } + goto lbl_608; +} + +int main() { return 0; } diff --git a/gcc/testsuite/gcc.dg/torture/pr69951.c b/gcc/testsuite/gcc.dg/torture/pr69951.c new file mode 100644 index 00000000000..cb46fefccdb --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr69951.c @@ -0,0 +1,21 @@ +/* { dg-do run } */ +/* { dg-require-alias "" } */ + +extern void abort (void); + +int a = 1, c = 1; +extern int b __attribute__((alias("a"))); +extern int d __attribute__((alias("c"))); +int main(int argc) +{ + int *p, *q; + if (argc) + p = &c, q = &d; + else + p = &b, q = &d; + *p = 1; + *q = 2; + if (*p == 1) + abort(); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr69989.c b/gcc/testsuite/gcc.dg/torture/pr69989.c new file mode 100644 index 00000000000..ada99f19eae --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr69989.c @@ -0,0 +1,23 @@ +/* { dg-do compile } */ + +extern int a, b, d; +extern char c[]; +void +fn1 (void) +{ + for (;;) + { + if (b) + { +LABEL_T5T5T: + for (; d < a; d++) + c[d] = 6; + } + break; + } + if (a > 6) + { + a = 4; + goto LABEL_T5T5T; + } +} diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr15826.c b/gcc/testsuite/gcc.dg/tree-ssa/pr15826.c new file mode 100644 index 00000000000..99ac0e2cc58 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr15826.c @@ -0,0 +1,36 @@ +/* PR tree-optimization/15826 - don't use "if" to extract a single bit + bit-field */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +struct s { + unsigned int bit : 1; +}; + +unsigned int +foo (struct s *p) +{ + if (p->bit) + return 1; + else + return 0; +} + +unsigned int +bar (struct s *p) +{ + return (unsigned int) (p->bit); +} + +unsigned int +andrew (struct s *p) +{ + int i; + if (p->bit) + i = 1; + else + i = 0; + return i; +} + +/* { dg-final { scan-tree-dump-times " & | goto " 0 "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/torture/pr69652.c b/gcc/testsuite/gcc.dg/vect/pr69652.c index ab7b69842c6..29fe28c5c7a 100644 --- a/gcc/testsuite/gcc.dg/torture/pr69652.c +++ b/gcc/testsuite/gcc.dg/vect/pr69652.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -ffast-math -ftree-vectorize " } */ +/* { dg-additional-options "-ffast-math" } */ /* { dg-additional-options "-mavx" { target { i?86-*-* x86_64-*-* } } } */ void fn1(double **matrix, int column, int row, int n) diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-pr69720.c b/gcc/testsuite/gcc.dg/vect/vect-outer-pr69720.c new file mode 100644 index 00000000000..bcfcc6db8ce --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-outer-pr69720.c @@ -0,0 +1,28 @@ +extern void abort (void); + +int a[128]; +double b[128] = { 1., 2., 3., 4. }; + +void __attribute__((noinline)) foo() +{ + int i; + for (i = 0; i < 128; ++i) + { + double tem1 = b[i]; + for (int j = 0; j < 32; ++j) + tem1 += 1; + b[i] = tem1; + a[i] = i; + } +} + +int main() +{ + foo (); + if (b[0] != 33. || b[1] != 34. + || b[2] != 35. || b[3] != 36.) + abort (); + return 0; +} + +/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { target { vect_double && vect_int } } } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/pr69245_1.c b/gcc/testsuite/gcc.target/aarch64/pr69245_1.c new file mode 100644 index 00000000000..dcc542b2a86 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr69245_1.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -march=armv8-a+fp -fomit-frame-pointer" } */ + +#pragma GCC target "arch=armv8-a+nofp" +long a; +static void +fn1 () +{ +} + +#pragma GCC target "arch=armv8-a+fp" +float +fn2 (float a) +{ + return a + 2.0; +} + +/* { dg-final { scan-assembler-not "__addsf3" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr69891.c b/gcc/testsuite/gcc.target/i386/pr69891.c new file mode 100644 index 00000000000..2c5e86372e3 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr69891.c @@ -0,0 +1,30 @@ +/* PR rtl-optimization/69891 */ +/* { dg-do run } */ +/* { dg-options "-O -fno-tree-fre -mstringop-strategy=libcall -Wno-psabi" } */ +/* { dg-additional-options "-mno-sse" { target ia32 } } */ + +typedef unsigned short A; +typedef unsigned short B __attribute__ ((vector_size (32))); +typedef unsigned int C; +typedef unsigned int D __attribute__ ((vector_size (32))); +typedef unsigned long long E; +typedef unsigned long long F __attribute__ ((vector_size (32))); + +__attribute__((noinline, noclone)) unsigned +foo(D a, B b, D c, F d) +{ + b /= (B) {1, -c[0]} | 1; + c[0] |= 7; + a %= c | 1; + c ^= c; + return a[0] + b[15] + c[0] + d[3]; +} + +int +main () +{ + unsigned x = foo ((D) {}, (B) {}, (D) {}, (F) {}); + if (x != 0) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/stack-realign-win.c b/gcc/testsuite/gcc.target/i386/stack-realign-win.c new file mode 100644 index 00000000000..e27a5650542 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/stack-realign-win.c @@ -0,0 +1,35 @@ +/* { dg-do compile { target *-*-mingw* *-*-cygwin* } } */ +/* { dg-require-effective-target ia32 } */ +/* { dg-options "-msse -O" } */ + +extern void abort (void); + +typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__)); + +static __m128 +load_m128 (float *e) +{ + return * (__m128 *) e; +} + +typedef union +{ + __m128 x; + float a[4]; +} union128; + +void test (void) +{ + union128 u; + float e[4] __attribute__ ((aligned (16))) + = {2134.3343, 1234.635654, 1.2234, 876.8976}; + int i; + + u.x = load_m128 (e); + + for (i = 0; i < 4; i++) + if (u.a[i] != e[i]) + abort (); +} + +/* { dg-final { scan-assembler "andl\\t\\$-16, %esp" } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/p8vector-ldst.c b/gcc/testsuite/gcc.target/powerpc/p8vector-ldst.c index 5da7388097b..de3f1b4ebbf 100644 --- a/gcc/testsuite/gcc.target/powerpc/p8vector-ldst.c +++ b/gcc/testsuite/gcc.target/powerpc/p8vector-ldst.c @@ -1,4 +1,4 @@ -/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */ +/* { dg-do compile { target { powerpc*-*-* } } } */ /* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ /* { dg-require-effective-target powerpc_p8vector_ok } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ @@ -51,13 +51,14 @@ load_store_sf (unsigned long num, float value37 = 0.0f; float value38 = 0.0f; float value39 = 0.0f; - unsigned long in_mask; - unsigned long out_mask; + unsigned long in_mask, in_mask2; + unsigned long out_mask, out_mask2; unsigned long i; for (i = 0; i < num; i++) { in_mask = *in_mask_ptr++; + in_mask2 = *in_mask_ptr++; if ((in_mask & (1L << 0)) != 0L) value00 = *from_ptr++; @@ -118,67 +119,68 @@ load_store_sf (unsigned long num, if ((in_mask & (1L << 19)) != 0L) value19 = *from_ptr++; - if ((in_mask & (1L << 20)) != 0L) + if ((in_mask2 & (1L << 0)) != 0L) value20 = *from_ptr++; - if ((in_mask & (1L << 21)) != 0L) + if ((in_mask2 & (1L << 1)) != 0L) value21 = *from_ptr++; - if ((in_mask & (1L << 22)) != 0L) + if ((in_mask2 & (1L << 2)) != 0L) value22 = *from_ptr++; - if ((in_mask & (1L << 23)) != 0L) + if ((in_mask2 & (1L << 3)) != 0L) value23 = *from_ptr++; - if ((in_mask & (1L << 24)) != 0L) + if ((in_mask2 & (1L << 4)) != 0L) value24 = *from_ptr++; - if ((in_mask & (1L << 25)) != 0L) + if ((in_mask2 & (1L << 5)) != 0L) value25 = *from_ptr++; - if ((in_mask & (1L << 26)) != 0L) + if ((in_mask2 & (1L << 6)) != 0L) value26 = *from_ptr++; - if ((in_mask & (1L << 27)) != 0L) + if ((in_mask2 & (1L << 7)) != 0L) value27 = *from_ptr++; - if ((in_mask & (1L << 28)) != 0L) + if ((in_mask2 & (1L << 8)) != 0L) value28 = *from_ptr++; - if ((in_mask & (1L << 29)) != 0L) + if ((in_mask2 & (1L << 9)) != 0L) value29 = *from_ptr++; - if ((in_mask & (1L << 30)) != 0L) + if ((in_mask2 & (1L << 10)) != 0L) value30 = *from_ptr++; - if ((in_mask & (1L << 31)) != 0L) + if ((in_mask2 & (1L << 11)) != 0L) value31 = *from_ptr++; - if ((in_mask & (1L << 32)) != 0L) + if ((in_mask2 & (1L << 12)) != 0L) value32 = *from_ptr++; - if ((in_mask & (1L << 33)) != 0L) + if ((in_mask2 & (1L << 13)) != 0L) value33 = *from_ptr++; - if ((in_mask & (1L << 34)) != 0L) + if ((in_mask2 & (1L << 14)) != 0L) value34 = *from_ptr++; - if ((in_mask & (1L << 35)) != 0L) + if ((in_mask2 & (1L << 15)) != 0L) value35 = *from_ptr++; - if ((in_mask & (1L << 36)) != 0L) + if ((in_mask2 & (1L << 16)) != 0L) value36 = *from_ptr++; - if ((in_mask & (1L << 37)) != 0L) + if ((in_mask2 & (1L << 17)) != 0L) value37 = *from_ptr++; - if ((in_mask & (1L << 38)) != 0L) + if ((in_mask2 & (1L << 18)) != 0L) value38 = *from_ptr++; - if ((in_mask & (1L << 39)) != 0L) + if ((in_mask2 & (1L << 19)) != 0L) value39 = *from_ptr++; out_mask = *out_mask_ptr++; + out_mask2 = *out_mask_ptr++; if ((out_mask & (1L << 0)) != 0L) *to_ptr++ = value00; @@ -239,64 +241,64 @@ load_store_sf (unsigned long num, if ((out_mask & (1L << 19)) != 0L) *to_ptr++ = value19; - if ((out_mask & (1L << 20)) != 0L) + if ((out_mask2 & (1L << 0)) != 0L) *to_ptr++ = value20; - if ((out_mask & (1L << 21)) != 0L) + if ((out_mask2 & (1L << 1)) != 0L) *to_ptr++ = value21; - if ((out_mask & (1L << 22)) != 0L) + if ((out_mask2 & (1L << 2)) != 0L) *to_ptr++ = value22; - if ((out_mask & (1L << 23)) != 0L) + if ((out_mask2 & (1L << 3)) != 0L) *to_ptr++ = value23; - if ((out_mask & (1L << 24)) != 0L) + if ((out_mask2 & (1L << 4)) != 0L) *to_ptr++ = value24; - if ((out_mask & (1L << 25)) != 0L) + if ((out_mask2 & (1L << 5)) != 0L) *to_ptr++ = value25; - if ((out_mask & (1L << 26)) != 0L) + if ((out_mask2 & (1L << 6)) != 0L) *to_ptr++ = value26; - if ((out_mask & (1L << 27)) != 0L) + if ((out_mask2 & (1L << 7)) != 0L) *to_ptr++ = value27; - if ((out_mask & (1L << 28)) != 0L) + if ((out_mask2 & (1L << 8)) != 0L) *to_ptr++ = value28; - if ((out_mask & (1L << 29)) != 0L) + if ((out_mask2 & (1L << 9)) != 0L) *to_ptr++ = value29; - if ((out_mask & (1L << 30)) != 0L) + if ((out_mask2 & (1L << 10)) != 0L) *to_ptr++ = value30; - if ((out_mask & (1L << 31)) != 0L) + if ((out_mask2 & (1L << 11)) != 0L) *to_ptr++ = value31; - if ((out_mask & (1L << 32)) != 0L) + if ((out_mask2 & (1L << 12)) != 0L) *to_ptr++ = value32; - if ((out_mask & (1L << 33)) != 0L) + if ((out_mask2 & (1L << 13)) != 0L) *to_ptr++ = value33; - if ((out_mask & (1L << 34)) != 0L) + if ((out_mask2 & (1L << 14)) != 0L) *to_ptr++ = value34; - if ((out_mask & (1L << 35)) != 0L) + if ((out_mask2 & (1L << 15)) != 0L) *to_ptr++ = value35; - if ((out_mask & (1L << 36)) != 0L) + if ((out_mask2 & (1L << 16)) != 0L) *to_ptr++ = value36; - if ((out_mask & (1L << 37)) != 0L) + if ((out_mask2 & (1L << 17)) != 0L) *to_ptr++ = value37; - if ((out_mask & (1L << 38)) != 0L) + if ((out_mask2 & (1L << 18)) != 0L) *to_ptr++ = value38; - if ((out_mask & (1L << 39)) != 0L) + if ((out_mask2 & (1L << 19)) != 0L) *to_ptr++ = value39; } @@ -357,13 +359,14 @@ load_store_df (unsigned long num, double value37 = 0.0; double value38 = 0.0; double value39 = 0.0; - unsigned long in_mask; - unsigned long out_mask; + unsigned long in_mask, in_mask2; + unsigned long out_mask, out_mask2; unsigned long i; for (i = 0; i < num; i++) { in_mask = *in_mask_ptr++; + in_mask2 = *in_mask_ptr++; if ((in_mask & (1L << 0)) != 0L) value00 = *from_ptr++; @@ -424,67 +427,68 @@ load_store_df (unsigned long num, if ((in_mask & (1L << 19)) != 0L) value19 = *from_ptr++; - if ((in_mask & (1L << 20)) != 0L) + if ((in_mask2 & (1L << 0)) != 0L) value20 = *from_ptr++; - if ((in_mask & (1L << 21)) != 0L) + if ((in_mask2 & (1L << 1)) != 0L) value21 = *from_ptr++; - if ((in_mask & (1L << 22)) != 0L) + if ((in_mask2 & (1L << 2)) != 0L) value22 = *from_ptr++; - if ((in_mask & (1L << 23)) != 0L) + if ((in_mask2 & (1L << 3)) != 0L) value23 = *from_ptr++; - if ((in_mask & (1L << 24)) != 0L) + if ((in_mask2 & (1L << 4)) != 0L) value24 = *from_ptr++; - if ((in_mask & (1L << 25)) != 0L) + if ((in_mask2 & (1L << 5)) != 0L) value25 = *from_ptr++; - if ((in_mask & (1L << 26)) != 0L) + if ((in_mask2 & (1L << 6)) != 0L) value26 = *from_ptr++; - if ((in_mask & (1L << 27)) != 0L) + if ((in_mask2 & (1L << 7)) != 0L) value27 = *from_ptr++; - if ((in_mask & (1L << 28)) != 0L) + if ((in_mask2 & (1L << 8)) != 0L) value28 = *from_ptr++; - if ((in_mask & (1L << 29)) != 0L) + if ((in_mask2 & (1L << 9)) != 0L) value29 = *from_ptr++; - if ((in_mask & (1L << 30)) != 0L) + if ((in_mask2 & (1L << 10)) != 0L) value30 = *from_ptr++; - if ((in_mask & (1L << 31)) != 0L) + if ((in_mask2 & (1L << 11)) != 0L) value31 = *from_ptr++; - if ((in_mask & (1L << 32)) != 0L) + if ((in_mask2 & (1L << 12)) != 0L) value32 = *from_ptr++; - if ((in_mask & (1L << 33)) != 0L) + if ((in_mask2 & (1L << 13)) != 0L) value33 = *from_ptr++; - if ((in_mask & (1L << 34)) != 0L) + if ((in_mask2 & (1L << 14)) != 0L) value34 = *from_ptr++; - if ((in_mask & (1L << 35)) != 0L) + if ((in_mask2 & (1L << 15)) != 0L) value35 = *from_ptr++; - if ((in_mask & (1L << 36)) != 0L) + if ((in_mask2 & (1L << 16)) != 0L) value36 = *from_ptr++; - if ((in_mask & (1L << 37)) != 0L) + if ((in_mask2 & (1L << 17)) != 0L) value37 = *from_ptr++; - if ((in_mask & (1L << 38)) != 0L) + if ((in_mask2 & (1L << 18)) != 0L) value38 = *from_ptr++; - if ((in_mask & (1L << 39)) != 0L) + if ((in_mask2 & (1L << 19)) != 0L) value39 = *from_ptr++; out_mask = *out_mask_ptr++; + out_mask2 = *out_mask_ptr++; if ((out_mask & (1L << 0)) != 0L) *to_ptr++ = value00; @@ -545,64 +549,64 @@ load_store_df (unsigned long num, if ((out_mask & (1L << 19)) != 0L) *to_ptr++ = value19; - if ((out_mask & (1L << 20)) != 0L) + if ((out_mask2 & (1L << 0)) != 0L) *to_ptr++ = value20; - if ((out_mask & (1L << 21)) != 0L) + if ((out_mask2 & (1L << 1)) != 0L) *to_ptr++ = value21; - if ((out_mask & (1L << 22)) != 0L) + if ((out_mask2 & (1L << 2)) != 0L) *to_ptr++ = value22; - if ((out_mask & (1L << 23)) != 0L) + if ((out_mask2 & (1L << 3)) != 0L) *to_ptr++ = value23; - if ((out_mask & (1L << 24)) != 0L) + if ((out_mask2 & (1L << 4)) != 0L) *to_ptr++ = value24; - if ((out_mask & (1L << 25)) != 0L) + if ((out_mask2 & (1L << 5)) != 0L) *to_ptr++ = value25; - if ((out_mask & (1L << 26)) != 0L) + if ((out_mask2 & (1L << 6)) != 0L) *to_ptr++ = value26; - if ((out_mask & (1L << 27)) != 0L) + if ((out_mask2 & (1L << 7)) != 0L) *to_ptr++ = value27; - if ((out_mask & (1L << 28)) != 0L) + if ((out_mask2 & (1L << 8)) != 0L) *to_ptr++ = value28; - if ((out_mask & (1L << 29)) != 0L) + if ((out_mask2 & (1L << 9)) != 0L) *to_ptr++ = value29; - if ((out_mask & (1L << 30)) != 0L) + if ((out_mask2 & (1L << 10)) != 0L) *to_ptr++ = value30; - if ((out_mask & (1L << 31)) != 0L) + if ((out_mask2 & (1L << 11)) != 0L) *to_ptr++ = value31; - if ((out_mask & (1L << 32)) != 0L) + if ((out_mask2 & (1L << 12)) != 0L) *to_ptr++ = value32; - if ((out_mask & (1L << 33)) != 0L) + if ((out_mask2 & (1L << 13)) != 0L) *to_ptr++ = value33; - if ((out_mask & (1L << 34)) != 0L) + if ((out_mask2 & (1L << 14)) != 0L) *to_ptr++ = value34; - if ((out_mask & (1L << 35)) != 0L) + if ((out_mask2 & (1L << 15)) != 0L) *to_ptr++ = value35; - if ((out_mask & (1L << 36)) != 0L) + if ((out_mask2 & (1L << 16)) != 0L) *to_ptr++ = value36; - if ((out_mask & (1L << 37)) != 0L) + if ((out_mask2 & (1L << 17)) != 0L) *to_ptr++ = value37; - if ((out_mask & (1L << 38)) != 0L) + if ((out_mask2 & (1L << 18)) != 0L) *to_ptr++ = value38; - if ((out_mask & (1L << 39)) != 0L) + if ((out_mask2 & (1L << 19)) != 0L) *to_ptr++ = value39; } diff --git a/gcc/testsuite/gcc.target/powerpc/pr69946.c b/gcc/testsuite/gcc.target/powerpc/pr69946.c new file mode 100644 index 00000000000..eb0c365d137 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr69946.c @@ -0,0 +1,38 @@ +/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */ +/* { dg-skip-if "" { powerpc_elfv2 } } */ +/* { dg-options "-O2" } */ + +/* This generates a rotate:DI by 44, with mask 0xf00, which is implemented + using a rlwinm instruction. We used to write 44 for the shift count + there; it should be 12. */ + +struct A +{ + int a : 4; + int : 2; + int b : 2; + int : 2; + int c : 2; + int d : 1; + int e; +}; +struct B +{ + int a : 4; +} *a; +void bar (struct A); + +void +foo (void) +{ + struct B b = a[0]; + struct A c; + c.a = b.a; + c.b = 1; + c.c = 1; + c.d = 0; + bar (c); +} + +/* { dg-final { scan-assembler-not {(?n)rlwinm.*,44,20,23} } } */ +/* { dg-final { scan-assembler-times {(?n)rlwinm.*,12,20,23} 1 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/pr69969.c b/gcc/testsuite/gcc.target/powerpc/pr69969.c new file mode 100644 index 00000000000..1ca2c7581ef --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr69969.c @@ -0,0 +1,7 @@ +/* PR target/69969 */ +/* { dg-do compile } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ +/* { dg-options "-mcpu=power8" } */ + +int bar (int x) { return x; } +__attribute__((__target__("no-vsx"))) int foo (int x) { return x; } /* { dg-bogus "-mallow-movmisalign requires -mvsx" } */ diff --git a/gcc/testsuite/gcc.target/s390/pr69709.c b/gcc/testsuite/gcc.target/s390/pr69709.c new file mode 100644 index 00000000000..e9aa024521d --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/pr69709.c @@ -0,0 +1,39 @@ +/* PR69709 This testcase used to fail due to a broken risbg + splitter. */ + +/* { dg-do run } */ +/* { dg-options "-O3 -march=z10" } */ + + +typedef struct +{ + unsigned int sig[2]; +} +val_t; + +unsigned int __attribute__ ((noinline)) +div_significands (const val_t * a) +{ + val_t u = *a; + int bit = 64; + unsigned int r; + do + { + u.sig[1] = (u.sig[1] << 1) | (u.sig[0] >> 31); + u.sig[0] = 42; + + if (bit == 64) + r = u.sig[1]; + } + while (--bit >= 0); + return r; +} + +int +main (void) +{ + val_t a = { { 0x1, 0x1 } }; + if (div_significands (&a) != 2) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/sparc/20160229-1.c b/gcc/testsuite/gcc.target/sparc/20160229-1.c new file mode 100644 index 00000000000..c64b7a83540 --- /dev/null +++ b/gcc/testsuite/gcc.target/sparc/20160229-1.c @@ -0,0 +1,157 @@ +/* PR target/69706 */ +/* Reported by John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> */ + +/* { dg-do run } */ +/* { dg-options "-std=gnu99" } +/* { dg-require-effective-target lp64 } */ + +extern void abort (void); + + +/* Pass a 12-byte structure partially in slot #15 and on the stack. */ + +struct t_rgb { float r, g, b; }; + +void write_xpm (void *out, unsigned int flags, const char *title, + const char *legend, const char *label_x, const char *label_y, + int n_x, int n_y, float axis_x[], float axis_y[], float *mat[], + float lo, float hi, struct t_rgb rlo, struct t_rgb rhi) +{ + register float f30 asm ("f30"); + register float f31 asm ("f31"); + + if (f30 != 1.0f) + abort (); + + if (f31 != 2.0f) + abort (); + + if (rhi.r != 1.0f) + abort (); + + if (rhi.g != 2.0f) + abort (); + + if (rhi.b != 3.0f) + abort (); +} + + +/* Pass a 16-byte structure partially in slot #15 and on the stack. */ + +struct S1 { _Complex float f1; _Complex float f2; }; + +void f1 (int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8, + int p9, int p10, int p11, int p12, int p13, int p14, int p15, + struct S1 s1) +{ + register float f30 asm ("f30"); + register float f31 asm ("f31"); + + if (f30 != 4.0f) + abort (); + + if (f31 != 5.0f) + abort (); + + if (__real__ s1.f1 != 4.0f) + abort (); + + if (__imag__ s1.f1 != 5.0f) + abort (); + + if (__real__ s1.f2 != 6.0f) + abort (); + + if (__imag__ s1.f2 != 7.0f) + abort (); +} + + +/* Pass a 16-byte structure partially in slot #15 and on the stack. */ + +struct S2 { double d1; double d2; }; + +void f2 (int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8, + int p9, int p10, int p11, int p12, int p13, int p14, int p15, + struct S2 s2) +{ + register double d30 asm ("f30"); + + if (d30 != 1.0) + abort (); + + if (s2.d1 != 1.0) + abort (); + + if (s2.d2 != 2.0) + abort (); +} + + +/* Pass a 16-byte structure partially in slot #15 and on the stack. */ + +struct S3 { _Complex double d; }; + +void f3 (int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8, + int p9, int p10, int p11, int p12, int p13, int p14, int p15, + struct S3 s3) +{ + register double d30 asm ("f30"); + + if (d30 != 3.0) + abort (); + + if (__real__ s3.d != 3.0) + abort (); + + if (__imag__ s3.d != 4.0) + abort (); +} + + +/* Pass a 16-byte structure entirely on the stack. */ + +struct S4 { long l; double d; }; + +void f4 (int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8, + int p9, int p10, int p11, int p12, int p13, int p14, int p15, + struct S4 s4) +{ + if (s4.l != 5) + abort (); + + if (s4.d != 6.0) + abort (); +} + + +#define PI 3.141592654 + +int main (void) +{ + struct t_rgb lo = { -1.0f, -2.0f, -3.0f }; + struct t_rgb hi = { 1.0f, 2.0f, 3.0f }; + float arrf[1]; + float *arrp[1]; + struct S1 s1 = { 4.0f + 5.0fi, 6.0f + 7.0fi }; + struct S2 s2 = { 1.0, 2.0 }; + struct S3 s3 = { 3.0 + 4.0i }; + struct S4 s4 = { 5, 6.0 }; + register double d32 asm ("f32") = PI; + + write_xpm (0, 0, "", "", "", "", 0, 0, arrf, arrf, arrp, 0.0f, 0.0f, lo, hi); + + f1 (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, s1); + + f2 (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, s2); + + f3 (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, s3); + + f4 (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, s4); + + if (d32 != PI) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gfortran.dg/coarray_8.f90 b/gcc/testsuite/gfortran.dg/coarray_8.f90 index 91d6e9a57ab..db6eb6c2e2d 100644 --- a/gcc/testsuite/gfortran.dg/coarray_8.f90 +++ b/gcc/testsuite/gfortran.dg/coarray_8.f90 @@ -146,7 +146,7 @@ end module mmm4 subroutine tfgh() integer :: i(2) DATA i/(i, i=1,2)/ ! { dg-error "Expected PARAMETER symbol" } - do i = 1, 5 ! { dg-error "cannot be a sub-component" } + do i = 1, 5 ! { dg-error "cannot be an array" } end do ! { dg-error "Expecting END SUBROUTINE" } end subroutine tfgh diff --git a/gcc/testsuite/gfortran.dg/newunit_4.f90 b/gcc/testsuite/gfortran.dg/newunit_4.f90 new file mode 100644 index 00000000000..4d7d73826f7 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/newunit_4.f90 @@ -0,0 +1,7 @@ +! { dg-do compile } +! PR69110 ICE with NEWUNIT +subroutine open_file_safe(fname, fstatus, faction, fposition, funit) + character(*), intent(in) :: fname, fstatus, faction, fposition + integer, intent(out) :: funit + open(newunit=funit, status=fstatus) +end subroutine open_file_safe diff --git a/gcc/testsuite/gfortran.dg/pr56007.f b/gcc/testsuite/gfortran.dg/pr56007.f new file mode 100644 index 00000000000..644f28efe62 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr56007.f @@ -0,0 +1,10 @@ +! { dg-do compile } +! PR fortran/56007 +! Based on testcase by Tobias Schlüter + + integer iw1(90), doiw1(90) + do iw1(1)=1 + do iw1=1 + do iw1=1,2 ! { dg-error "cannot be an array" } + end do ! { dg-error "Expecting END PROGRAM statement" } + END diff --git a/gcc/testsuite/gfortran.dg/pr56007.f90 b/gcc/testsuite/gfortran.dg/pr56007.f90 new file mode 100644 index 00000000000..b91baf5b4e7 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr56007.f90 @@ -0,0 +1,11 @@ +! { dg-do compile } +! PR fortran/56007 +! Based on testcase by Tobias Schlüter + + integer iw1(90), doiw1(90) + do iw1=1,2 ! { dg-error "cannot be an array" } + end do ! { dg-error "Expecting END PROGRAM statement" } + do iw1(1)=1 ! { dg-error "Unclassifiable statement" } + do iw1=1 ! { dg-error "cannot be an array" } + end do ! { dg-error "Expecting END PROGRAM statement" } +END program diff --git a/gcc/testsuite/gfortran.dg/pr60126.f90 b/gcc/testsuite/gfortran.dg/pr60126.f90 new file mode 100644 index 00000000000..038f54456f4 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr60126.f90 @@ -0,0 +1,18 @@ +! { dg-do compile } +! PR fortran/60126 - ICE on pointer rank remapping +! Based on testcase by Michel Valin <mfvalin at gmail dot com> + +subroutine simple_bug_demo + implicit none + interface + function offset_ptr_R4(nelements) result (dest) + implicit none + real, pointer, dimension(:) :: dest + integer, intent(IN) :: nelements + end function offset_ptr_R4 + end interface + + real, dimension(:,:), pointer :: R2D + + R2D(-2:2,-3:3) => offset_ptr_R4(100) +end diff --git a/gcc/testsuite/gfortran.dg/realloc_on_assign_26.f90 b/gcc/testsuite/gfortran.dg/realloc_on_assign_26.f90 new file mode 100644 index 00000000000..4791c24e14f --- /dev/null +++ b/gcc/testsuite/gfortran.dg/realloc_on_assign_26.f90 @@ -0,0 +1,12 @@ +! { dg-do run } +! PR 68147 - no temprorary within the IF statement. +! Original test case by Martin Reinecke. +program test + implicit none + character(len=:),allocatable ::name + name="./a.out" + if (index(name,"/") /= 0) THEN + name=name(3:) + if (name .ne. "a.out") call abort + endif +end program diff --git a/gcc/testsuite/gfortran.dg/vect/pr69980.f90 b/gcc/testsuite/gfortran.dg/vect/pr69980.f90 new file mode 100644 index 00000000000..8a20b983f1b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/vect/pr69980.f90 @@ -0,0 +1,40 @@ +! { dg-do run } +! { dg-additional-options "-Ofast -fno-inline" } + +subroutine check (a, b) + real *8, intent(in) :: a(4), b(4) + + IF (abs(a(1)-b(1)) > 1) THEN + CALL ABORT + END IF +end subroutine check + +program main + real *8 :: mu(4,26), mumax(4), mumax2(4) + + integer :: i, k + + do k=1,26 + do i=1,4 + mu(i, k) = 4*(i-1) + k + end do + end do + + mumax = 0; + do k=1,26 + do i=1,3 + mumax(i) = max(mumax(i), mu(i,k)+mu(i,k)) + end do + end do + + mumax2 = 0; + do i=1,3 + do k=1,26 + mumax2(i) = max(mumax2(i), mu(i,k)+mu(i,k)) + end do + end do + + CALL check (mumax, mumax2) + + return +end program diff --git a/gcc/testsuite/gnat.dg/incomplete4.adb b/gcc/testsuite/gnat.dg/incomplete4.adb new file mode 100644 index 00000000000..2191d388a34 --- /dev/null +++ b/gcc/testsuite/gnat.dg/incomplete4.adb @@ -0,0 +1,10 @@ +-- { dg-do compile } + +with Incomplete4_Pkg; use Incomplete4_Pkg; +with System; + +procedure Incomplete4 is + L : System.Address := A'Address; +begin + null; +end; diff --git a/gcc/testsuite/gnat.dg/incomplete4_pkg.ads b/gcc/testsuite/gnat.dg/incomplete4_pkg.ads new file mode 100644 index 00000000000..992986ee105 --- /dev/null +++ b/gcc/testsuite/gnat.dg/incomplete4_pkg.ads @@ -0,0 +1,9 @@ +package Incomplete4_Pkg is + + type Circular_Type; + type Ptr is access Circular_Type; + type Circular_Type is array (1..100) of Ptr; + + A : Circular_Type; + +end Incomplete4_Pkg; diff --git a/gcc/testsuite/gnat.dg/renaming8.adb b/gcc/testsuite/gnat.dg/renaming8.adb new file mode 100644 index 00000000000..f41c8132ab0 --- /dev/null +++ b/gcc/testsuite/gnat.dg/renaming8.adb @@ -0,0 +1,11 @@ +-- { dg-do run } +-- { dg-options "-gnatp" } + +with Renaming8_Pkg1; use Renaming8_Pkg1; + +procedure Renaming8 is +begin + if not B then + raise Program_Error; + end if; +end; diff --git a/gcc/testsuite/gnat.dg/renaming8_pkg1.ads b/gcc/testsuite/gnat.dg/renaming8_pkg1.ads new file mode 100644 index 00000000000..ff5768cc49a --- /dev/null +++ b/gcc/testsuite/gnat.dg/renaming8_pkg1.ads @@ -0,0 +1,7 @@ +with Renaming8_Pkg2; use Renaming8_Pkg2; + +package Renaming8_Pkg1 is + + B: Boolean renames F.E(1); + +end Renaming8_Pkg1; diff --git a/gcc/testsuite/gnat.dg/renaming8_pkg2.adb b/gcc/testsuite/gnat.dg/renaming8_pkg2.adb new file mode 100644 index 00000000000..c135b392f0b --- /dev/null +++ b/gcc/testsuite/gnat.dg/renaming8_pkg2.adb @@ -0,0 +1,8 @@ +package body Renaming8_Pkg2 is + + function F return Rec is + begin + return (E => (others => True)); + end; + +end Renaming8_Pkg2; diff --git a/gcc/testsuite/gnat.dg/renaming8_pkg2.ads b/gcc/testsuite/gnat.dg/renaming8_pkg2.ads new file mode 100644 index 00000000000..5d117dbfc26 --- /dev/null +++ b/gcc/testsuite/gnat.dg/renaming8_pkg2.ads @@ -0,0 +1,13 @@ +with Renaming8_Pkg3; use Renaming8_Pkg3; + +package Renaming8_Pkg2 is + + type Arr is array (Positive range 1 .. Last_Index) of Boolean; + + type Rec is record + E : Arr; + end record; + + function F return Rec; + +end Renaming8_Pkg2; diff --git a/gcc/testsuite/gnat.dg/renaming8_pkg3.adb b/gcc/testsuite/gnat.dg/renaming8_pkg3.adb new file mode 100644 index 00000000000..c17786b4ef0 --- /dev/null +++ b/gcc/testsuite/gnat.dg/renaming8_pkg3.adb @@ -0,0 +1,8 @@ +package body Renaming8_Pkg3 is + + function Last_Index return Integer is + begin + return 16; + end; + +end Renaming8_Pkg3; diff --git a/gcc/testsuite/gnat.dg/renaming8_pkg3.ads b/gcc/testsuite/gnat.dg/renaming8_pkg3.ads new file mode 100644 index 00000000000..dda81015189 --- /dev/null +++ b/gcc/testsuite/gnat.dg/renaming8_pkg3.ads @@ -0,0 +1,5 @@ +package Renaming8_Pkg3 is + + function Last_Index return Integer; + +end Renaming8_Pkg3; diff --git a/gcc/testsuite/gnat.dg/stack_usage3.adb b/gcc/testsuite/gnat.dg/stack_usage3.adb new file mode 100644 index 00000000000..fcc5cacf707 --- /dev/null +++ b/gcc/testsuite/gnat.dg/stack_usage3.adb @@ -0,0 +1,28 @@ +-- { dg-do compile } +-- { dg-options "-O -fstack-usage" } + +with Ada.Text_IO; use Ada.Text_IO; +with Stack_Usage3_Pkg; use Stack_Usage3_Pkg; + +procedure Stack_Usage3 is + +begin + Put_Line (Diag ("Diag line 0")); + Put_Line (Diag ("Diag line 1")); + Put_Line (Diag ("Diag line 2")); + Put_Line (Diag ("Diag line 3")); + Put_Line (Diag ("Diag line 4")); + Put_Line (Diag ("Diag line 5")); + Put_Line (Diag ("Diag line 6")); + Put_Line (Diag ("Diag line 7")); + Put_Line (Diag ("Diag line 8")); + Put_Line (Diag ("Diag line 9")); + Put_Line (Diag ("Diag line 10")); + Put_Line (Diag ("Diag line 11")); + Put_Line (Diag ("Diag line 12")); + Put_Line (Diag ("Diag line 13")); + Put_Line (Diag ("Diag line 14")); +end; + +-- { dg-final { scan-stack-usage "\t\[0-9\]\[0-9\]\t" { target i?86-*-* x86_64-*-* } } } +-- { dg-final { cleanup-stack-usage } } diff --git a/gcc/testsuite/gnat.dg/stack_usage3_pkg.ads b/gcc/testsuite/gnat.dg/stack_usage3_pkg.ads new file mode 100644 index 00000000000..e4a80c3ff71 --- /dev/null +++ b/gcc/testsuite/gnat.dg/stack_usage3_pkg.ads @@ -0,0 +1,7 @@ +package Stack_Usage3_Pkg is + + subtype Small_String is String (1..80); + + function Diag (S : String) return Small_String; + +end Stack_Usage3_Pkg; |