diff options
Diffstat (limited to 'gcc/testsuite')
38 files changed, 830 insertions, 14 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6231db2965c..ca5c35adce8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,128 @@ +2012-04-03 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/pack18.adb: New test. + * gnat.dg/pack18_pkg.ads: New helper. + +2012-04-03 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/52808 + * gcc.dg/pr52808.c: New testcase. + +2012-04-03 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/52835 + * gfortran.dg/pr52835.f90: New test. + +2012-04-03 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/specs/aggr5.ads: New test. + +2012-04-02 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/52756 + * gcc.dg/torture/pr52756.c: New testcase. + +2012-04-02 Richard Guenther <rguenther@suse.de> + + PR middle-end/52803 + * gcc.dg/pr52803.c: New testcase. + +2012-04-02 Dodji Seketeli <dodji@redhat.com> + + PR c++/40942 + * g++.old-deja/g++.pt/spec40.C: Adjust to take the resolution of + DR 214 in account. + +2012-04-01 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/50043 + * g++.dg/cpp0x/noexcept17.C: New. + * g++.old-deja/g++.eh/cleanup1.C: Adjust. + * g++.dg/tree-ssa/ehcleanup-1.C: Likewise. + * g++.dg/cpp0x/noexcept01.C: Likewise. + * g++.dg/eh/init-temp1.C: Likewise. + * g++.dg/eh/ctor1.C: Likwise. + +2012-03-31 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/controlled6.adb: New test. + * gnat.dg/controlled6_pkg.ads: New helper. + * gnat.dg/controlled6_pkg-iterators.ad[sb]: Likewise. + +2012-03-30 Richard Henderson <rth@redhat.com> + + PR debug/52727 + * g++.dg/opt/pr52727.C: New testcase. + +2012-03-30 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/52754 + * gcc.target/i386/pr52754.c: New testcase. + +2012-03-30 Richard Guenther <rguenther@suse.de> + + PR middle-end/52772 + * g++.dg/torture/pr52772.C: New testcase. + +2012-03-29 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/52718 + * g++.dg/warn/Wzero-as-null-pointer-constant-5.C: New. + +2012-03-29 Jason Merrill <jason@redhat.com> + + PR c++/52685 + * g++.dg/template/inherit8.C: New. + +2012-03-29 Jakub Jelinek <jakub@redhat.com> + + PR c++/52759 + * g++.dg/ext/weak4.C: New test. + + PR tree-optimization/52760 + * gcc.c-torture/execute/pr52760.c: New test. + +2012-03-29 Jason Merrill <jason@redhat.com> + + PR c++/52743 + * g++.dg/cpp0x/initlist-array3.C: New. + +2012-03-28 Jason Merrill <jason@redhat.com> + + PR c++/52746 + * g++.dg/overload/virtual2.C: New. + +2012-03-28 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/vect7.ad[sb]: New test. + +2012-03-28 Paul Thomas <pault@gcc.gnu.org> + Tobias Burnus <burnus@gcc.gnu.org> + + PR fortran/52652 + * gfortran.dg/allocate_class_1.f90 : Change error test. + * gfortran.dg/allocate_with_typespec_4.f90 : Change error test. + * gfortran.dg/allocate_alloc_opt_1.f90 : Change error test. + * gfortran.dg/deallocate_alloc_opt_1.f90 : Change error test. + +2012-03-28 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/52691 + * gcc.dg/pr52691.c: New test. + + PR middle-end/52750 + * gcc.c-torture/compile/pr52750.c: New test. + +2012-03-28 Georg-Johann Lay <avr@gjlay.de> + + PR target/52692 + * gcc.target/avr/torture/builtins-2.c: New test. + +2012-03-28 Jakub Jelinek <jakub@redhat.com> + + PR target/52736 + * gcc.target/i386/pr52736.c: New test. + 2012-03-27 Martin Jambor <mjambor@suse.cz> PR middle-end/52693 diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist-array3.C b/gcc/testsuite/g++.dg/cpp0x/initlist-array3.C new file mode 100644 index 00000000000..1a94f4ed55b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist-array3.C @@ -0,0 +1,10 @@ +// PR c++/52743 +// { dg-do compile { target c++11 } } + +void composite (int const (&) [2]); +void composite (int const (&) [3]); + +int main () +{ + composite({0,1}); // { dg-error "ambiguous" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept01.C b/gcc/testsuite/g++.dg/cpp0x/noexcept01.C index f314684eae8..b6be1ef7a3f 100644 --- a/gcc/testsuite/g++.dg/cpp0x/noexcept01.C +++ b/gcc/testsuite/g++.dg/cpp0x/noexcept01.C @@ -50,7 +50,7 @@ struct E ~E(); }; -SA (!noexcept (E())); +SA (noexcept (E())); struct F { @@ -74,7 +74,7 @@ void tf() } template void tf<int,true>(); -template void tf<E, false>(); +template void tf<E, true>(); // Make sure that noexcept uses the declared exception-specification, not // any knowledge we might have about whether or not the function really diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept17.C b/gcc/testsuite/g++.dg/cpp0x/noexcept17.C new file mode 100644 index 00000000000..82cd844c067 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/noexcept17.C @@ -0,0 +1,54 @@ +// PR c++/50043 +// { dg-options -std=c++11 } + +struct True1 {}; +struct True2 { ~True2(); }; +struct True3 { ~True3(){ throw 0; } }; +struct False { ~False() noexcept(false); }; + +template <typename Base> +struct A : Base +{ +}; + +template <typename Member> +struct B +{ + Member mem; +}; + +template <typename Base, typename Member> +struct C : Base +{ + Member mem; +}; + +#define SA(X) static_assert(X, #X) + +SA( noexcept(True1())); +SA( noexcept(True2())); +SA( noexcept(True3())); +SA(!noexcept(False())); + +SA( noexcept(A<True1>())); +SA( noexcept(A<True2>())); +SA( noexcept(A<True3>())); +SA(!noexcept(A<False>())); + +SA( noexcept(B<True1>())); +SA( noexcept(B<True2>())); +SA( noexcept(B<True3>())); +SA(!noexcept(B<False>())); + +SA( noexcept(C<True1, True2>())); +SA( noexcept(C<True1, True3>())); +SA( noexcept(C<True2, True3>())); +SA( noexcept(C<True2, True1>())); +SA( noexcept(C<True3, True1>())); +SA( noexcept(C<True3, True2>())); +SA(!noexcept(C<False, True1>())); +SA(!noexcept(C<False, True2>())); +SA(!noexcept(C<False, True3>())); +SA(!noexcept(C<True1, False>())); +SA(!noexcept(C<True2, False>())); +SA(!noexcept(C<True3, False>())); diff --git a/gcc/testsuite/g++.dg/eh/ctor1.C b/gcc/testsuite/g++.dg/eh/ctor1.C index 43b735f0b00..b959d1c5620 100644 --- a/gcc/testsuite/g++.dg/eh/ctor1.C +++ b/gcc/testsuite/g++.dg/eh/ctor1.C @@ -5,6 +5,12 @@ // PR 411 +#ifdef __GXX_EXPERIMENTAL_CXX0X__ +#define NOEXCEPT_FALSE noexcept (false) +#else +#define NOEXCEPT_FALSE +#endif + bool was_f_in_Bar_destroyed=false; struct Foo @@ -17,7 +23,7 @@ struct Foo struct Bar { - ~Bar() + ~Bar() NOEXCEPT_FALSE { throw 1; } diff --git a/gcc/testsuite/g++.dg/eh/init-temp1.C b/gcc/testsuite/g++.dg/eh/init-temp1.C index 529014f497f..4996cea230f 100644 --- a/gcc/testsuite/g++.dg/eh/init-temp1.C +++ b/gcc/testsuite/g++.dg/eh/init-temp1.C @@ -1,6 +1,12 @@ // PR c++/15764 // { dg-do run } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ +#define NOEXCEPT_FALSE noexcept (false) +#else +#define NOEXCEPT_FALSE +#endif + extern "C" void abort (); int thrown; @@ -8,7 +14,7 @@ int thrown; int as; struct a { a () { ++as; } - ~a () { --as; if (thrown++ == 0) throw 42; } + ~a () NOEXCEPT_FALSE { --as; if (thrown++ == 0) throw 42; } }; int f (a const&) { return 1; } diff --git a/gcc/testsuite/g++.dg/ext/weak4.C b/gcc/testsuite/g++.dg/ext/weak4.C new file mode 100644 index 00000000000..5b3cce05cd9 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/weak4.C @@ -0,0 +1,9 @@ +// PR c++/52759 +// { dg-do compile } +// { dg-require-weak "" } +// { dg-options "" } +#pragma weak foo +template <typename T> +struct A { }; +template <typename T> +void bar (A<T> &); diff --git a/gcc/testsuite/g++.dg/opt/pr52727.C b/gcc/testsuite/g++.dg/opt/pr52727.C new file mode 100644 index 00000000000..4dd38530a02 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr52727.C @@ -0,0 +1,45 @@ +// { dg-do compile } +// { dg-options "-g -Os" } + +int grow (int); +void fn (int); +struct A { int a1, a2; }; +template <typename T> +struct B +{ + A *b; + ~B () { b3 (b); } + void b1 (int); + void b2 (int); + void b3 (A *); +}; +struct C { int c1, c2, c3; bool c4; }; +int +bar (int x) +{ + int y = x / 6; + if (y > x / 2) + return y; + return 0; +} +void baz (double, double); +void +foo (const C *x, int y, int z) +{ + B<int> p; + double r = y / 2; + int w = bar (int (r)); + double s = y / 2 + 0.5; + double t = z / 2 + 0.5; + int u = x->c3; + int v = (x->c2 + u - 1 - x->c1) / u; + p.b2 ((2 * v > p.b->a1 || (2 * v < p.b->a2 && 2 * v < (p.b->a1 >> 1))) + ? grow (0) : p.b->a1); + for (int i = 0; i <= v; ++i) + { + double l = x->c4 ? 4.5 - i * 6.2 / v : (3.1 - i * 31 / v) / 6; + baz (s + (r - w) * l, t - (r - w) * l); + } +} + + diff --git a/gcc/testsuite/g++.dg/overload/virtual2.C b/gcc/testsuite/g++.dg/overload/virtual2.C new file mode 100644 index 00000000000..c93ba9e2988 --- /dev/null +++ b/gcc/testsuite/g++.dg/overload/virtual2.C @@ -0,0 +1,31 @@ +// PR c++/52746 +// { dg-do run } + +extern "C" int printf(const char*,...); +extern "C" void abort(); +bool db; + +struct A +{ + virtual ~A() {} +}; + +struct B : public A +{ + virtual ~B() { db = true; } +}; + +template<int> void test() +{ + B * b = new B; + A * a = b; + a->~A(); + ::operator delete(b); +} + +int main() +{ + test<0>(); + if (!db) + abort(); +} diff --git a/gcc/testsuite/g++.dg/template/inherit8.C b/gcc/testsuite/g++.dg/template/inherit8.C new file mode 100644 index 00000000000..a9b2bdb5601 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/inherit8.C @@ -0,0 +1,13 @@ +// PR c++/52685 + +template <typename T> +struct A +{ + template <typename U> + struct B : public A <B<U> > + { + struct C : public B<U> + { + }; + }; +}; diff --git a/gcc/testsuite/g++.dg/torture/pr52772.C b/gcc/testsuite/g++.dg/torture/pr52772.C new file mode 100644 index 00000000000..810e6579fba --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr52772.C @@ -0,0 +1,85 @@ +// { dg-do compile } + +typedef __SIZE_TYPE__ size_t; + +class c1; + +class c2 { + public: c2() { }; + void *operator new(size_t size, const c1 & crc1); +}; + +class c3 { + public: c3() { _Obj = 0; } + ~c3() { if (_Obj) delete _Obj; } + void set(c2 *pObj); + protected: c2 *_Obj; +}; + +void c3::set(c2 *pObj) { _Obj = pObj; }; + +template<class TYPE> class tc1 : public c2 { + public: tc1(int n=0){}; + int get() const; + TYPE& operator[] (int id); + TYPE * _data; + int _size; +}; + +template<class TYPE> TYPE & tc1<TYPE>::operator[] (int id) { + return _data[id]; +} + +template<class TYPE> int tc1<TYPE>::get() const { + return _size; +} + +class c4 { + public: c4(); +}; + +class c5 : public c2 { + protected: c2 * _own; + public: c5(c2 *o) : _own(o) { } + c5(const c4 & box); + int add(const c4 & ext); +}; + +class c6 { + public: int get() const {}; +}; + +class c7 { + friend class c8; + int find(c6 * loop) const; +}; + +class c8 { + const c1 & _rc1; + int tria(c7 * face, c5 * vtree0 = 0); +}; + +int c8::tria(c7 * face, c5 * vtree0) { + c6 *sLData[64]; + tc1<c6*> loops(64); + while (loops.get() > 1) { + c6 *iloop = 0; + for (int j=1; j<loops.get(); j++) { + if (loops[j]->get() < 32) { + iloop = loops[j]; + } + } + face->find(iloop); + } + c4 box; + c3 ctree; + c5 *vtree = vtree0; + if (!vtree) { + vtree = new (_rc1) c5(box); + ctree.set(vtree); + for (int j=0; j<1; j++) { + c4 sVBBox; + vtree->add(sVBBox); + } + } +} diff --git a/gcc/testsuite/g++.dg/tree-ssa/ehcleanup-1.C b/gcc/testsuite/g++.dg/tree-ssa/ehcleanup-1.C index cc492a80975..0a29ce9cb4f 100644 --- a/gcc/testsuite/g++.dg/tree-ssa/ehcleanup-1.C +++ b/gcc/testsuite/g++.dg/tree-ssa/ehcleanup-1.C @@ -1,9 +1,16 @@ // { dg-options "-O2 -fdump-tree-ehcleanup1-details" } + +#ifdef __GXX_EXPERIMENTAL_CXX0X__ +#define NOEXCEPT_FALSE noexcept (false) +#else +#define NOEXCEPT_FALSE +#endif + extern void can_throw (); class a { public: - ~a () + ~a () NOEXCEPT_FALSE { if (0) can_throw (); diff --git a/gcc/testsuite/g++.dg/warn/Wzero-as-null-pointer-constant-5.C b/gcc/testsuite/g++.dg/warn/Wzero-as-null-pointer-constant-5.C new file mode 100644 index 00000000000..185d2b5c4ee --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wzero-as-null-pointer-constant-5.C @@ -0,0 +1,20 @@ +// PR c++/52718 +// { dg-options "-Wzero-as-null-pointer-constant" } + +struct foo +{ + foo(void* a = 0) {}; // { dg-warning "zero as null pointer" } +}; + +void* fun(void* a = 0) {}; // { dg-warning "zero as null pointer" } + +struct bar: foo +{ + bar() {}; +}; + +struct baz +{ + baz(const foo& f1 = foo(), + void* f2 = fun()) {}; +}; diff --git a/gcc/testsuite/g++.old-deja/g++.eh/cleanup1.C b/gcc/testsuite/g++.old-deja/g++.eh/cleanup1.C index 16646438ed2..12f1ec7a081 100644 --- a/gcc/testsuite/g++.old-deja/g++.eh/cleanup1.C +++ b/gcc/testsuite/g++.old-deja/g++.eh/cleanup1.C @@ -2,6 +2,12 @@ // Bug: obj gets destroyed twice because the fixups for the return are // inside its cleanup region. +#ifdef __GXX_EXPERIMENTAL_CXX0X__ +#define NOEXCEPT_FALSE noexcept (false) +#else +#define NOEXCEPT_FALSE +#endif + extern "C" int printf (const char *, ...); int d; @@ -9,7 +15,7 @@ int d; struct myExc { }; struct myExcRaiser { - ~myExcRaiser() { throw myExc(); } + ~myExcRaiser() NOEXCEPT_FALSE { throw myExc(); } }; struct stackObj { diff --git a/gcc/testsuite/g++.old-deja/g++.pt/spec40.C b/gcc/testsuite/g++.old-deja/g++.pt/spec40.C index 70abb6fc50f..fc37f412b7e 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/spec40.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/spec40.C @@ -1,14 +1,33 @@ -// { dg-do run } +// { dg-do compile } // Copyright (C) 2000 Free Software Foundation, Inc. // Contributed by Nathan Sidwell 12 Feb 2001 <nathan@codesourcery.com> -// More from bug 1617. We didn't resolve partial ordering properly. The -// std is rather vague about it anyway, DR 214 talks about this. +// More from bug 1617. The resolution of DR 214 implies that the below +// call to Foo is ambiguous. +// +// The type transformation (on the function parameter of Foo) allowed +// in the context of partial ordering of the Foo template overloads is +// the following ([temp.deduct.partial]/5): +// +// Before the partial ordering is done, certain transformations +// are performed on the types used for partial ordering: +// +// - If P is a reference type, P is replaced by the type +// referred to. +// +// - If A is a reference type, A is replaced by the type +// referred to. +// +// It follows that we are not allowed to apply array-to-pointer +// decay conversion to the type of the function parameter +// 'char const (&)[I]'. So the two Foo specializations should +// be considered unrelated. Thus the partial ordering of the two +// Foo specializations should fail. template <typename T> int Foo (T const *) {return 1;} template <unsigned I> int Foo (char const (&)[I]) {return 2;} int main () { - return Foo ("a") != 2; + return Foo ("a") != 2; // { dg-error "call of overloaded \[^\n\r\]* is ambiguous" } } diff --git a/gcc/testsuite/gcc.c-torture/compile/pr52750.c b/gcc/testsuite/gcc.c-torture/compile/pr52750.c new file mode 100644 index 00000000000..36391bac5d9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr52750.c @@ -0,0 +1,11 @@ +/* PR middle-end/52750 */ + +typedef signed char V __attribute__((vector_size (32))); + +void +foo (V *x) +{ + V m = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31}; + *x = __builtin_shuffle (*x, m); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr52760.c b/gcc/testsuite/gcc.c-torture/execute/pr52760.c new file mode 100644 index 00000000000..1413c5f275a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr52760.c @@ -0,0 +1,27 @@ +/* PR tree-optimization/52760 */ + +struct T { unsigned short a, b, c, d; }; + +__attribute__((noinline, noclone)) void +foo (int x, struct T *y) +{ + int i; + + for (i = 0; i < x; i++) + { + y[i].a = ((0x00ff & y[i].a >> 8) | (0xff00 & y[i].a << 8)); + y[i].b = ((0x00ff & y[i].b >> 8) | (0xff00 & y[i].b << 8)); + y[i].c = ((0x00ff & y[i].c >> 8) | (0xff00 & y[i].c << 8)); + y[i].d = ((0x00ff & y[i].d >> 8) | (0xff00 & y[i].d << 8)); + } +} + +int +main () +{ + struct T t = { 0x0001, 0x0203, 0x0405, 0x0607 }; + foo (1, &t); + if (t.a != 0x0100 || t.b != 0x0302 || t.c != 0x0504 || t.d != 0x0706) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/pr52691.c b/gcc/testsuite/gcc.dg/pr52691.c new file mode 100644 index 00000000000..7a2d7d8ebb1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr52691.c @@ -0,0 +1,24 @@ +/* PR middle-end/52691 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +#include <stdarg.h> + +int +foo (int a, ...) +{ + int b = 0, c = 0; + va_list ap; + va_start (ap, a); + if (a > 1) + b = va_arg (ap, double); + if (a > 2) + c = va_arg (ap, long long); + va_end (ap); + return a + b + c; +} + +/* { dg-final { scan-tree-dump "__builtin_next_arg" "optimized" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */ +/* { dg-final { scan-tree-dump "__builtin_next_arg" "optimized" { target { powerpc*-*-darwin* powerpc*-*-aix* } } } } */ +/* { dg-final { scan-tree-dump "__builtin_next_arg" "optimized" { target { powerpc*-*-linux* && lp64 } } } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/pr52803.c b/gcc/testsuite/gcc.dg/pr52803.c new file mode 100644 index 00000000000..6774b0c6d21 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr52803.c @@ -0,0 +1,4 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fno-move-loop-invariants" } */ + +int main () { return 0; } diff --git a/gcc/testsuite/gcc.dg/pr52808.c b/gcc/testsuite/gcc.dg/pr52808.c new file mode 100644 index 00000000000..b731cb40133 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr52808.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O -ftracer" } */ + +int **fn1 () __attribute__ ((__const__)); +int main () +{ + int i; + i = 0; + for (;; i++) + if (*fn1 ()[i] && !'a' <= 0 && i <= 'z' || *fn1 ()[0] && 'a' <= 'z') + return; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr52756.c b/gcc/testsuite/gcc.dg/torture/pr52756.c new file mode 100644 index 00000000000..175b414e17d --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr52756.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ + +void Env_FetchObj0AttrOffset (unsigned int NumFields, int *Status) +{ + int Found = 0; + if (NumFields) + while ((*Status == 0) && NumFields-- > 0 && Found == 0) + Found = 1; +} diff --git a/gcc/testsuite/gcc.target/avr/torture/builtins-2.c b/gcc/testsuite/gcc.target/avr/torture/builtins-2.c new file mode 100644 index 00000000000..ae207d9a939 --- /dev/null +++ b/gcc/testsuite/gcc.target/avr/torture/builtins-2.c @@ -0,0 +1,46 @@ +/* { dg-options "-std=gnu99 -Tavr51-flash1.x" } */ +/* { dg-do run } */ + +#include <stdlib.h> +#include "../progmem.h" + +int volatile a; + +void f1 (void) +{ + __builtin_avr_sei (); + __builtin_avr_cli (); + __builtin_avr_wdr (); + __builtin_avr_sleep (); + __builtin_avr_nop (); + a = __builtin_avr_swap (a); + a = __builtin_avr_fmul (1,a); + a = __builtin_avr_fmuls (1,a); + a = __builtin_avr_fmulsu (1,a); + a = __builtin_avr_insert_bits (0x1f2f5364, a, a); +} + +const __flash char c0 = 1; +const __flash1 char c1 = 1; + +int main (void) +{ + const __memx void *p; + + f1(); + __builtin_avr_delay_cycles (1000); + + p = &c0; + if (__builtin_avr_flash_segment (p) != 0) + abort(); + + p = &c1; + if (__builtin_avr_flash_segment (p) != 1) + abort(); + + if (__builtin_avr_flash_segment ("p") != -1) + abort(); + + exit (0); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/pr52736.c b/gcc/testsuite/gcc.target/i386/pr52736.c new file mode 100644 index 00000000000..f35c1fd6c66 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr52736.c @@ -0,0 +1,29 @@ +/* PR target/52736 */ +/* { dg-do run } */ +/* { dg-options "-O1 -msse2" } */ +/* { dg-require-effective-target sse2_runtime } */ + +#include <x86intrin.h> + +typedef double D __attribute__((may_alias)); +__attribute__((aligned(16))) static const double r[4] = { 1., 5., 1., 3. }; + +__attribute__((noinline, noclone)) +void +foo (int x) +{ + asm volatile ("" : "+g" (x) : : "memory"); + if (x != 3) + __builtin_abort (); +} + +int +main () +{ + __m128d t = _mm_set1_pd (5.); + ((D *)(&t))[0] = 1.; + foo (_mm_movemask_pd (_mm_cmpeq_pd (t, _mm_load_pd (&r[0])))); + ((D *)(&t))[1] = 3.; + foo (_mm_movemask_pd (_mm_cmpeq_pd (t, _mm_load_pd (&r[2])))); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/pr52754.c b/gcc/testsuite/gcc.target/i386/pr52754.c new file mode 100644 index 00000000000..0f2dbff2dd7 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr52754.c @@ -0,0 +1,33 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -fpredictive-commoning -msse2 -std=c99" } */ +/* { dg-require-effective-target sse2 } */ + +#include <x86intrin.h> + +#include "isa-check.h" +#include "sse-os-support.h" + +int main() +{ + const float mem[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; + + unsigned int indexes[8]; + for (unsigned int i = 0; i < 8; ++i) indexes[i] = i; + + check_isa (); + + if (!sse_os_support ()) + exit (0); + + __m128 x = _mm_setr_ps(0, 1, 2, 3); + for (unsigned int i = 0; i + 4 < 6; ++i) { + const unsigned int *ii = &indexes[i]; + const __m128 tmp = _mm_setr_ps(mem[ii[0]], mem[ii[1]], mem[ii[2]], mem[ii[3]]); + if (0xf != _mm_movemask_ps(_mm_cmpeq_ps(tmp, x))) { + __builtin_abort(); + } + x = _mm_add_ps(x, _mm_set1_ps(1)); + } + + return 0; +} diff --git a/gcc/testsuite/gfortran.dg/allocate_alloc_opt_1.f90 b/gcc/testsuite/gfortran.dg/allocate_alloc_opt_1.f90 index 52e0262f4e6..3a05e8cff02 100644 --- a/gcc/testsuite/gfortran.dg/allocate_alloc_opt_1.f90 +++ b/gcc/testsuite/gfortran.dg/allocate_alloc_opt_1.f90 @@ -24,7 +24,7 @@ program a allocate(i(2), errmsg=err) ! { dg-warning "useless without a STAT" } allocate(i(2), stat=j, errmsg=x) ! { dg-error "must be a scalar CHARACTER" } - allocate(err) ! { dg-error "nonprocedure pointer or an allocatable" } + allocate(err) ! { dg-error "neither a nonprocedure pointer nor an allocatable" } allocate(error(2),stat=j,errmsg=error(1)) ! { dg-error "shall not be ALLOCATEd within" } allocate(i(2), stat = i(1)) ! { dg-error "shall not be ALLOCATEd within" } diff --git a/gcc/testsuite/gfortran.dg/allocate_class_1.f90 b/gcc/testsuite/gfortran.dg/allocate_class_1.f90 index 1dea056b74f..9a2a5cb2538 100644 --- a/gcc/testsuite/gfortran.dg/allocate_class_1.f90 +++ b/gcc/testsuite/gfortran.dg/allocate_class_1.f90 @@ -7,5 +7,5 @@ type :: t0 end type class(t0) :: x ! { dg-error "must be dummy, allocatable or pointer" } - allocate(x) ! { dg-error "is not a nonprocedure pointer or an allocatable variable" } + allocate(x) ! { dg-error "is neither a nonprocedure pointer nor an allocatable variable" } end diff --git a/gcc/testsuite/gfortran.dg/allocate_with_typespec_4.f90 b/gcc/testsuite/gfortran.dg/allocate_with_typespec_4.f90 index 327f28dcdc9..54ed109fc24 100644 --- a/gcc/testsuite/gfortran.dg/allocate_with_typespec_4.f90 +++ b/gcc/testsuite/gfortran.dg/allocate_with_typespec_4.f90 @@ -21,7 +21,7 @@ subroutine not_an_f03_intrinsic allocate(real*8 :: y(1)) ! { dg-error "Invalid type-spec at" } allocate(real*4 :: x8) ! { dg-error "Invalid type-spec at" } allocate(real*4 :: y8(1)) ! { dg-error "Invalid type-spec at" } - allocate(double complex :: d1) ! { dg-error "not a nonprocedure pointer or an allocatable" } + allocate(double complex :: d1) ! { dg-error "neither a nonprocedure pointer nor an allocatable" } allocate(real_type :: b) allocate(real_type :: c(1)) diff --git a/gcc/testsuite/gfortran.dg/deallocate_alloc_opt_1.f90 b/gcc/testsuite/gfortran.dg/deallocate_alloc_opt_1.f90 index 5c00741f61c..969ce257efe 100644 --- a/gcc/testsuite/gfortran.dg/deallocate_alloc_opt_1.f90 +++ b/gcc/testsuite/gfortran.dg/deallocate_alloc_opt_1.f90 @@ -24,7 +24,7 @@ program a deallocate(i, errmsg=err) ! { dg-warning "useless without a STAT" } deallocate(i, stat=j, errmsg=x) ! { dg-error "must be a scalar CHARACTER" } - deallocate(err) ! { dg-error "nonprocedure pointer or an allocatable" } + deallocate(err) ! { dg-error "nonprocedure pointer nor an allocatable" } deallocate(error,stat=j,errmsg=error(1)) ! { dg-error "shall not be DEALLOCATEd within" } deallocate(i, stat = i(1)) ! { dg-error "shall not be DEALLOCATEd within" } diff --git a/gcc/testsuite/gfortran.dg/pr52835.f90 b/gcc/testsuite/gfortran.dg/pr52835.f90 new file mode 100644 index 00000000000..a72951ab6ee --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr52835.f90 @@ -0,0 +1,16 @@ +! PR tree-optimization/52835 +! { dg-do compile } +! { dg-options "-O3 -fdump-tree-optimized" } + +subroutine foo (x, y, z, n) + integer :: n, i + real :: x(n), y(n), z(n) + do i = 1, n + z(i) = 0.0 + y(i) = 0.0 + call bar (y(i), z(i), x(i)) + end do +end subroutine + +! { dg-final { scan-tree-dump "bar " "optimized" } } +! { dg-final { cleanup-tree-dump "optimized" } } diff --git a/gcc/testsuite/gnat.dg/controlled6.adb b/gcc/testsuite/gnat.dg/controlled6.adb new file mode 100644 index 00000000000..88640de7bea --- /dev/null +++ b/gcc/testsuite/gnat.dg/controlled6.adb @@ -0,0 +1,24 @@ +-- { dg-do compile } +-- { dg-options "-O -gnatn" } + +with Ada.Text_IO; use Ada.Text_IO; +with Controlled6_Pkg; +with Controlled6_Pkg.Iterators; + +procedure Controlled6 is + + type String_Access is access String; + + package My_Q is new Controlled6_Pkg (String_Access); + package My_Iterators is new My_Q.Iterators (0); + use My_Iterators; + + Iterator : Iterator_Type := Find; + +begin + loop + exit when Is_Null (Iterator); + Put (Current (Iterator).all & ' '); + Find_Next (Iterator); + end loop; +end; diff --git a/gcc/testsuite/gnat.dg/controlled6_pkg-iterators.adb b/gcc/testsuite/gnat.dg/controlled6_pkg-iterators.adb new file mode 100644 index 00000000000..201a75c94cc --- /dev/null +++ b/gcc/testsuite/gnat.dg/controlled6_pkg-iterators.adb @@ -0,0 +1,21 @@ +package body Controlled6_Pkg.Iterators is + + function Find return Iterator_Type is + Iterator : Iterator_Type; + begin + return Iterator; + end Find; + + function Current (Iterator : in Iterator_Type) return T is begin + return Iterator.Current.Item; + end Current; + + procedure Find_Next (Iterator : in out Iterator_Type) is begin + Iterator.Current := null; + end Find_Next; + + function Is_Null (Iterator : in Iterator_Type) return Boolean is begin + return Iterator.Current = null; + end Is_Null; + +end Controlled6_Pkg.Iterators; diff --git a/gcc/testsuite/gnat.dg/controlled6_pkg-iterators.ads b/gcc/testsuite/gnat.dg/controlled6_pkg-iterators.ads new file mode 100644 index 00000000000..89330f6a3ba --- /dev/null +++ b/gcc/testsuite/gnat.dg/controlled6_pkg-iterators.ads @@ -0,0 +1,22 @@ +with Ada.Finalization; + +generic + + I : Integer; + +package Controlled6_Pkg.Iterators is + + type Iterator_Type is new Ada.Finalization.Controlled with record + Current : Node_Access_Type; + end record; + + function Find return Iterator_Type; + + function Current (Iterator : in Iterator_Type) return T; + pragma Inline (Current); + + procedure Find_Next (Iterator : in out Iterator_Type); + + function Is_Null (Iterator : in Iterator_Type) return Boolean; + +end Controlled6_Pkg.Iterators; diff --git a/gcc/testsuite/gnat.dg/controlled6_pkg.ads b/gcc/testsuite/gnat.dg/controlled6_pkg.ads new file mode 100644 index 00000000000..2f1052be981 --- /dev/null +++ b/gcc/testsuite/gnat.dg/controlled6_pkg.ads @@ -0,0 +1,15 @@ +with Ada.Finalization; + +generic + + type T is private; + +package Controlled6_Pkg is + + type Node_Type is record + Item : T; + end record; + + type Node_Access_Type is access Node_Type; + +end Controlled6_Pkg; diff --git a/gcc/testsuite/gnat.dg/pack18.adb b/gcc/testsuite/gnat.dg/pack18.adb new file mode 100644 index 00000000000..857a6f9787e --- /dev/null +++ b/gcc/testsuite/gnat.dg/pack18.adb @@ -0,0 +1,12 @@ +-- { dg-do run } + +with Pack18_Pkg; use Pack18_Pkg; + +procedure Pack18 is + use Pack18_Pkg.Attributes_Tables; + Table : Instance; +begin + Init (Table); + Set_Last (Table, 1); + Table.Table (Last (Table)).N := 0; +end; diff --git a/gcc/testsuite/gnat.dg/pack18_pkg.ads b/gcc/testsuite/gnat.dg/pack18_pkg.ads new file mode 100644 index 00000000000..2b63fbab063 --- /dev/null +++ b/gcc/testsuite/gnat.dg/pack18_pkg.ads @@ -0,0 +1,21 @@ +with GNAT.Dynamic_Tables; + +package Pack18_Pkg is + + type String_Access is access String; + + type Rec is record + S : String_Access; + B : Boolean; + N : Natural; + end record; + pragma Pack (Rec); + + package Attributes_Tables is new GNAT.Dynamic_Tables + (Table_Component_Type => Rec, + Table_Index_Type => Natural, + Table_Low_Bound => 1, + Table_Initial => 200, + Table_Increment => 200); + +end Pack18_Pkg; diff --git a/gcc/testsuite/gnat.dg/specs/aggr5.ads b/gcc/testsuite/gnat.dg/specs/aggr5.ads new file mode 100644 index 00000000000..ba1e695bca2 --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/aggr5.ads @@ -0,0 +1,19 @@ +-- { dg-do compile } + +pragma Restrictions (No_Elaboration_Code); + +package Aggr5 is + + type R is record + C : Character; + F : Float; + end record; + + for R use record + C at 0 range 0 .. 7; + F at 1 range 0 .. 31; + end record; + + My_R : R := (C => 'A', F => 1.0); + +end Aggr5; diff --git a/gcc/testsuite/gnat.dg/vect7.adb b/gcc/testsuite/gnat.dg/vect7.adb new file mode 100644 index 00000000000..7911cc812c6 --- /dev/null +++ b/gcc/testsuite/gnat.dg/vect7.adb @@ -0,0 +1,20 @@ +-- { dg-do compile } + +package body Vect7 is + + procedure Assign is + v1 : constant v4sf := (-1.0, -2.0, -3.0, -4.0); + v2 : v4sf := v1; + v3 : v4sf; + begin + v3 := vzero; + v3 := vconst; + v3 := v1; + v3 := v2; + v3 := (1.0, -2.0, 3.0, -4.0); + v3 := (1.0, -2.0, 3.0, F); + + v2 := vzero; + end; + +end Vect7; diff --git a/gcc/testsuite/gnat.dg/vect7.ads b/gcc/testsuite/gnat.dg/vect7.ads new file mode 100644 index 00000000000..faf01679e23 --- /dev/null +++ b/gcc/testsuite/gnat.dg/vect7.ads @@ -0,0 +1,15 @@ +package Vect7 is + + type v4sf is array (1 .. 4) of Float; + for v4sf'Alignment use 16; + pragma Machine_Attribute (v4sf, "vector_type"); + + vzero : constant v4sf := (0.0, 0.0, 0.0, 0.0); + vconst : constant v4sf := (1.0, 2.0, 3.0, 4.0); + vvar : v4sf := vconst; + + F : Float := 5.0; + + procedure Assign; + +end Vect7; |