diff options
author | no-author <no-author@gcc.gnu.org> | 2005-05-06 11:44:31 +0000 |
---|---|---|
committer | no-author <no-author@gcc.gnu.org> | 2005-05-06 11:44:31 +0000 |
commit | 80d0dc63dd9c82a61b710f0e2318b9adc00873ff (patch) | |
tree | 305d235845efef886e7d1db2be7369d57f173361 | |
parent | cc111deddac466074f75b922e1578d787273bda1 (diff) |
This commit was manufactured by cvs2svn to create branch
'gcc-3_4-rhl-branch'.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-3_4-rhl-branch@99311 138bc75d-0d04-0410-961f-82ee72b054a4
33 files changed, 875 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/ext/altivec-10.C b/gcc/testsuite/g++.dg/ext/altivec-10.C new file mode 100644 index 00000000000..0be609431ce --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/altivec-10.C @@ -0,0 +1,22 @@ +/* This is a compile-only test for interaction of "-maltivec" and "-save-temps". */ +/* Author: Ziemowit Laski <zlaski@apple.com>. */ +/* { dg-do compile { target powerpc*-*-* } } */ +/* { dg-xfail-if "" { "powerpc-ibm-aix*" } { "-maltivec" } { "" } } */ +/* { dg-options "-save-temps -maltivec" } */ + +#include <altivec.h> + +#define vector_float vector float +#define vector_float_foo vector float foo +#define vector_float_bar_eq vector float bar = + +/* NB: Keep the following split across three lines. */ +vector +int +a1 = { 100, 200, 300, 400 }; + +vector_float f1 = { 1.0, 2.0, 3.0, 4.0 }; +vector_float_foo = { 3.0, 4.0, 5.0, 6.0 }; +vector_float_bar_eq { 8.0, 7.0, 6.0, 5.0 }; + +/* { dg-final { cleanup-saved-temps } } */ diff --git a/gcc/testsuite/g++.dg/ext/stmtexpr4.C b/gcc/testsuite/g++.dg/ext/stmtexpr4.C new file mode 100644 index 00000000000..a37c33ae086 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/stmtexpr4.C @@ -0,0 +1,8 @@ +// PR c++/20147 +// { dg-do compile } +// { dg-options "" } + +void foo() +{ + ({x;}); // { dg-error "was not declared" } +} diff --git a/gcc/testsuite/g++.dg/inherit/covariant12.C b/gcc/testsuite/g++.dg/inherit/covariant12.C new file mode 100644 index 00000000000..434082abb0d --- /dev/null +++ b/gcc/testsuite/g++.dg/inherit/covariant12.C @@ -0,0 +1,18 @@ +// Copyright (C) 2004 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 27 Feb 2005<nathan@codesourcery.com> + +// PR 20232: ICE on invalid + +struct T { }; + +struct S; + +struct B +{ + virtual T *Foo (); // { dg-error "overriding" "" } +}; + +struct D : B +{ + virtual S *Foo (); // { dg-error "invalid covariant" "" } +}; diff --git a/gcc/testsuite/g++.dg/init/ptrmem2.C b/gcc/testsuite/g++.dg/init/ptrmem2.C new file mode 100644 index 00000000000..54b69215bb4 --- /dev/null +++ b/gcc/testsuite/g++.dg/init/ptrmem2.C @@ -0,0 +1,12 @@ +// PR c++/19916 +// { dg-do run } + +struct S { + char k; +}; + +char const volatile S::* const p01 = &S::k; +int main(void) +{ + return 0; +} diff --git a/gcc/testsuite/g++.dg/lookup/using13.C b/gcc/testsuite/g++.dg/lookup/using13.C new file mode 100644 index 00000000000..c102fdcf872 --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/using13.C @@ -0,0 +1,12 @@ +// { dg-do compile } + +// Origin: Stefan Straßer <sstrasser@systemhaus-gruppe.de> + +// PR c++/20240: + +namespace A { int a; } + +namespace C{ + int a; + using A::a; // { dg-error "already declared" } +} diff --git a/gcc/testsuite/g++.dg/opt/pr20995-1.C b/gcc/testsuite/g++.dg/opt/pr20995-1.C new file mode 100644 index 00000000000..aa968963923 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr20995-1.C @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +template<int N> void foo() +{ + double d = (N ? 0.0 : 0) + 1; +} + diff --git a/gcc/testsuite/g++.dg/overload/using2.C b/gcc/testsuite/g++.dg/overload/using2.C new file mode 100644 index 00000000000..2ecb5fad6b0 --- /dev/null +++ b/gcc/testsuite/g++.dg/overload/using2.C @@ -0,0 +1,87 @@ +// { dg-do compile } + +// Copyright 2005 Free Software Foundation +// by Alexandre Oliva <aoliva@redhat.com> +// based on https://bugzilla.redhat.com/beta/show_bug.cgi?id=149098 + +// Per the ISO C++ 90 Standard, using declarations before of after a +// declaration of the same function name and prototype should be +// errors (7.3.3/11). However, DR 101's resolution recommends +// accepting such duplicates if they denote the same function, which +// means extern "C" declarations are supposed to match and be +// accepted. + +// This test makes sure we reject or accept regular and using +// declarations regardless of order as appropriate, and that having +// built-in declarations or overloads doesn't affet the outcome. + +namespace std { + extern "C" void exit (int) throw (); // these are built-in (extern "C") + extern "C" void *malloc (__SIZE_TYPE__) throw () __attribute__((malloc)); + + void abort (void) throw (); // these aren't + void _exit (int) throw (); // { dg-error "std::_exit" } + + extern "C" void c1 (void) throw (); + void C1 (void) throw (); // { dg-error "std::C1" } + + extern "C" void c2 (void) throw (); + void C2 (void) throw (); + + extern "C" void c3 (void) throw (); + void C3 (void) throw (); // { dg-error "std::C3" } +} + +namespace other { + extern "C" void c3 (void) throw (); + void C3 (void) throw (); // { dg-error "other::C3" } +} + +using std::exit; +using std::_exit; +using std::c1; +using std::C1; + + extern "C" void exit (int) throw (); + extern "C" void *malloc (__SIZE_TYPE__) throw () __attribute__((malloc)); + + void abort (void) throw (); + void _exit (int) throw (); // { dg-error "conflicts|void _exit" } + + extern "C" void c1 (void) throw (); + void C1 (void) throw (); // { dg-error "conflicts|void C1" } + + extern "C" void c2 (void) throw (); + void C2 (void) throw (); + + int C3 (int) throw (); + +using std::malloc; +using std::abort; // { dg-error "already declared" } +using std::c2; +using std::C2; // { dg-error "already declared" } + +using std::c3; using other::c3; +using std::C3; using other::C3; + + long C3 (long) throw (); + +int main () { + malloc (0); + exit (0); + + _exit (0); // { dg-error "ambiguous" } + abort (); + + c1 (); + C1 (); // { dg-error "ambiguous" } + + c2 (); + C2 (); // one might expect an ambiguous call error here as well, but + // we don't add the using decl if we find it to be in error. + + c3 (); + C3 (); // { dg-error "ambiguous" } + C3 (0); + C3 (0l); +} diff --git a/gcc/testsuite/g++.dg/parse/constant7.C b/gcc/testsuite/g++.dg/parse/constant7.C new file mode 100644 index 00000000000..c54ad55c1f0 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/constant7.C @@ -0,0 +1,9 @@ +// PR c++/19991 + +enum { e = 1 }; + +template<typename> struct A +{ + static const int i = e; + char a[i]; +}; diff --git a/gcc/testsuite/g++.dg/template/crash36.C b/gcc/testsuite/g++.dg/template/crash36.C new file mode 100644 index 00000000000..2f0ef921a67 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/crash36.C @@ -0,0 +1,9 @@ +// { dg-do compile } + +// Origin: Ivan Godard <igodard@pacbell.net> +// Andrew Pinski <pinskia@gcc.gnu.org> + +// PR c++/20333: ICE parsing typename without nested-name-specifier + +template<class> struct f {}; +f<int> f2[2] = {typename f<int>()}; // { dg-error "" } diff --git a/gcc/testsuite/g++.dg/template/non-dependent11.C b/gcc/testsuite/g++.dg/template/non-dependent11.C new file mode 100644 index 00000000000..dff5b909d95 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/non-dependent11.C @@ -0,0 +1,18 @@ +// { dg-do compile } + +// Origin: Jakub Jelinek <jakub@gcc.gnu.org> +// Wolfgang Bangerth <bangerth@ticam.utexas.edu> + +// PR c++/19311: Non-dependent address to member as function argument. + +template <class R, class T> void foo (R (T::*x) ()); +template <class R, class T, class C> void foo (R (T::*x) (C)); + +template<int> struct I { + int o (); + int o () const; +}; + +template <int> void bar (void) { + foo <int, I<1> > (&I<1>::o); +} diff --git a/gcc/testsuite/g++.dg/template/overload4.C b/gcc/testsuite/g++.dg/template/overload4.C new file mode 100644 index 00000000000..1a294eb3c05 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/overload4.C @@ -0,0 +1,20 @@ +// PR c++/20679 + +template <class T> +struct foo +{ + struct bar + { + int m; + }; + + void m() const {} + void m() {} + + bool n() const { return b->m < 42; } + + bar *b; +}; + + + diff --git a/gcc/testsuite/g++.dg/template/ptrmem14.C b/gcc/testsuite/g++.dg/template/ptrmem14.C new file mode 100644 index 00000000000..30eb1ebcc19 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/ptrmem14.C @@ -0,0 +1,12 @@ +// PR c++/15875 + +struct A +{ + void foo(); +}; + +template<int> void bar() +{ + typedef void (A::*fptr)(); + fptr ptr = &A::foo; +} diff --git a/gcc/testsuite/g++.dg/template/sizeof9.C b/gcc/testsuite/g++.dg/template/sizeof9.C new file mode 100644 index 00000000000..8d9ec95ae1f --- /dev/null +++ b/gcc/testsuite/g++.dg/template/sizeof9.C @@ -0,0 +1,6 @@ +// PR c++/21025 + +template<int N> struct X { char x[N]; }; +template<typename T> X<1 + sizeof(T) - sizeof(T)> F(T const &); +template<int N> struct S { int d() { F(1); } }; + diff --git a/gcc/testsuite/g++.dg/warn/Wbraces2.C b/gcc/testsuite/g++.dg/warn/Wbraces2.C new file mode 100644 index 00000000000..b51d5ca77b9 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wbraces2.C @@ -0,0 +1,15 @@ +// PR c++/20175 +// { dg-options "-Wmissing-braces" } +int a[2][2] = { 0, 1, 2, 3 }; // { dg-warning "missing braces" } +int b[2][2] = { { 0, 1 }, { 2, 3 } }; +int c[2][2] = { { { 0 }, 1 }, { 2, 3 } }; // { dg-error "brace-enclosed" } +struct S { char s[6]; int i; }; +S d = { "hello", 1 }; +S e = { { "hello" }, 1 }; +S f = { { { "hello" } }, 1 }; // { dg-error "brace-enclosed" } +S g = { 'h', 'e', 'l', 'l', 'o', '\0', 1 }; // { dg-warning "missing braces" } +struct T { wchar_t s[6]; int i; }; +T i = { L"hello", 1 }; +T j = { { L"hello" }, 1 }; +T k = { { { L"hello" } }, 1 }; // { dg-error "brace-enclosed" } +T l = { L'h', L'e', L'l', L'l', L'o', L'\0', 1 };// { dg-warning "missing braces" } diff --git a/gcc/testsuite/gcc.c-torture/execute/20050502-2.c b/gcc/testsuite/gcc.c-torture/execute/20050502-2.c new file mode 100644 index 00000000000..eedcb6a3173 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20050502-2.c @@ -0,0 +1,34 @@ +/* PR target/21297 */ +typedef __SIZE_TYPE__ size_t; +extern int memcmp (const char *, const char *, size_t); +extern void abort (); + +void +foo (char *x) +{ + int i; + for (i = 0; i < 2; i++); + x[i + i] = '\0'; +} + +void +bar (char *x) +{ + int i; + for (i = 0; i < 2; i++); + x[i + i + i + i] = '\0'; +} + +int +main (void) +{ + char x[] = "IJKLMNOPQR"; + foo (x); + if (memcmp (x, "IJKL\0NOPQR", sizeof x) != 0) + abort (); + x[4] = 'M'; + bar (x); + if (memcmp (x, "IJKLMNOP\0R", sizeof x) != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/altivec-16.c b/gcc/testsuite/gcc.dg/altivec-16.c new file mode 100644 index 00000000000..0be609431ce --- /dev/null +++ b/gcc/testsuite/gcc.dg/altivec-16.c @@ -0,0 +1,22 @@ +/* This is a compile-only test for interaction of "-maltivec" and "-save-temps". */ +/* Author: Ziemowit Laski <zlaski@apple.com>. */ +/* { dg-do compile { target powerpc*-*-* } } */ +/* { dg-xfail-if "" { "powerpc-ibm-aix*" } { "-maltivec" } { "" } } */ +/* { dg-options "-save-temps -maltivec" } */ + +#include <altivec.h> + +#define vector_float vector float +#define vector_float_foo vector float foo +#define vector_float_bar_eq vector float bar = + +/* NB: Keep the following split across three lines. */ +vector +int +a1 = { 100, 200, 300, 400 }; + +vector_float f1 = { 1.0, 2.0, 3.0, 4.0 }; +vector_float_foo = { 3.0, 4.0, 5.0, 6.0 }; +vector_float_bar_eq { 8.0, 7.0, 6.0, 5.0 }; + +/* { dg-final { cleanup-saved-temps } } */ diff --git a/gcc/testsuite/gcc.dg/format/asm_fprintf-2.c b/gcc/testsuite/gcc.dg/format/asm_fprintf-2.c new file mode 100644 index 00000000000..847eeee282f --- /dev/null +++ b/gcc/testsuite/gcc.dg/format/asm_fprintf-2.c @@ -0,0 +1,9 @@ +/* Test for ICE handling internal formats: bug 20740. The code did + not check that, if the required typedef names had been used as + identifiers, they were defined to suitable types. Test + "__gcc_host_wide_int__", not used at all, asm_fprintf format. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "-Wformat" } */ + +void bar (const char *, ...) __attribute__ ((__format__ (__asm_fprintf__, 1, 2))); /* { dg-error "error: '__gcc_host_wide_int__' is not defined as a type" } */ diff --git a/gcc/testsuite/gcc.dg/format/asm_fprintf-3.c b/gcc/testsuite/gcc.dg/format/asm_fprintf-3.c new file mode 100644 index 00000000000..f5fd5c022fc --- /dev/null +++ b/gcc/testsuite/gcc.dg/format/asm_fprintf-3.c @@ -0,0 +1,10 @@ +/* Test for ICE handling internal formats: bug 20740. The code did + not check that, if the required typedef names had been used as + identifiers, they were defined to suitable types. Test + "__gcc_host_wide_int__", not defined, asm_fprintf format. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "-Wformat" } */ + +void foo (int __gcc_host_wide_int__); +void bar (const char *, ...) __attribute__ ((__format__ (__asm_fprintf__, 1, 2))); /* { dg-error "error: '__gcc_host_wide_int__' is not defined as a type" } */ diff --git a/gcc/testsuite/gcc.dg/format/asm_fprintf-4.c b/gcc/testsuite/gcc.dg/format/asm_fprintf-4.c new file mode 100644 index 00000000000..9de05134af3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/format/asm_fprintf-4.c @@ -0,0 +1,10 @@ +/* Test for ICE handling internal formats: bug 20740. The code did + not check that, if the required typedef names had been used as + identifiers, they were defined to suitable types. Test + "__gcc_host_wide_int__", not a type, asm_fprintf. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "-Wformat" } */ + +int __gcc_host_wide_int__; +void bar (const char *, ...) __attribute__ ((__format__ (__asm_fprintf__, 1, 2))); /* { dg-error "error: '__gcc_host_wide_int__' is not defined as a type" } */ diff --git a/gcc/testsuite/gcc.dg/format/asm_fprintf-5.c b/gcc/testsuite/gcc.dg/format/asm_fprintf-5.c new file mode 100644 index 00000000000..14ffb60d32e --- /dev/null +++ b/gcc/testsuite/gcc.dg/format/asm_fprintf-5.c @@ -0,0 +1,10 @@ +/* Test for ICE handling internal formats: bug 20740. The code did + not check that, if the required typedef names had been used as + identifiers, they were defined to suitable types. Test + "__gcc_host_wide_int__", bad type, asm_fprintf format. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "-Wformat" } */ + +typedef int __gcc_host_wide_int__; +void bar (const char *, ...) __attribute__ ((__format__ (__asm_fprintf__, 1, 2))); /* { dg-error "error: '__gcc_host_wide_int__' is not defined as 'long' or 'long long'" } */ diff --git a/gcc/testsuite/gcc.dg/format/gcc_diag-2.c b/gcc/testsuite/gcc.dg/format/gcc_diag-2.c new file mode 100644 index 00000000000..60c6835da9e --- /dev/null +++ b/gcc/testsuite/gcc.dg/format/gcc_diag-2.c @@ -0,0 +1,10 @@ +/* Test for ICE handling internal formats: bug 20740. The code did + not check that, if the required typedef names had been used as + identifiers, they were defined to suitable types. Test "tree", not + defined. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "-Wformat" } */ + +void foo (int tree); +void bar (const char *, ...) __attribute__ ((__format__ (__gcc_diag__, 1, 2))); diff --git a/gcc/testsuite/gcc.dg/format/gcc_diag-3.c b/gcc/testsuite/gcc.dg/format/gcc_diag-3.c new file mode 100644 index 00000000000..1a7848ed9f2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/format/gcc_diag-3.c @@ -0,0 +1,10 @@ +/* Test for ICE handling internal formats: bug 20740. The code did + not check that, if the required typedef names had been used as + identifiers, they were defined to suitable types. Test "tree", not + a type. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "-Wformat" } */ + +int tree; +void bar (const char *, ...) __attribute__ ((__format__ (__gcc_diag__, 1, 2))); /* { dg-error "error: 'tree' is not defined as a type" } */ diff --git a/gcc/testsuite/gcc.dg/format/gcc_diag-4.c b/gcc/testsuite/gcc.dg/format/gcc_diag-4.c new file mode 100644 index 00000000000..20661c41f71 --- /dev/null +++ b/gcc/testsuite/gcc.dg/format/gcc_diag-4.c @@ -0,0 +1,10 @@ +/* Test for ICE handling internal formats: bug 20740. The code did + not check that, if the required typedef names had been used as + identifiers, they were defined to suitable types. Test "tree", not + a pointer type. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "-Wformat" } */ + +typedef int tree; +void bar (const char *, ...) __attribute__ ((__format__ (__gcc_diag__, 1, 2))); /* { dg-error "error: 'tree' is not defined as a pointer type" } */ diff --git a/gcc/testsuite/gcc.dg/format/gcc_diag-5.c b/gcc/testsuite/gcc.dg/format/gcc_diag-5.c new file mode 100644 index 00000000000..f8f12d68cdd --- /dev/null +++ b/gcc/testsuite/gcc.dg/format/gcc_diag-5.c @@ -0,0 +1,10 @@ +/* Test for ICE handling internal formats: bug 20740. The code did + not check that, if the required typedef names had been used as + identifiers, they were defined to suitable types. Test + "location_t", not defined. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "-Wformat" } */ + +void foo (int location_t); +void bar (const char *, ...) __attribute__ ((__format__ (__gcc_diag__, 1, 2))); diff --git a/gcc/testsuite/gcc.dg/format/gcc_diag-6.c b/gcc/testsuite/gcc.dg/format/gcc_diag-6.c new file mode 100644 index 00000000000..fdb493d4973 --- /dev/null +++ b/gcc/testsuite/gcc.dg/format/gcc_diag-6.c @@ -0,0 +1,10 @@ +/* Test for ICE handling internal formats: bug 20740. The code did + not check that, if the required typedef names had been used as + identifiers, they were defined to suitable types. Test + "location_t", not a type. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "-Wformat" } */ + +int location_t; +void bar (const char *, ...) __attribute__ ((__format__ (__gcc_diag__, 1, 2))); /* { dg-error "error: 'location_t' is not defined as a type" } */ diff --git a/gcc/testsuite/gcc.dg/format/gcc_diag-7.c b/gcc/testsuite/gcc.dg/format/gcc_diag-7.c new file mode 100644 index 00000000000..fccf5d24041 --- /dev/null +++ b/gcc/testsuite/gcc.dg/format/gcc_diag-7.c @@ -0,0 +1,10 @@ +/* Test for ICE handling internal formats: bug 20740. The code did + not check that, if the required typedef names had been used as + identifiers, they were defined to suitable types. Test + "__gcc_host_wide_int__", not defined. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "-Wformat" } */ + +void foo (int __gcc_host_wide_int__); +void bar (const char *, ...) __attribute__ ((__format__ (__gcc_diag__, 1, 2))); diff --git a/gcc/testsuite/gcc.dg/format/gcc_diag-8.c b/gcc/testsuite/gcc.dg/format/gcc_diag-8.c new file mode 100644 index 00000000000..835ec3f98d3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/format/gcc_diag-8.c @@ -0,0 +1,10 @@ +/* Test for ICE handling internal formats: bug 20740. The code did + not check that, if the required typedef names had been used as + identifiers, they were defined to suitable types. Test + "__gcc_host_wide_int__", not a type. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "-Wformat" } */ + +int __gcc_host_wide_int__; +void bar (const char *, ...) __attribute__ ((__format__ (__gcc_diag__, 1, 2))); /* { dg-error "error: '__gcc_host_wide_int__' is not defined as a type" } */ diff --git a/gcc/testsuite/gcc.dg/format/gcc_diag-9.c b/gcc/testsuite/gcc.dg/format/gcc_diag-9.c new file mode 100644 index 00000000000..6481c26caf7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/format/gcc_diag-9.c @@ -0,0 +1,10 @@ +/* Test for ICE handling internal formats: bug 20740. The code did + not check that, if the required typedef names had been used as + identifiers, they were defined to suitable types. Test + "__gcc_host_wide_int__", bad type. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "-Wformat" } */ + +typedef int __gcc_host_wide_int__; +void bar (const char *, ...) __attribute__ ((__format__ (__gcc_diag__, 1, 2))); /* { dg-error "error: '__gcc_host_wide_int__' is not defined as 'long' or 'long long'" } */ diff --git a/gcc/testsuite/gcc.dg/i386-sse-11.c b/gcc/testsuite/gcc.dg/i386-sse-11.c new file mode 100644 index 00000000000..fd72047b525 --- /dev/null +++ b/gcc/testsuite/gcc.dg/i386-sse-11.c @@ -0,0 +1,92 @@ +/* PR rtl-optimization/21239 */ +/* { dg-do run { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-O2 -msse2" } */ +#include <emmintrin.h> +#include "i386-cpuid.h" + +extern void abort (void); + +void +foo (unsigned int x, double *y, const double *z) +{ + __m128d tmp; + while (x) + { + tmp = _mm_load_sd (z); + _mm_store_sd (y, tmp); + --x; ++z; ++y; + } +} + +void +bar (unsigned int x, float *y, const float *z) +{ + __m128 tmp; + unsigned int i; + for (i = 0; i < x; ++i) + { + tmp = (__m128) { *z, 0, 0, 0 }; + *y = __builtin_ia32_vec_ext_v4sf (tmp, 0); + ++z; ++y; + } + for (i = 0; i < x; ++i) + { + tmp = (__m128) { 0, *z, 0, 0 }; + *y = __builtin_ia32_vec_ext_v4sf (tmp, 1); + ++z; ++y; + } + for (i = 0; i < x; ++i) + { + tmp = (__m128) { 0, 0, *z, 0 }; + *y = __builtin_ia32_vec_ext_v4sf (tmp, 2); + ++z; ++y; + } + for (i = 0; i < x; ++i) + { + tmp = (__m128) { 0, 0, 0, *z }; + *y = __builtin_ia32_vec_ext_v4sf (tmp, 3); + ++z; ++y; + } +} + +void __attribute__((noinline)) +run_tests (void) +{ + unsigned int i; + double a[16], b[16]; + float c[16], d[16]; + for (i = 0; i < 16; ++i) + { + a[i] = 1; + b[i] = 2; + c[i] = 3; + d[i] = 4; + } + foo (16, a, b); + bar (4, c, d); + for (i = 0; i < 16; ++i) + { + if (a[i] != 2) + abort (); + if (c[i] != 4) + abort (); + } +} + +int +main () +{ + unsigned long cpu_facilities; + unsigned int i; + double a[19], b[19]; + + cpu_facilities = i386_cpuid (); + + if ((cpu_facilities & (bit_MMX | bit_SSE | bit_SSE2 | bit_CMOV)) + != (bit_MMX | bit_SSE | bit_SSE2 | bit_CMOV)) + /* If host has no vector support, pass. */ + return 0; + + run_tests (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr19683-1.c b/gcc/testsuite/gcc.dg/torture/pr19683-1.c new file mode 100644 index 00000000000..96674811f1e --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr19683-1.c @@ -0,0 +1,50 @@ +/* From PR rtl-optimization/19683. On little-endian MIPS targets, + reload would incorrectly inherit the high part of the multiplication + result. */ +/* { dg-do run { target mips*-*-* } } */ + +extern void abort (void); +extern void exit (int); + +#ifndef __mips16 +#define REPEAT10(X, Y) \ + X(Y##0); X(Y##1); X(Y##2); X(Y##3); X(Y##4); \ + X(Y##5); X(Y##6); X(Y##7); X(Y##8); X(Y##9) + +#define REPEAT30(X) REPEAT10 (X, 0); REPEAT10 (X, 1); REPEAT10 (X, 2) +#define IN(X) unsigned int x##X = ptr[0] +#define OUT(X) ptr[0] = x##X + +union u { unsigned long long ll; unsigned int i[2]; }; + +unsigned int +foo (volatile unsigned int *ptr) +{ + union u u; + int result; + + u.ll = (unsigned long long) ptr[0] * ptr[0]; + REPEAT30 (IN); + REPEAT30 (OUT); + asm ("#" : "=l" (result) : "l" (u.i[1])); + return result; +} + +int +main (void) +{ + unsigned int array[] = { 1000 * 1000 * 1000 }; + union u u; + + u.ll = (unsigned long long) array[0] * array[0]; + if (foo (array) != u.i[1]) + abort (); + exit (0); +} +#else +int +main (void) +{ + exit (0); +} +#endif diff --git a/gcc/testsuite/gcc.dg/transparent-union-3.c b/gcc/testsuite/gcc.dg/transparent-union-3.c new file mode 100644 index 00000000000..cebd5f85771 --- /dev/null +++ b/gcc/testsuite/gcc.dg/transparent-union-3.c @@ -0,0 +1,22 @@ +/* Test for ICEs on invalid transparent unions (empty or no named + members). Bug 21213. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +enum e { A }; + +union __attribute__((__transparent_union__)) ue1 { enum e; }; /* { dg-warning "warning: declaration does not declare anything" } */ +/* { dg-warning "warning: union cannot be made transparent" "" { target *-*-* } 9 } */ +union ue2 { enum e; } __attribute__((__transparent_union__)); /* { dg-warning "warning: declaration does not declare anything" } */ +/* { dg-warning "warning: union cannot be made transparent" "" { target *-*-* } 11 } */ + +union __attribute__((__transparent_union__)) ui1 { int; }; /* { dg-warning "warning: declaration does not declare anything" } */ +/* { dg-warning "warning: union cannot be made transparent" "" { target *-*-* } 14 } */ +union ui2 { int; } __attribute__((__transparent_union__)); /* { dg-warning "warning: declaration does not declare anything" } */ +/* { dg-warning "warning: union cannot be made transparent" "" { target *-*-* } 16 } */ + +union __attribute__((__transparent_union__)) u1 { }; +/* { dg-warning "warning: union cannot be made transparent" "" { target *-*-* } 19 } */ +union u2 { } __attribute__((__transparent_union__)); +/* { dg-warning "warning: union cannot be made transparent" "" { target *-*-* } 21 } */ diff --git a/gcc/testsuite/lib/target-libpath.exp b/gcc/testsuite/lib/target-libpath.exp new file mode 100644 index 00000000000..e8cf4630e16 --- /dev/null +++ b/gcc/testsuite/lib/target-libpath.exp @@ -0,0 +1,237 @@ +# Copyright (C) 2004 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# This file was contributed by John David Anglin (dave.anglin@nrc-cnrc.gc.ca) + +set orig_environment_saved 0 +set orig_ld_library_path_saved 0 +set orig_ld_run_path_saved 0 +set orig_shlib_path_saved 0 +set orig_ld_libraryn32_path_saved 0 +set orig_ld_library64_path_saved 0 +set orig_ld_library_path_32_saved 0 +set orig_ld_library_path_64_saved 0 +set orig_dyld_library_path_saved 0 + + +####################################### +# proc set_ld_library_path_env_vars { } +####################################### + +proc set_ld_library_path_env_vars { } { + global ld_library_path + global orig_environment_saved + global orig_ld_library_path_saved + global orig_ld_run_path_saved + global orig_shlib_path_saved + global orig_ld_libraryn32_path_saved + global orig_ld_library64_path_saved + global orig_ld_library_path_32_saved + global orig_ld_library_path_64_saved + global orig_dyld_library_path_saved + global orig_ld_library_path + global orig_ld_run_path + global orig_shlib_path + global orig_ld_libraryn32_path + global orig_ld_library64_path + global orig_ld_library_path_32 + global orig_ld_library_path_64 + global orig_dyld_library_path + + # Setting the ld library path causes trouble when testing cross-compilers. + if { [is_remote target] } { + return + } + + if { $orig_environment_saved == 0 } { + global env + + set orig_environment_saved 1 + + # Save the original environment. + if [info exists env(LD_LIBRARY_PATH)] { + set orig_ld_library_path "$env(LD_LIBRARY_PATH)" + set orig_ld_library_path_saved 1 + } + if [info exists env(LD_RUN_PATH)] { + set orig_ld_run_path "$env(LD_RUN_PATH)" + set orig_ld_run_path_saved 1 + } + if [info exists env(SHLIB_PATH)] { + set orig_shlib_path "$env(SHLIB_PATH)" + set orig_shlib_path_saved 1 + } + if [info exists env(LD_LIBRARYN32_PATH)] { + set orig_ld_libraryn32_path "$env(LD_LIBRARYN32_PATH)" + set orig_ld_libraryn32_path_saved 1 + } + if [info exists env(LD_LIBRARY64_PATH)] { + set orig_ld_library64_path "$env(LD_LIBRARY64_PATH)" + set orig_ld_library64_path_saved 1 + } + if [info exists env(LD_LIBRARY_PATH_32)] { + set orig_ld_library_path_32 "$env(LD_LIBRARY_PATH_32)" + set orig_ld_library_path_32_saved 1 + } + if [info exists env(LD_LIBRARY_PATH_64)] { + set orig_ld_library_path_64 "$env(LD_LIBRARY_PATH_64)" + set orig_ld_library_path_64_saved 1 + } + if [info exists env(DYLD_LIBRARY_PATH)] { + set orig_dyld_library_path "$env(DYLD_LIBRARY_PATH)" + set orig_dyld_library_path_saved 1 + } + } + + # We need to set ld library path in the environment. Currently, + # unix.exp doesn't set the environment correctly for all systems. + # It only sets SHLIB_PATH and LD_LIBRARY_PATH when it executes a + # program. We also need the environment set for compilations, etc. + # + # On IRIX 6, we have to set variables akin to LD_LIBRARY_PATH, but + # called LD_LIBRARYN32_PATH (for the N32 ABI) and LD_LIBRARY64_PATH + # (for the 64-bit ABI). The same applies to Darwin (DYLD_LIBRARY_PATH), + # Solaris 32 bit (LD_LIBRARY_PATH_32), Solaris 64 bit (LD_LIBRARY_PATH_64), + # and HP-UX (SHLIB_PATH). In some cases, the variables are independent + # of LD_LIBRARY_PATH, and in other cases LD_LIBRARY_PATH is used if the + # variable is not defined. + # + # Doing this is somewhat of a hack as ld_library_path gets repeated in + # SHLIB_PATH and LD_LIBRARY_PATH when unix_load sets these variables. + if { $orig_ld_library_path_saved } { + setenv LD_LIBRARY_PATH "$ld_library_path:$orig_ld_library_path" + } else { + setenv LD_LIBRARY_PATH "$ld_library_path" + } + if { $orig_ld_run_path_saved } { + setenv LD_RUN_PATH "$ld_library_path:$orig_ld_run_path" + } else { + setenv LD_RUN_PATH "$ld_library_path" + } + # The default shared library dynamic path search for 64-bit + # HP-UX executables searches LD_LIBRARY_PATH before SHLIB_PATH. + # LD_LIBRARY_PATH isn't used for 32-bit executables. Thus, we + # set LD_LIBRARY_PATH and SHLIB_PATH as if they were independent. + if { $orig_shlib_path_saved } { + setenv SHLIB_PATH "$ld_library_path:$orig_shlib_path" + } else { + setenv SHLIB_PATH "$ld_library_path" + } + if { $orig_ld_libraryn32_path_saved } { + setenv LD_LIBRARYN32_PATH "$ld_library_path:$orig_ld_libraryn32_path" + } elseif { $orig_ld_library_path_saved } { + setenv LD_LIBRARYN32_PATH "$ld_library_path:$orig_ld_library_path" + } else { + setenv LD_LIBRARYN32_PATH "$ld_library_path" + } + if { $orig_ld_library64_path_saved } { + setenv LD_LIBRARY64_PATH "$ld_library_path:$orig_ld_library64_path" + } elseif { $orig_ld_library_path_saved } { + setenv LD_LIBRARY64_PATH "$ld_library_path:$orig_ld_library_path" + } else { + setenv LD_LIBRARY64_PATH "$ld_library_path" + } + if { $orig_ld_library_path_32_saved } { + setenv LD_LIBRARY_PATH_32 "$ld_library_path:$orig_ld_library_path_32" + } elseif { $orig_ld_library_path_saved } { + setenv LD_LIBRARY_PATH_32 "$ld_library_path:$orig_ld_library_path" + } else { + setenv LD_LIBRARY_PATH_32 "$ld_library_path" + } + if { $orig_ld_library_path_64_saved } { + setenv LD_LIBRARY_PATH_64 "$ld_library_path:$orig_ld_library_path_64" + } elseif { $orig_ld_library_path_saved } { + setenv LD_LIBRARY_PATH_64 "$ld_library_path:$orig_ld_library_path" + } else { + setenv LD_LIBRARY_PATH_64 "$ld_library_path" + } + if { $orig_dyld_library_path_saved } { + setenv DYLD_LIBRARY_PATH "$ld_library_path:$orig_dyld_library_path" + } else { + setenv DYLD_LIBRARY_PATH "$ld_library_path" + } + + verbose -log "set_ld_library_path_env_vars: ld_library_path=$ld_library_path" +} + +####################################### +# proc restore_ld_library_path_env_vars { } +####################################### + +proc restore_ld_library_path_env_vars { } { + global orig_environment_saved + global orig_ld_library_path_saved + global orig_ld_run_path_saved + global orig_shlib_path_saved + global orig_ld_libraryn32_path_saved + global orig_ld_library64_path_saved + global orig_ld_library_path_32_saved + global orig_ld_library_path_64_saved + global orig_dyld_library_path_saved + global orig_ld_library_path + global orig_ld_run_path + global orig_shlib_path + global orig_ld_libraryn32_path + global orig_ld_library64_path + global orig_ld_library_path_32 + global orig_ld_library_path_64 + global orig_dyld_library_path + + if { $orig_environment_saved == 0 } { + return + } + + if { $orig_ld_library_path_saved } { + setenv LD_LIBRARY_PATH "$orig_ld_library_path" + } elseif [info exists env(LD_LIBRARY_PATH)] { + unsetenv LD_LIBRARY_PATH + } + if { $orig_ld_run_path_saved } { + setenv LD_RUN_PATH "$orig_ld_run_path" + } elseif [info exists env(LD_RUN_PATH)] { + unsetenv LD_RUN_PATH + } + if { $orig_shlib_path_saved } { + setenv SHLIB_PATH "$orig_shlib_path" + } elseif [info exists env(SHLIB_PATH)] { + unsetenv SHLIB_PATH + } + if { $orig_ld_libraryn32_path_saved } { + setenv LD_LIBRARYN32_PATH "$orig_ld_libraryn32_path" + } elseif [info exists env(LD_LIBRARYN32_PATH)] { + unsetenv LD_LIBRARYN32_PATH + } + if { $orig_ld_library64_path_saved } { + setenv LD_LIBRARY64_PATH "$orig_ld_library64_path" + } elseif [info exists env(LD_LIBRARY64_PATH)] { + unsetenv LD_LIBRARY64_PATH + } + if { $orig_ld_library_path_32_saved } { + setenv LD_LIBRARY_PATH_32 "$orig_ld_library_path_32" + } elseif [info exists env(LD_LIBRARY_PATH_32)] { + unsetenv LD_LIBRARY_PATH_32 + } + if { $orig_ld_library_path_64_saved } { + setenv LD_LIBRARY_PATH_64 "$orig_ld_library_path_64" + } elseif [info exists env(LD_LIBRARY_PATH_64)] { + unsetenv LD_LIBRARY_PATH_64 + } + if { $orig_dyld_library_path_saved } { + setenv DYLD_LIBRARY_PATH "$orig_dyld_library_path" + } elseif [info exists env(DYLD_LIBRARY_PATH)] { + unsetenv DYLD_LIBRARY_PATH + } +} diff --git a/libstdc++-v3/testsuite/libstdc++-abi/abi.exp b/libstdc++-v3/testsuite/libstdc++-abi/abi.exp new file mode 100644 index 00000000000..f226e0aaf77 --- /dev/null +++ b/libstdc++-v3/testsuite/libstdc++-abi/abi.exp @@ -0,0 +1,43 @@ +# Copyright (C) 2005 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# If there is no baseline file, or we can't find the library, skip +# this test. +if { ![info exists baseline_file] \ + || ![file exists $baseline_file] \ + || ![file exists "../src/.libs/libstdc++.so"] } { + return +} + +# Figure out what symbols are defined by the active build of the library. +remote_exec "build" "$srcdir/../scripts/extract_symvers" \ + [list "../src/.libs/libstdc++.so" "current_symbols.txt"] + +# Build the support objects. +v3-build_support + +# Build the abi_check program. +if { [v3_target_compile "$srcdir/testsuite_abi_check.cc" "abi_check" \ + "executable" [list "additional_flags=-w"]] != "" } { + error "could not compile testsuite_abi_check.cc" +} + +remote_download "target" $baseline_file "baseline_symbols.txt" +remote_download "target" "current_symbols.txt" "current_symbols.txt" +set result [${tool}_load "./abi_check" \ + [list "--check-verbose" "current_symbols.txt" \ + "baseline_symbols.txt"]] +[lindex $result 0] "abi_check" |