diff options
Diffstat (limited to 'gcc/testsuite')
51 files changed, 622 insertions, 50 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9980ad7e294..0e4edf5ca2e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,129 @@ +2012-05-20 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/lto13.adb: New test. + * gnat.dg/lto13_pkg.ad[sb]: New helper. + +2012-05-18 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/specs/lto12.ads: New test. + * gnat.dg/specs/lto12_pkg.ads: New helper. + +2012-05-18 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/53346 + * gcc.dg/tree-ssa/ldist-18.c: New testcase. + * gcc.target/i386/incoming-10.c: Adjust. + * gcc.target/i386/incoming-11.c: Likewise. + * gcc.target/i386/pr46295.c: Likewise. + +2012-05-18 Richard Guenther <rguenther@suse.de> + + * gcc.dg/pr53352.c: Return zero. + +2012-05-18 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/53390 + * gcc.dg/torture/pr53390.c: New testcase. + +2012-05-18 Meador Inge <meadori@codesourcery.com> + + PR rtl-optimization/53352 + * gcc.dg/pr53352.c: New test. + +2012-05-17 David S. Miller <davem@davemloft.net> + + * gfortran.dg/bessel_7.f90: Bump allowed precision to avoid + failure on sparc-*-linux-gnu. + +2012-05-17 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/39681 + * g++.dg/parse/error49.C: New. + * g++.dg/cpp0x/error8.C: Likewise. + * g++.dg/ext/utf-cxx98.C: Adjust dg-error directive. + * g++.dg/ext/utf-dflt2.C: Likewise. + * g++.dg/ext/utf-gnuxx98.C: Likewise. + * g++.dg/ext/utf-dflt.C: Likewise. + * c-c++-common/raw-string-3.c: Likewise. + * c-c++-common/raw-string-4.c: Likewise. + +2012-05-17 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/53371 + * g++.dg/cpp0x/catch1.C: New. + +2012-05-17 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/44516 + * g++.dg/parse/error48.C: New. + * g++.dg/template/crash89.C: Adjust dg-error line numbers. + * g++.old-deja/g++.robertl/eb109.C: Add column info to dg-error string. + +2012-05-16 Patrick Marlier <patrick.marlier@gmail.com> + + * gcc.dg/tm/indirect-2.c: New test. + +2012-05-16 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + PR tree-optimization/53217 + * gfortran.dg/pr53217.f90: New test. + +2012-05-16 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/53364 + * g++.dg/torture/pr53364.C: New testcase. + +2012-05-16 Georg-Johann Lay <avr@gjlay.de> + + PR testsuite/52641 + * gcc.dg/pr52549.c: Fix test for long != void* + * gcc.c-torture/execute/pr52979-1.x: New file. + * gcc.c-torture/execute/pr52979-2.x: New file. + +2012-05-16 Dodji Seketeli <dodji@redhat.com> + + PR preprocessor/7263 + * gcc.dg/binary-constants-2.c: Run without tracking locations + accross macro expansion. + * gcc.dg/binary-constants-3.c: Likewise. + * gcc.dg/cpp/sysmac2.c: Likewise. + * testsuite/gcc.dg/nofixed-point-2.c: Adjust for more precise + location. + * gcc.dg/cpp/syshdr3.c: New test. + * gcc.dg/cpp/syshdr3.h: New header for the new test above. + * gcc.dg/system-binary-constants-1.c: New test. + * gcc.dg/system-binary-constants-1.h: New header for the new test + above. + * g++.dg/cpp/syshdr3.C: New test. + * g++.dg/cpp/syshdr3.h: New header the new test above. + * g++.dg/system-binary-constants-1.C: New test. + * g++.dg/system-binary-constants-1.h: New header the new test + above. + +2012-05-15 Paolo Carlini <paolo.carlini@oracle.com> + + * g++.old-deja/g++.pt/crash10.C: Adjust post PR11586. + +2012-05-15 Jakub Jelinek <jakub@redhat.com> + + PR target/53358 + * gcc.dg/pr53358.c: New test. + +2012-05-15 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/11856 + * g++.dg/warn/Wtype-limits.C: Don't warn in templates. + * g++.dg/warn/Wtype-limits-Wextra.C: Likewise. + +2012-05-15 Olivier Hainque <hainque@adacore.com> + + * g++.dg/eh/sighandle.C: New testcase. + +2012-05-15 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/53355 + * gcc.dg/tree-ssa/vrp67.c: New testcase. + 2012-05-15 Bernhard Reutner-Fischer <aldot@gcc.gnu.org> * gfortran.dg/*.f90: Remove now redundant manual diff --git a/gcc/testsuite/c-c++-common/raw-string-3.c b/gcc/testsuite/c-c++-common/raw-string-3.c index df9e2755518..70d4145da0c 100644 --- a/gcc/testsuite/c-c++-common/raw-string-3.c +++ b/gcc/testsuite/c-c++-common/raw-string-3.c @@ -5,26 +5,26 @@ // { dg-options "-std=c++98" { target c++ } } const void *s0 = R"(a)"; // { dg-error "was not declared|undeclared" } - // { dg-error "expected ',' or ';'" "" { target *-*-* } 7 } + // { dg-error "expected ',' or ';'" "" { target c } 7 } const void *s1 = uR"(a)"; // { dg-error "was not declared|undeclared" } - // { dg-error "expected ',' or ';'" "" { target *-*-* } 9 } + // { dg-error "expected ',' or ';'" "" { target c } 9 } const void *s2 = UR"(a)"; // { dg-error "was not declared|undeclared" } - // { dg-error "expected ',' or ';'" "" { target *-*-* } 11 } + // { dg-error "expected ',' or ';'" "" { target c } 11 } const void *s3 = u8R"(a)"; // { dg-error "was not declared|undeclared" } - // { dg-error "expected ',' or ';'" "" { target *-*-* } 13 } + // { dg-error "expected ',' or ';'" "" { target c } 13 } const void *s4 = LR"(a)"; // { dg-error "was not declared|undeclared" } - // { dg-error "expected ',' or ';'" "" { target *-*-* } 15 } - -const int i0 = R'a'; // { dg-error "expected ',' or ';'" } - // { dg-error "was not declared" "" { target c++ } 18 } -const int i1 = uR'a'; // { dg-error "expected ',' or ';'" } - // { dg-error "was not declared" "" { target c++ } 20 } -const int i2 = UR'a'; // { dg-error "expected ',' or ';'" } - // { dg-error "was not declared" "" { target c++ } 22 } -const int i3 = u8R'a'; // { dg-error "expected ',' or ';'" } - // { dg-error "was not declared" "" { target c++ } 24 } -const int i4 = LR'a'; // { dg-error "expected ',' or ';'" } - // { dg-error "was not declared" "" { target c++ } 26 } + // { dg-error "expected ',' or ';'" "" { target c } 15 } + +const int i0 = R'a'; // { dg-error "was not declared" "" { target c++ } } + // { dg-error "expected ',' or ';'" "" { target c } 18 } +const int i1 = uR'a'; // { dg-error "was not declared" "" { target c++ } } + // { dg-error "expected ',' or ';'" "" { target c } 20 } +const int i2 = UR'a'; // { dg-error "was not declared" "" { target c++ } } + // { dg-error "expected ',' or ';'" "" { target c } 22 } +const int i3 = u8R'a'; // { dg-error "was not declared" "" { target c++ } } + // { dg-error "expected ',' or ';'" "" { target c } 24 } +const int i4 = LR'a'; // { dg-error "was not declared" "" { target c++ } } + // { dg-error "expected ',' or ';'" "" { target c } 26 } #define R "a" #define uR "b" diff --git a/gcc/testsuite/c-c++-common/raw-string-4.c b/gcc/testsuite/c-c++-common/raw-string-4.c index 626e7f257ae..95825d7c9cf 100644 --- a/gcc/testsuite/c-c++-common/raw-string-4.c +++ b/gcc/testsuite/c-c++-common/raw-string-4.c @@ -4,15 +4,15 @@ // { dg-options "-std=c++0x" { target c++ } } const int i0 = R'a'; // { dg-error "was not declared|undeclared" } - // { dg-error "expected ',' or ';'" "" { target *-*-* } 6 } + // { dg-error "expected ',' or ';'" "" { target c } 6 } const int i1 = uR'a'; // { dg-error "was not declared|undeclared" } - // { dg-error "expected ',' or ';'" "" { target *-*-* } 8 } + // { dg-error "expected ',' or ';'" "" { target c } 8 } const int i2 = UR'a'; // { dg-error "was not declared|undeclared" } - // { dg-error "expected ',' or ';'" "" { target *-*-* } 10 } + // { dg-error "expected ',' or ';'" "" { target c } 10 } const int i3 = u8R'a'; // { dg-error "was not declared|undeclared" } - // { dg-error "expected ',' or ';'" "" { target *-*-* } 12 } + // { dg-error "expected ',' or ';'" "" { target c } 12 } const int i4 = LR'a'; // { dg-error "was not declared|undeclared" } - // { dg-error "expected ',' or ';'" "" { target *-*-* } 14 } + // { dg-error "expected ',' or ';'" "" { target c } 14 } #define R 1 + #define uR 2 + diff --git a/gcc/testsuite/g++.dg/cpp/syshdr3.C b/gcc/testsuite/g++.dg/cpp/syshdr3.C new file mode 100644 index 00000000000..39168239a39 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp/syshdr3.C @@ -0,0 +1,16 @@ +/* Contributed by Dodji Seketeli <dodji@redhat.com> */ +/* Origin: PR preprocessor/7263 */ +/* { dg-options "-pedantic -std=c++98 -ftrack-macro-expansion=1" } */ +/* { dg-do compile } */ + +/* This tests the proprer suppression of warning coming from macro + defined in system headers and expanded in a non-system header + location. */ +#include "syshdr3.h" + +static _Complex float c = _Complex_I + _Complex_I; /* These macros are defined in + system header so we should + have no warning here. */ +U_LL u = ONE_ULL; /* Likewise here. */ + +unsigned long long v = 1ULL; /* { dg-warning "long long" } */ diff --git a/gcc/testsuite/g++.dg/cpp/syshdr3.h b/gcc/testsuite/g++.dg/cpp/syshdr3.h new file mode 100644 index 00000000000..e5d502a24f5 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp/syshdr3.h @@ -0,0 +1,7 @@ +#pragma GCC system_header + +#define _Complex __complex__ +#define _Complex_I 1.0iF + +#define U_LL unsigned long long +#define ONE_ULL 1ULL diff --git a/gcc/testsuite/g++.dg/cpp0x/catch1.C b/gcc/testsuite/g++.dg/cpp0x/catch1.C new file mode 100644 index 00000000000..81778ea7807 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/catch1.C @@ -0,0 +1,16 @@ +// PR c++/53371 +// { dg-do compile { target c++11 } } + +struct Abs +{ + virtual void a() = 0; +}; + +void foo() +{ + try { + } catch (Abs) { } // { dg-error "abstract class type" } + + try { + } catch (int&&) { } // { dg-error "rvalue reference type" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/error8.C b/gcc/testsuite/g++.dg/cpp0x/error8.C new file mode 100644 index 00000000000..cc4f87791a9 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/error8.C @@ -0,0 +1,7 @@ +// PR c++/39681 +// { dg-do compile { target c++11 } } + +struct A +{ + int* p = new foo; // { dg-error "16:expected type-specifier" } +}; diff --git a/gcc/testsuite/g++.dg/eh/sighandle.C b/gcc/testsuite/g++.dg/eh/sighandle.C new file mode 100644 index 00000000000..e516ad0a483 --- /dev/null +++ b/gcc/testsuite/g++.dg/eh/sighandle.C @@ -0,0 +1,38 @@ +// { dg-do run { target { *-*-aix5* i?86-*-linux* x86_64-*-linux* } } } +// { dg-options "-fexceptions -fnon-call-exceptions" } + +#include <signal.h> +#include <stdlib.h> + +void sighandler (int signo, siginfo_t * si, void * uc) +{ + throw (5); +} + +char * dosegv () +{ + * ((volatile int *)0) = 12; +} + +int main () +{ + struct sigaction sa; + int status; + + sa.sa_sigaction = sighandler; + sa.sa_flags = SA_SIGINFO; + + status = sigaction (SIGSEGV, & sa, NULL); + status = sigaction (SIGBUS, & sa, NULL); + + try { + dosegv (); + } + catch (int x) { + return (x != 5); + } + + return 1; +} + + diff --git a/gcc/testsuite/g++.dg/ext/utf-cxx98.C b/gcc/testsuite/g++.dg/ext/utf-cxx98.C index a8dd13a4e34..365118e3964 100644 --- a/gcc/testsuite/g++.dg/ext/utf-cxx98.C +++ b/gcc/testsuite/g++.dg/ext/utf-cxx98.C @@ -8,9 +8,7 @@ const static char16_t c0 = 'a'; /* { dg-error "not name a type" } */ const static char32_t c1 = 'a'; /* { dg-error "not name a type" } */ const unsigned short c2 = u'a'; /* { dg-error "not declared" } */ - /* { dg-error "expected ',' or ';'" "" { target *-*-* } 10 } */ const unsigned long c3 = U'a'; /* { dg-error "not declared" } */ - /* { dg-error "expected ',' or ';'" "" { target *-*-* } 12 } */ #define u 1 + #define U 2 + diff --git a/gcc/testsuite/g++.dg/ext/utf-dflt.C b/gcc/testsuite/g++.dg/ext/utf-dflt.C index 04849bfbf06..c2b127d5dda 100644 --- a/gcc/testsuite/g++.dg/ext/utf-dflt.C +++ b/gcc/testsuite/g++.dg/ext/utf-dflt.C @@ -8,9 +8,7 @@ const static char16_t c0 = 'a'; /* { dg-error "not name a type" } */ const static char32_t c1 = 'a'; /* { dg-error "not name a type" } */ const unsigned short c2 = u'a'; /* { dg-error "not declared" } */ - /* { dg-error "expected ',' or ';'" "" { target *-*-* } 10 } */ const unsigned long c3 = U'a'; /* { dg-error "not declared" } */ - /* { dg-error "expected ',' or ';'" "" { target *-*-* } 12 } */ #define u 1 + #define U 2 + diff --git a/gcc/testsuite/g++.dg/ext/utf-dflt2.C b/gcc/testsuite/g++.dg/ext/utf-dflt2.C index fd2222f672e..ab18ef52fdf 100644 --- a/gcc/testsuite/g++.dg/ext/utf-dflt2.C +++ b/gcc/testsuite/g++.dg/ext/utf-dflt2.C @@ -3,7 +3,6 @@ // { dg-options "-std=c++98" } const void *s0 = u8"a"; // { dg-error "was not declared" } - // { dg-error "expected ',' or ';'" "" { target *-*-* } 5 } #define u8 "a" diff --git a/gcc/testsuite/g++.dg/ext/utf-gnuxx98.C b/gcc/testsuite/g++.dg/ext/utf-gnuxx98.C index fc8068b7e99..b3be121e2dc 100644 --- a/gcc/testsuite/g++.dg/ext/utf-gnuxx98.C +++ b/gcc/testsuite/g++.dg/ext/utf-gnuxx98.C @@ -8,9 +8,7 @@ const static char16_t c0 = 'a'; /* { dg-error "not name a type" } */ const static char32_t c1 = 'a'; /* { dg-error "not name a type" } */ const unsigned short c2 = u'a'; /* { dg-error "not declared" } */ - /* { dg-error "expected ',' or ';'" "" { target *-*-* } 10 } */ const unsigned long c3 = U'a'; /* { dg-error "not declared" } */ - /* { dg-error "expected ',' or ';'" "" { target *-*-* } 12 } */ #define u 1 + #define U 2 + diff --git a/gcc/testsuite/g++.dg/parse/error48.C b/gcc/testsuite/g++.dg/parse/error48.C new file mode 100644 index 00000000000..8f26bed9c20 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/error48.C @@ -0,0 +1,10 @@ +// PR c++/44516 + +struct WebService { }; +struct Server { }; + +void addHTTPService(Server const &server, + WebService const *http) +{ + server += http; // { dg-error "10:no match for 'operator\\+='" } +} diff --git a/gcc/testsuite/g++.dg/parse/error49.C b/gcc/testsuite/g++.dg/parse/error49.C new file mode 100644 index 00000000000..d5ec0c87ef6 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/error49.C @@ -0,0 +1,6 @@ +// PR c++/39681 + +int main() +{ + int* p = new foo; // { dg-error "16:expected type-specifier" } +} diff --git a/gcc/testsuite/g++.dg/system-binary-constants-1.C b/gcc/testsuite/g++.dg/system-binary-constants-1.C new file mode 100644 index 00000000000..7ef26f7f011 --- /dev/null +++ b/gcc/testsuite/g++.dg/system-binary-constants-1.C @@ -0,0 +1,18 @@ +/* + Origin: Dodji Seketeli <dodji@redhat.com> + { dg-options "-std=c++98 -pedantic" } + { dg-do compile } + */ + +#include "system-binary-constants-1.h" + +int +foo (void) +{ +#if BINARY_INT_CONSTANT_IN_SYSTEM_HEADER /* A binary constant defined + in system header. No + warning. */ + return 23; +#endif + return 0b1101; /* { dg-warning "binary constants are a GCC extension" } */ +} diff --git a/gcc/testsuite/g++.dg/system-binary-constants-1.h b/gcc/testsuite/g++.dg/system-binary-constants-1.h new file mode 100644 index 00000000000..85f291742ff --- /dev/null +++ b/gcc/testsuite/g++.dg/system-binary-constants-1.h @@ -0,0 +1,3 @@ +#pragma GCC system_header + +#define BINARY_INT_CONSTANT_IN_SYSTEM_HEADER 0b1101 diff --git a/gcc/testsuite/g++.dg/template/crash89.C b/gcc/testsuite/g++.dg/template/crash89.C index e62b57a3928..f860018621e 100644 --- a/gcc/testsuite/g++.dg/template/crash89.C +++ b/gcc/testsuite/g++.dg/template/crash89.C @@ -1,8 +1,8 @@ // PR c++/34397 -template<typename T, int = T()[0]> struct A +template<typename T, int = T()[0]> struct A // { dg-error "subscripted|template" } { typedef A<T> B; }; -A<int> a; // { dg-error "subscripted|template|declaration" } +A<int> a; // { dg-error "declaration" } diff --git a/gcc/testsuite/g++.dg/torture/pr53364.C b/gcc/testsuite/g++.dg/torture/pr53364.C new file mode 100644 index 00000000000..36bb083e828 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr53364.C @@ -0,0 +1,37 @@ +// { dg-do run } + +extern "C" void abort (void); + +template<typename _Tp> +inline const _Tp& +min(const _Tp& __a, const _Tp& __b) +{ + if (__b < __a) + return __b; + return __a; +} + +struct A +{ + int m_x; + + explicit A(int x) : m_x(x) {} + operator int() const { return m_x; } +}; + +struct B : public A +{ +public: + explicit B(int x) : A(x) {} +}; + +int data = 1; + +int main() +{ + B b = B(10); + b = min(b, B(data)); + if (b != 1) + abort (); + return 0; +} diff --git a/gcc/testsuite/g++.dg/warn/Wtype-limits-Wextra.C b/gcc/testsuite/g++.dg/warn/Wtype-limits-Wextra.C index 9cbdbe54783..f840f306b7d 100644 --- a/gcc/testsuite/g++.dg/warn/Wtype-limits-Wextra.C +++ b/gcc/testsuite/g++.dg/warn/Wtype-limits-Wextra.C @@ -66,7 +66,7 @@ int test (int x) template <typename Int, Int D> void f(Int x) { - assert(0 <= x and x <= D); // { dg-warning "comparison is always true due to limited range of data type" } + assert(0 <= x and x <= D); } int ff(void) { diff --git a/gcc/testsuite/g++.dg/warn/Wtype-limits.C b/gcc/testsuite/g++.dg/warn/Wtype-limits.C index 814c2a8826e..a352e7ba9bb 100644 --- a/gcc/testsuite/g++.dg/warn/Wtype-limits.C +++ b/gcc/testsuite/g++.dg/warn/Wtype-limits.C @@ -66,7 +66,7 @@ int test (int x) template <typename Int, Int D> void f(Int x) { - assert(0 <= x and x <= D); // { dg-warning "comparison is always true due to limited range of data type" } + assert(0 <= x and x <= D); } int ff(void) { diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash10.C b/gcc/testsuite/g++.old-deja/g++.pt/crash10.C index 2f785b4b9e6..5e87876147c 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/crash10.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/crash10.C @@ -3,7 +3,7 @@ template<int M, int N> class GCD { public: - enum { val = (N == 0) ? M : GCD<N, M % N>::val }; // { dg-warning "division" "division" } + enum { val = (N == 0) ? M : GCD<N, M % N>::val }; // { dg-error "constant expression" "valid" { target *-*-* } 6 } // { dg-message "template argument" "valid" { target *-*-* } 6 } }; diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb109.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb109.C index f3490762621..b44c33d273c 100644 --- a/gcc/testsuite/g++.old-deja/g++.robertl/eb109.C +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb109.C @@ -44,16 +44,16 @@ ostream& operator<<(ostream& os, Graph<VertexType,EdgeType>& G) // display of vertices with successors for(int i = 0; i < G.size(); ++i) // { dg-error "no member" } no size function { - os << G[i].first << " <"; // { dg-error "no match" } no index operator + os << G[i].first << " <"; // { dg-error "14:no match" } no index operator // The compiler does not like this line!!!!!! typename Graph<VertexType, EdgeType>::Successor::iterator - startN = G[i].second.begin(), // { dg-error "no match" } no index operator - endN = G[i].second.end(); // { dg-error "no match" } no index operator + startN = G[i].second.begin(), // { dg-error "14:no match" } no index operator + endN = G[i].second.end(); // { dg-error "14:no match" } no index operator while(startN != endN) { - os << G[(*startN).first].first << ' ' // { dg-error "no match" } no index operator + os << G[(*startN).first].first << ' ' // { dg-error "20:no match" } no index operator << (*startN).second << ' '; ++startN; } diff --git a/gcc/testsuite/gcc.c-torture/execute/pr52979-1.x b/gcc/testsuite/gcc.c-torture/execute/pr52979-1.x new file mode 100644 index 00000000000..4efed4c325f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr52979-1.x @@ -0,0 +1,7 @@ +load_lib target-supports.exp + +if { [check_effective_target_int32plus] } { + return 0 +} + +return 1; diff --git a/gcc/testsuite/gcc.c-torture/execute/pr52979-2.x b/gcc/testsuite/gcc.c-torture/execute/pr52979-2.x new file mode 100644 index 00000000000..4efed4c325f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr52979-2.x @@ -0,0 +1,7 @@ +load_lib target-supports.exp + +if { [check_effective_target_int32plus] } { + return 0 +} + +return 1; diff --git a/gcc/testsuite/gcc.dg/binary-constants-2.c b/gcc/testsuite/gcc.dg/binary-constants-2.c index 40d76364656..6c3928aa2a0 100644 --- a/gcc/testsuite/gcc.dg/binary-constants-2.c +++ b/gcc/testsuite/gcc.dg/binary-constants-2.c @@ -2,7 +2,7 @@ /* Origin: Joerg Wunsch <j.gnu@uriah.heep.sax.de>. */ /* { dg-do compile } */ -/* { dg-options "-std=iso9899:1999 -pedantic" } */ +/* { dg-options "-std=iso9899:1999 -pedantic -ftrack-macro-expansion=0" } */ #define FOO 0b1101 diff --git a/gcc/testsuite/gcc.dg/binary-constants-3.c b/gcc/testsuite/gcc.dg/binary-constants-3.c index 984477dca18..410fc4cd725 100644 --- a/gcc/testsuite/gcc.dg/binary-constants-3.c +++ b/gcc/testsuite/gcc.dg/binary-constants-3.c @@ -2,7 +2,7 @@ /* Origin: Joerg Wunsch <j.gnu@uriah.heep.sax.de>. */ /* { dg-do compile } */ -/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors -ftrack-macro-expansion=0" } */ #define FOO 0b1101 diff --git a/gcc/testsuite/gcc.dg/cpp/pr7263-3.c b/gcc/testsuite/gcc.dg/cpp/pr7263-3.c index efa619ad3cd..225b659754c 100644 --- a/gcc/testsuite/gcc.dg/cpp/pr7263-3.c +++ b/gcc/testsuite/gcc.dg/cpp/pr7263-3.c @@ -1,6 +1,6 @@ /* PR 7263: __extension__ keyword doesn't suppress warning on LL or ULL constants. */ /* { dg-do compile } */ -/* { dg-options "-std=c99 -pedantic-errors" } */ +/* { dg-options "-std=c99 -pedantic-errors -ftrack-macro-expansion=0" } */ #include "pr7263-3.h" __complex__ bar () /* { dg-error "ISO C does not support plain .complex. meaning .double complex." } */ { diff --git a/gcc/testsuite/gcc.dg/cpp/syshdr3.c b/gcc/testsuite/gcc.dg/cpp/syshdr3.c new file mode 100644 index 00000000000..15749ff9961 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/syshdr3.c @@ -0,0 +1,16 @@ +/* Contributed by Dodji Seketeli <dodji@redhat.com> */ +/* Origin: PR preprocessor/7263 */ +/* { dg-options "-pedantic -std=c89 -ftrack-macro-expansion=1" } */ +/* { dg-do compile } */ + +/* This tests the proprer suppression of warning coming from macro + defined in system headers and expanded in a non-system header + location. */ +#include "syshdr3.h" + +static _Complex float c = _Complex_I + _Complex_I; /* These macros are defined in + system header so we should + have no warning here. */ +U_LL u = ONE_ULL; /* Likewise here. */ + +unsigned long long v = 1ULL; /* { dg-warning "long long" } */ diff --git a/gcc/testsuite/gcc.dg/cpp/syshdr3.h b/gcc/testsuite/gcc.dg/cpp/syshdr3.h new file mode 100644 index 00000000000..e5d502a24f5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/syshdr3.h @@ -0,0 +1,7 @@ +#pragma GCC system_header + +#define _Complex __complex__ +#define _Complex_I 1.0iF + +#define U_LL unsigned long long +#define ONE_ULL 1ULL diff --git a/gcc/testsuite/gcc.dg/cpp/sysmac1.c b/gcc/testsuite/gcc.dg/cpp/sysmac1.c index fa741a4262d..cc8469e18c7 100644 --- a/gcc/testsuite/gcc.dg/cpp/sysmac1.c +++ b/gcc/testsuite/gcc.dg/cpp/sysmac1.c @@ -1,7 +1,7 @@ /* Copyright (C) 2001 Free Software Foundation, Inc. */ /* { dg-do preprocess } */ -/* { dg-options "-std=gnu99 -pedantic -Wtraditional" } */ +/* { dg-options "-std=gnu99 -pedantic -Wtraditional -ftrack-macro-expansion=0" } */ /* Tests diagnostics are suppressed for some macros defined in system headers. */ diff --git a/gcc/testsuite/gcc.dg/cpp/sysmac2.c b/gcc/testsuite/gcc.dg/cpp/sysmac2.c index 6d493a9ed1b..cdba668a03f 100644 --- a/gcc/testsuite/gcc.dg/cpp/sysmac2.c +++ b/gcc/testsuite/gcc.dg/cpp/sysmac2.c @@ -1,7 +1,7 @@ /* Copyright (C) 2001 Free Software Foundation, Inc. */ /* { dg-do compile } */ -/* { dg-options "-std=gnu99 -pedantic -Wtraditional" } */ +/* { dg-options "-std=gnu99 -pedantic -Wtraditional -ftrack-macro-expansion=0" } */ /* Tests diagnostics are suppressed for some macros defined in system headers. */ diff --git a/gcc/testsuite/gcc.dg/nofixed-point-2.c b/gcc/testsuite/gcc.dg/nofixed-point-2.c index 5b2f2095018..8442a1984cf 100644 --- a/gcc/testsuite/gcc.dg/nofixed-point-2.c +++ b/gcc/testsuite/gcc.dg/nofixed-point-2.c @@ -20,10 +20,10 @@ f3 (void) return 0k; /* { dg-error "not supported" "reject fixed-point" } */ } -_Sat -f4 (void) /* { dg-error "not supported" "reject fixed-point" } */ +_Sat /* { dg-error "not supported" "reject fixed-point" } */ +f4 (void) { return 0k; /* { dg-error "not supported" "reject fixed-point" } */ } -/* { dg-error "is used without" "" { target *-*-* } 24 } */ +/* { dg-error "is used without" "" { target *-*-* } 23 } */ diff --git a/gcc/testsuite/gcc.dg/pr52549.c b/gcc/testsuite/gcc.dg/pr52549.c index 89ec2aaf6cc..382f77d0594 100644 --- a/gcc/testsuite/gcc.dg/pr52549.c +++ b/gcc/testsuite/gcc.dg/pr52549.c @@ -1,6 +1,13 @@ /* { dg-do compile } */ +#if __SIZEOF_POINTER__ == __SIZEOF_LONG__ _mark (long obj, int i, char *a) { (char *)&(((long *)(obj)) [i]) - a; } +#elif __SIZEOF_POINTER__ == __SIZEOF_INT__ +_mark (int obj, int i, char *a) +{ + (char *)&(((int *)(obj)) [i]) - a; +} +#endif diff --git a/gcc/testsuite/gcc.dg/pr53352.c b/gcc/testsuite/gcc.dg/pr53352.c new file mode 100644 index 00000000000..171bcd71ec1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr53352.c @@ -0,0 +1,42 @@ +/* { dg-do run } */ +/* { dg-options "-O1" } */ + +#include <stdlib.h> + +typedef union +{ + struct + { + unsigned char a; + unsigned char b; + unsigned char c; + unsigned char d; + } parts; + unsigned long whole; +} T; + +T *g_t; + +void bar (unsigned long x) +{ + if (x != 0) + abort (); +} + +int main () +{ + T one; + T two; + T tmp1, tmp2; + + one.whole = 0xFFE0E0E0UL; + two.whole = 0xFF000000UL; + tmp1.parts = two.parts; + tmp2.parts = one.parts; + tmp2.parts.c = tmp1.parts.c; + one.parts = tmp2.parts; + + g_t = &one; + bar (0); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/pr53358.c b/gcc/testsuite/gcc.dg/pr53358.c new file mode 100644 index 00000000000..494090a42df --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr53358.c @@ -0,0 +1,22 @@ +/* PR target/53358 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +/* { dg-additional-options "-fpic" { target fpic } } */ +/* { dg-additional-options "-mtune=pentium4" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */ + +struct S { unsigned char s, t[17]; }; +int bar (void); + +void +foo (struct S *x) +{ + unsigned char i, z; + if (bar ()) + { + z = bar (); + bar (); + x->s += z; + for (i = 0; i < x->s; i++) + x->t[i] = bar (); + } +} diff --git a/gcc/testsuite/gcc.dg/system-binary-constants-1.c b/gcc/testsuite/gcc.dg/system-binary-constants-1.c new file mode 100644 index 00000000000..921ee208635 --- /dev/null +++ b/gcc/testsuite/gcc.dg/system-binary-constants-1.c @@ -0,0 +1,18 @@ +/* + Origin: Dodji Seketeli <dodji@redhat.com> + { dg-options "-std=iso9899:1999 -pedantic" } + { dg-do compile } + */ + +#include "system-binary-constants-1.h" + +int +foo (void) +{ +#if BINARY_INT_CONSTANT_IN_SYSTEM_HEADER /* A binary constant defined + in system header. No + warning. */ + return 23; +#endif + return 0b1101; /* { dg-warning "binary constants are a GCC extension" } */ +} diff --git a/gcc/testsuite/gcc.dg/system-binary-constants-1.h b/gcc/testsuite/gcc.dg/system-binary-constants-1.h new file mode 100644 index 00000000000..85f291742ff --- /dev/null +++ b/gcc/testsuite/gcc.dg/system-binary-constants-1.h @@ -0,0 +1,3 @@ +#pragma GCC system_header + +#define BINARY_INT_CONSTANT_IN_SYSTEM_HEADER 0b1101 diff --git a/gcc/testsuite/gcc.dg/tm/indirect-2.c b/gcc/testsuite/gcc.dg/tm/indirect-2.c new file mode 100644 index 00000000000..dd7168f0519 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tm/indirect-2.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-fgnu-tm" } */ + +void __attribute__((transaction_safe)) +foo(void); + +void __attribute__((transaction_safe)) +set_fn(void) +{ + void __attribute__((transaction_safe)) (*fn)(void); + fn = foo; + fn(); +} + +/* { dg-final { scan-assembler "_ITM_getTMCloneSafe" } } */ diff --git a/gcc/testsuite/gcc.dg/torture/pr53390.c b/gcc/testsuite/gcc.dg/torture/pr53390.c new file mode 100644 index 00000000000..72a25c52eac --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr53390.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ + +extern unsigned short var1; +extern int var2; + +extern struct { + int f1; + unsigned short *f2; +} *my_table; + +void foo(void) +{ + unsigned short *local_vec + = __builtin_malloc(var1 * var2 * sizeof(unsigned short)); + unsigned short i; + + my_table[0].f2 = __builtin_malloc(var1 * sizeof(unsigned short)); + + for (i = 0; i < var1; ++i) + my_table[0].f2[i] = local_vec[i * var2]; +} diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ldist-18.c b/gcc/testsuite/gcc.dg/tree-ssa/ldist-18.c new file mode 100644 index 00000000000..893ab8b703b --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ldist-18.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-loop-distribute-patterns -fdump-tree-ldist-details" } */ + +void foo (int *p, int n) +{ + int i; + for (i = 0; i < n; ++i) + p[i] = 0; +} + +/* { dg-final { scan-tree-dump "generated memset zero" "ldist" } } */ +/* { dg-final { cleanup-tree-dump "ldist" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp67.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp67.c new file mode 100644 index 00000000000..f02d83780a6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp67.c @@ -0,0 +1,38 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-vrp1" } */ + +unsigned foo (unsigned i) +{ + if (i == 2) + { + i = i << 2; + if (i != 8) + link_error (); + } + return i; +} +unsigned bar (unsigned i) +{ + if (i == 1 << (sizeof (unsigned) * 8 - 1)) + { + i = i << 1; + if (i != 0) + link_error (); + } + return i; +} +unsigned baz (unsigned i) +{ + i = i & 15; + if (i == 0) + return 0; + i = 1000 - i; + i >>= 1; + i <<= 1; + if (i == 0) + link_error (); + return i; +} + +/* { dg-final { scan-tree-dump-times "Folding predicate" 3 "vrp1" } } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */ diff --git a/gcc/testsuite/gcc.target/i386/incoming-10.c b/gcc/testsuite/gcc.target/i386/incoming-10.c index 1fb9ef4f0f9..612fa720888 100644 --- a/gcc/testsuite/gcc.target/i386/incoming-10.c +++ b/gcc/testsuite/gcc.target/i386/incoming-10.c @@ -12,7 +12,7 @@ void f() { int i; struct s s; - for (i = 0; i < sizeof(s.x) / sizeof(*s.x); i++) s.x[i] = 0; + for (i = 0; i < sizeof(s.x) / sizeof(*s.x); i++) s.x[i] = 1; g(&s); } diff --git a/gcc/testsuite/gcc.target/i386/incoming-11.c b/gcc/testsuite/gcc.target/i386/incoming-11.c index a7b7db53aa8..a830c96f7d1 100644 --- a/gcc/testsuite/gcc.target/i386/incoming-11.c +++ b/gcc/testsuite/gcc.target/i386/incoming-11.c @@ -10,9 +10,9 @@ int q[100]; void f() { int i; - for (i = 0; i < 100; i++) p[i] = 0; + for (i = 0; i < 100; i++) p[i] = 1; g(); - for (i = 0; i < 100; i++) q[i] = 0; + for (i = 0; i < 100; i++) q[i] = 1; } /* { dg-final { scan-assembler "andl\[\\t \]*\\$-16,\[\\t \]*%esp" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr46295.c b/gcc/testsuite/gcc.target/i386/pr46295.c index b7fccb7fb34..4ac7c101abb 100644 --- a/gcc/testsuite/gcc.target/i386/pr46295.c +++ b/gcc/testsuite/gcc.target/i386/pr46295.c @@ -9,7 +9,7 @@ void Parse_Vector () EXPRESS Express; int Terms; for (Terms = 0; Terms < 5; Terms++) - Express[Terms] = 0.0; + Express[Terms] = 1.0; Parse_Rel_Factor(Express,&Terms); } diff --git a/gcc/testsuite/gfortran.dg/bessel_7.f90 b/gcc/testsuite/gfortran.dg/bessel_7.f90 index 78f1ff25128..7e63ed1e859 100644 --- a/gcc/testsuite/gfortran.dg/bessel_7.f90 +++ b/gcc/testsuite/gfortran.dg/bessel_7.f90 @@ -16,7 +16,7 @@ implicit none real,parameter :: values(*) = [0.0, 0.5, 1.0, 0.9, 1.8,2.0,3.0,4.0,4.25,8.0,34.53, 475.78] real,parameter :: myeps(size(values)) = epsilon(0.0) & - * [2, 3, 4, 5, 8, 2, 12, 6, 7, 6, 31, 168 ] + * [2, 3, 4, 5, 8, 2, 12, 6, 7, 6, 36, 168 ] ! The following is sufficient for me - the values above are a bit ! more tolerant ! * [0, 0, 0, 3, 3, 0, 9, 0, 2, 1, 22, 130 ] diff --git a/gcc/testsuite/gfortran.dg/pr53217.f90 b/gcc/testsuite/gfortran.dg/pr53217.f90 new file mode 100644 index 00000000000..82f34f0646b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr53217.f90 @@ -0,0 +1,28 @@ +! { dg-do compile } +! { dg-options "-O3 -ffast-math" } + +! This tests only for compile-time failure, which formerly occurred +! when statements were emitted out of order, failing verify_ssa. + +MODULE xc_cs1 + INTEGER, PARAMETER :: dp=KIND(0.0D0) + REAL(KIND=dp), PARAMETER :: a = 0.04918_dp, & + c = 0.2533_dp, & + d = 0.349_dp +CONTAINS + SUBROUTINE cs1_u_2 ( rho, grho, r13, e_rho_rho, e_rho_ndrho, e_ndrho_ndrho,& + npoints, error) + REAL(KIND=dp), DIMENSION(*), & + INTENT(INOUT) :: e_rho_rho, e_rho_ndrho, & + e_ndrho_ndrho + DO ip = 1, npoints + IF ( rho(ip) > eps_rho ) THEN + oc = 1.0_dp/(r*r*r3*r3 + c*g*g) + d2rF4 = c4p*f13*f23*g**4*r3/r * (193*d*r**5*r3*r3+90*d*d*r**5*r3 & + -88*g*g*c*r**3*r3-100*d*d*c*g*g*r*r*r3*r3 & + +104*r**6)*od**3*oc**4 + e_rho_rho(ip) = e_rho_rho(ip) + d2F1 + d2rF2 + d2F3 + d2rF4 + END IF + END DO + END SUBROUTINE cs1_u_2 +END MODULE xc_cs1 diff --git a/gcc/testsuite/gnat.dg/lto13.adb b/gcc/testsuite/gnat.dg/lto13.adb new file mode 100644 index 00000000000..7c7fe16043f --- /dev/null +++ b/gcc/testsuite/gnat.dg/lto13.adb @@ -0,0 +1,9 @@ +-- { dg-do link } +-- { dg-options "-g -flto" { target lto } } + +with Lto13_Pkg; use Lto13_Pkg; + +procedure Lto13 is +begin + Proc; +end; diff --git a/gcc/testsuite/gnat.dg/lto13_pkg.adb b/gcc/testsuite/gnat.dg/lto13_pkg.adb new file mode 100644 index 00000000000..f8b5057a15e --- /dev/null +++ b/gcc/testsuite/gnat.dg/lto13_pkg.adb @@ -0,0 +1,10 @@ +package body Lto13_Pkg is + + procedure Proc is + begin + raise Constraint_Error; + end; + + type T is null record; + +end Lto13_Pkg; diff --git a/gcc/testsuite/gnat.dg/lto13_pkg.ads b/gcc/testsuite/gnat.dg/lto13_pkg.ads new file mode 100644 index 00000000000..ce91d1c018c --- /dev/null +++ b/gcc/testsuite/gnat.dg/lto13_pkg.ads @@ -0,0 +1,9 @@ +package Lto13_Pkg is + + procedure Proc; + +private + + type T; + +end Lto13_Pkg; diff --git a/gcc/testsuite/gnat.dg/specs/lto12.ads b/gcc/testsuite/gnat.dg/specs/lto12.ads new file mode 100644 index 00000000000..3914e0f90b3 --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/lto12.ads @@ -0,0 +1,10 @@ +-- { dg-do compile } +-- { dg-options "-flto" { target lto } } + +with Lto12_Pkg; use Lto12_Pkg; + +package Lto12 is + + C : constant R := F; + +end Lto12; diff --git a/gcc/testsuite/gnat.dg/specs/lto12_pkg.ads b/gcc/testsuite/gnat.dg/specs/lto12_pkg.ads new file mode 100644 index 00000000000..02ee491b5db --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/lto12_pkg.ads @@ -0,0 +1,14 @@ +-- { dg-excess-errors "cannot generate code" } + +package Lto12_Pkg is + + type R (Kind : Boolean := False) is record + case Kind is + when True => I : Integer; + when others => null; + end case; + end record; + + function F return R; + +end Lto12_Pkg; |