diff options
| author | mrg <mrg@NetBSD.org> | 2008-02-03 00:08:23 +0000 |
|---|---|---|
| committer | mrg <mrg@NetBSD.org> | 2008-02-03 00:08:23 +0000 |
| commit | a67241065bbeabb40c83fc63809e53159e55ef76 (patch) | |
| tree | d2fb00d8e65956e5148c718f1bac6d240d037865 /gnu/dist | |
| parent | b8deac4d699c881e1c4db83f3647a9641b57ed00 (diff) | |
upgrade to GCC-4.1 20080202 (svn 132073). this includes fixes for
these GCC PR's:
c++/17763
middle-end/25445
c++/27177
target/28307
rtl-optimization/30113
target/31331
c++/31941
rtl-optimization/31944
tree-optimization/31966
c++/32112
c++/32113
rtl-optimization/32450
target/32506
tree-optimization/32533
target/32641
target/32660
tree-optimization/32681
middle-end/32912
c++/32992
tree-optimization/33142
target/33256
bootstrap/33418
c++/33744
driver/33772
rtl-optimization/33822
middle-end/33826
c++/33959
bootstrap/34003
middle-end/34030
middle-end/34130
rtl-optimization/34456
libgfortran/34699
c/34993
c++/35007
Diffstat (limited to 'gnu/dist')
35 files changed, 722 insertions, 47 deletions
diff --git a/gnu/dist/gcc4/gcc/testsuite/gcc.c-torture/compile/20071102-1.c b/gnu/dist/gcc4/gcc/testsuite/gcc.c-torture/compile/20071102-1.c new file mode 100644 index 00000000000..03b015628cd --- /dev/null +++ b/gnu/dist/gcc4/gcc/testsuite/gcc.c-torture/compile/20071102-1.c @@ -0,0 +1,32 @@ +/* PR rtl-optimization/28062 */ +/* Original testcase by Martin Michlmayr <tbm@cyrius.com> */ +/* C testcase by Andrew Pinski <pinskia@gcc.gnu.org> */ + +struct _NSPoint +{ + float x; + float y; +}; + +typedef struct _NSPoint NSPoint; + +static inline NSPoint +NSMakePoint (float x, float y) +{ + NSPoint point; + point.x = x; + point.y = y; + return point; +} + +static inline NSPoint +RelativePoint (NSPoint point, NSPoint refPoint) +{ + return NSMakePoint (refPoint.x + point.x, refPoint.y + point.y); +} + +NSPoint g(NSPoint refPoint) +{ + float pointA, pointB; + return RelativePoint (NSMakePoint (0, pointA), refPoint); +} diff --git a/gnu/dist/gcc4/gcc/testsuite/gcc.c-torture/compile/20080114-1.c b/gnu/dist/gcc4/gcc/testsuite/gcc.c-torture/compile/20080114-1.c new file mode 100644 index 00000000000..f251c22b96e --- /dev/null +++ b/gnu/dist/gcc4/gcc/testsuite/gcc.c-torture/compile/20080114-1.c @@ -0,0 +1,14 @@ +/* PR rtl-optimization/31944 */ +/* Origin: Aurelien Jarno <aurelien@aurel32.net> */ + +int type; + +void stuck(int res) +{ + if (type == 1) { + if (res == 0) asm volatile(""); + } + else if (type == 0) { + if (res == 0) asm volatile("" : : "i" (0)); + } +} diff --git a/gnu/dist/gcc4/gcc/testsuite/gcc.c-torture/compile/pr34030.c b/gnu/dist/gcc4/gcc/testsuite/gcc.c-torture/compile/pr34030.c new file mode 100644 index 00000000000..f4f9e176d3f --- /dev/null +++ b/gnu/dist/gcc4/gcc/testsuite/gcc.c-torture/compile/pr34030.c @@ -0,0 +1,8 @@ +int myvar; + +int foo(int mynum) +{ + if ((((void *)0) == (myvar & ((1U<<0) << mynum))) && (mynum > 0)) + return 1; + return 0; +} diff --git a/gnu/dist/gcc4/gcc/testsuite/gcc.c-torture/compile/pr34993.c b/gnu/dist/gcc4/gcc/testsuite/gcc.c-torture/compile/pr34993.c new file mode 100644 index 00000000000..ced4d5646c1 --- /dev/null +++ b/gnu/dist/gcc4/gcc/testsuite/gcc.c-torture/compile/pr34993.c @@ -0,0 +1,5 @@ +/* PR c/34993 */ + +/* { dg-do compile } */ + +typedef int x[] __attribute((may_alias)); diff --git a/gnu/dist/gcc4/gcc/testsuite/gcc.c-torture/execute/builtins/chk.h b/gnu/dist/gcc4/gcc/testsuite/gcc.c-torture/execute/builtins/chk.h index dfef410c61b..f91ec78c4ec 100644 --- a/gnu/dist/gcc4/gcc/testsuite/gcc.c-torture/execute/builtins/chk.h +++ b/gnu/dist/gcc4/gcc/testsuite/gcc.c-torture/execute/builtins/chk.h @@ -79,3 +79,11 @@ extern volatile int memset_disallowed, strcpy_disallowed, stpcpy_disallowed; extern volatile int strncpy_disallowed, strcat_disallowed, strncat_disallowed; extern volatile int sprintf_disallowed, vsprintf_disallowed; extern volatile int snprintf_disallowed, vsnprintf_disallowed; + +/* A storage class that ensures that declarations bind locally. We want + to test non-static declarations where we know it is safe to do so. */ +#if __PIC__ || __pic__ +#define LOCAL static +#else +#define LOCAL +#endif diff --git a/gnu/dist/gcc4/gcc/testsuite/gcc.c-torture/execute/builtins/sprintf-chk.c b/gnu/dist/gcc4/gcc/testsuite/gcc.c-torture/execute/builtins/sprintf-chk.c index 95d2a9d2826..2862ab6dc91 100644 --- a/gnu/dist/gcc4/gcc/testsuite/gcc.c-torture/execute/builtins/sprintf-chk.c +++ b/gnu/dist/gcc4/gcc/testsuite/gcc.c-torture/execute/builtins/sprintf-chk.c @@ -13,7 +13,7 @@ extern int sprintf (char *, const char *, ...); #include "chk.h" -const char s1[] = "123"; +LOCAL const char s1[] = "123"; char p[32] = ""; char *s2 = "defg"; char *s3 = "FGH"; diff --git a/gnu/dist/gcc4/gcc/testsuite/gcc.c-torture/execute/builtins/stpcpy-chk.c b/gnu/dist/gcc4/gcc/testsuite/gcc.c-torture/execute/builtins/stpcpy-chk.c index b292c0aec87..6091f129359 100644 --- a/gnu/dist/gcc4/gcc/testsuite/gcc.c-torture/execute/builtins/stpcpy-chk.c +++ b/gnu/dist/gcc4/gcc/testsuite/gcc.c-torture/execute/builtins/stpcpy-chk.c @@ -11,7 +11,7 @@ extern int memcmp (const void *, const void *, size_t); #include "chk.h" -const char s1[] = "123"; +LOCAL const char s1[] = "123"; char p[32] = ""; char *s2 = "defg"; char *s3 = "FGH"; diff --git a/gnu/dist/gcc4/gcc/testsuite/gcc.c-torture/execute/builtins/strcpy-chk.c b/gnu/dist/gcc4/gcc/testsuite/gcc.c-torture/execute/builtins/strcpy-chk.c index 002dd19500e..b3c1a3899d9 100644 --- a/gnu/dist/gcc4/gcc/testsuite/gcc.c-torture/execute/builtins/strcpy-chk.c +++ b/gnu/dist/gcc4/gcc/testsuite/gcc.c-torture/execute/builtins/strcpy-chk.c @@ -11,7 +11,7 @@ extern int memcmp (const void *, const void *, size_t); #include "chk.h" -const char s1[] = "123"; +LOCAL const char s1[] = "123"; char p[32] = ""; char *s2 = "defg"; char *s3 = "FGH"; diff --git a/gnu/dist/gcc4/gcc/testsuite/gcc.c-torture/execute/pr33142.c b/gnu/dist/gcc4/gcc/testsuite/gcc.c-torture/execute/pr33142.c new file mode 100644 index 00000000000..7bfc5b584db --- /dev/null +++ b/gnu/dist/gcc4/gcc/testsuite/gcc.c-torture/execute/pr33142.c @@ -0,0 +1,16 @@ +int abs(int j); +extern void abort(void); + +__attribute__((noinline)) int lisp_atan2(long dy, long dx) { + if (dx <= 0) + if (dy > 0) + return abs(dx) <= abs(dy); + return 0; +} + +int main() { + volatile long dy = 63, dx = -77; + if (lisp_atan2(dy, dx)) + abort(); + return 0; +} diff --git a/gnu/dist/gcc4/gcc/testsuite/gcc.c-torture/execute/pr34130.c b/gnu/dist/gcc4/gcc/testsuite/gcc.c-torture/execute/pr34130.c new file mode 100644 index 00000000000..b528ff22b8a --- /dev/null +++ b/gnu/dist/gcc4/gcc/testsuite/gcc.c-torture/execute/pr34130.c @@ -0,0 +1,12 @@ +extern void abort (void); +int foo (int i) +{ + return -2 * __builtin_abs(i - 2); +} +int main() +{ + if (foo(1) != -2 + || foo(3) != -2) + abort (); + return 0; +} diff --git a/gnu/dist/gcc4/gcc/testsuite/gcc.c-torture/execute/pr34456.c b/gnu/dist/gcc4/gcc/testsuite/gcc.c-torture/execute/pr34456.c new file mode 100644 index 00000000000..526c954e55a --- /dev/null +++ b/gnu/dist/gcc4/gcc/testsuite/gcc.c-torture/execute/pr34456.c @@ -0,0 +1,30 @@ +#include <stdlib.h> + +int __attribute__ ((noinline)) debug (void) { return 1; } +int errors; + +struct s { int elt; int (*compare) (int); }; + +static int +compare (const void *x, const void *y) +{ + const struct s *s1 = x, *s2 = y; + int (*compare1) (int); + int elt2; + + compare1 = s1->compare; + elt2 = s2->elt; + if (elt2 != 0 && debug () && compare1 (s1->elt) != 0) + errors++; + return compare1 (elt2); +} + +int bad_compare (int x) { return -x; } +struct s array[2] = { { 1, bad_compare }, { -1, bad_compare } }; + +int +main (void) +{ + qsort (array, 2, sizeof (struct s), compare); + return errors == 0; +} diff --git a/gnu/dist/gcc4/gcc/testsuite/gcc.dg/20070801-1.c b/gnu/dist/gcc4/gcc/testsuite/gcc.dg/20070801-1.c new file mode 100644 index 00000000000..d6a034cd13d --- /dev/null +++ b/gnu/dist/gcc4/gcc/testsuite/gcc.dg/20070801-1.c @@ -0,0 +1,62 @@ +/* This failed on s390x due to a back end bug. */ + +/* { dg-do compile { target fpic } } */ +/* { dg-options "-O2 -fpic" } */ + +typedef long unsigned int size_t; +typedef enum +{ + TYPE_SCHAR, TYPE_LONGDOUBLE +} +arg_type; + +typedef struct +{ + arg_type type; + union + { + signed char a_schar; + long double a_longdouble; + } + a; +} +argument; + +typedef struct +{ + argument *arg; +} +arguments; + +int ind; + +extern void foo (arguments *a); + +void +bar () +{ + arguments a; + char *buf; + char *result; + int uninitialized; + int count, i; + int retcount; + + foo (&a); + + switch (a.arg[ind].type) + { + case TYPE_SCHAR: + { + if (uninitialized == 0) + __builtin___snprintf_chk (result, 10, 1, 10, buf, 1, &count); + } + case TYPE_LONGDOUBLE: + { + long double arg = a.arg[ind].a.a_longdouble; + + if (uninitialized == 0) + __builtin___snprintf_chk (result, 10, 1, 10, buf, arg, &count); + } + } +} diff --git a/gnu/dist/gcc4/gcc/testsuite/gcc.dg/assign-warn-3.c b/gnu/dist/gcc4/gcc/testsuite/gcc.dg/assign-warn-3.c index 1463fce0f68..4ff7b88fa5f 100644 --- a/gnu/dist/gcc4/gcc/testsuite/gcc.dg/assign-warn-3.c +++ b/gnu/dist/gcc4/gcc/testsuite/gcc.dg/assign-warn-3.c @@ -5,9 +5,9 @@ /* { dg-options "-O3 -std=c99 -pedantic-errors" } */ /* This is valid to execute, so maybe shouldn't warn at all. */ -void f0(x) signed char *x; { } +static inline void f0(x) signed char *x; { } void g0(unsigned char *x) { f0(x); } /* { dg-warning "warning: pointer targets in passing argument 1 of 'f0' differ in signedness" } */ /* This is undefined on execution but still must compile. */ -void f1(x) int *x; { } +static inline void f1(x) int *x; { } void g1(unsigned int *x) { f1(x); } /* { dg-warning "warning: pointer targets in passing argument 1 of 'f1' differ in signedness" } */ diff --git a/gnu/dist/gcc4/gcc/testsuite/gcc.dg/c99-math-double-1.c b/gnu/dist/gcc4/gcc/testsuite/gcc.dg/c99-math-double-1.c index 54bdf60dfe7..6441a59fe1c 100644 --- a/gnu/dist/gcc4/gcc/testsuite/gcc.dg/c99-math-double-1.c +++ b/gnu/dist/gcc4/gcc/testsuite/gcc.dg/c99-math-double-1.c @@ -6,13 +6,17 @@ int main(void) { - double nan = NAN; - double inf = INFINITY; - double huge = HUGE_VAL; - double norm = __DBL_MIN__; - double zero = 0.0; + volatile double nan = NAN; + volatile double inf = INFINITY; + volatile double huge = HUGE_VAL; + volatile double norm1 = __DBL_MIN__; + volatile double norm2 = 1; + volatile double norm3 = __DBL_MAX__; + volatile double sub = __DBL_MIN__ / 2; + volatile double zero = 0.0; - C99_MATH_TESTS (nan, inf, huge, norm, zero) + C99_MATH_TESTS (nan, inf, huge, norm1, norm2, norm3, sub, zero, /*neg=*/0) + C99_MATH_TESTS (-nan, -inf, -huge, -norm1, -norm2, -norm3, -sub, -zero, /*neg=*/1) return 0; } diff --git a/gnu/dist/gcc4/gcc/testsuite/gcc.dg/c99-math-float-1.c b/gnu/dist/gcc4/gcc/testsuite/gcc.dg/c99-math-float-1.c index ba27a710bde..36a73960266 100644 --- a/gnu/dist/gcc4/gcc/testsuite/gcc.dg/c99-math-float-1.c +++ b/gnu/dist/gcc4/gcc/testsuite/gcc.dg/c99-math-float-1.c @@ -6,13 +6,17 @@ int main(void) { - float nan = NAN; - float inf = INFINITY; - float huge = HUGE_VALF; - float norm = __FLT_MIN__; - float zero = 0.0f; + volatile float nan = NAN; + volatile float inf = INFINITY; + volatile float huge = HUGE_VALF; + volatile float norm1 = __FLT_MIN__; + volatile float norm2 = 1; + volatile float norm3 = __FLT_MAX__; + volatile float sub = __FLT_MIN__ / 2; + volatile float zero = 0.0f; - C99_MATH_TESTS (nan, inf, huge, norm, zero) + C99_MATH_TESTS (nan, inf, huge, norm1, norm2, norm3, sub, zero, /*neg=*/0) + C99_MATH_TESTS (-nan, -inf, -huge, -norm1, -norm2, -norm3, -sub, -zero, /*neg=*/1) return 0; } diff --git a/gnu/dist/gcc4/gcc/testsuite/gcc.dg/c99-math-long-double-1.c b/gnu/dist/gcc4/gcc/testsuite/gcc.dg/c99-math-long-double-1.c index a8fa4d21fc1..d8146c28a5a 100644 --- a/gnu/dist/gcc4/gcc/testsuite/gcc.dg/c99-math-long-double-1.c +++ b/gnu/dist/gcc4/gcc/testsuite/gcc.dg/c99-math-long-double-1.c @@ -6,13 +6,17 @@ int main(void) { - long double nan = NAN; - long double inf = INFINITY; - long double huge = HUGE_VALL; - long double norm = __LDBL_MIN__; - long double zero = 0.0l; + volatile long double nan = NAN; + volatile long double inf = INFINITY; + volatile long double huge = HUGE_VALL; + volatile long double norm1 = __LDBL_MIN__; + volatile long double norm2 = 1; + volatile long double norm3 = __LDBL_MAX__; + volatile long double sub = __LDBL_MIN__ / 2; + volatile long double zero = 0.0l; - C99_MATH_TESTS (nan, inf, huge, norm, zero) + C99_MATH_TESTS (nan, inf, huge, norm1, norm2, norm3, sub, zero, /*neg=*/0) + C99_MATH_TESTS (-nan, -inf, -huge, -norm1, -norm2, -norm3, -sub, -zero, /*neg=*/1) return 0; } diff --git a/gnu/dist/gcc4/gcc/testsuite/gcc.dg/c99-math.h b/gnu/dist/gcc4/gcc/testsuite/gcc.dg/c99-math.h index 3f42f67319d..81f2e6ddb43 100644 --- a/gnu/dist/gcc4/gcc/testsuite/gcc.dg/c99-math.h +++ b/gnu/dist/gcc4/gcc/testsuite/gcc.dg/c99-math.h @@ -1,9 +1,14 @@ #include <math.h> +#include <fenv.h> extern void abort(void); -#define C99_MATH_TESTS(nan, inf, huge, norm, zero) \ +#define C99_MATH_TESTS(nan, inf, huge, norm1, norm2, norm3, sub, zero, neg) \ { \ + if (feclearexcept (FE_ALL_EXCEPT) != 0) \ + abort(); \ + \ + \ if (fpclassify (nan) != FP_NAN) \ abort (); \ \ @@ -13,7 +18,16 @@ extern void abort(void); if (fpclassify (huge) != FP_INFINITE) \ abort (); \ \ - if (fpclassify (norm) != FP_NORMAL) \ + if (fpclassify (norm1) != FP_NORMAL) \ + abort (); \ + \ + if (fpclassify (norm2) != FP_NORMAL) \ + abort (); \ + \ + if (fpclassify (norm3) != FP_NORMAL) \ + abort (); \ + \ + if (fpclassify (sub) != FP_SUBNORMAL) \ abort (); \ \ if (fpclassify (zero) != FP_ZERO) \ @@ -29,7 +43,16 @@ extern void abort(void); if (isnan (huge)) \ abort (); \ \ - if (isnan (norm)) \ + if (isnan (norm1)) \ + abort (); \ + \ + if (isnan (norm2)) \ + abort (); \ + \ + if (isnan (norm3)) \ + abort (); \ + \ + if (isnan (sub)) \ abort (); \ \ if (isnan (zero)) \ @@ -45,7 +68,16 @@ extern void abort(void); if (!isinf (huge)) \ abort (); \ \ - if (isnan (norm)) \ + if (isinf (norm1)) \ + abort (); \ + \ + if (isinf (norm2)) \ + abort (); \ + \ + if (isinf (norm3)) \ + abort (); \ + \ + if (isinf (sub)) \ abort (); \ \ if (isinf (zero)) \ @@ -61,7 +93,16 @@ extern void abort(void); if (isfinite (huge)) \ abort (); \ \ - if (!isfinite (norm)) \ + if (!isfinite (norm1)) \ + abort (); \ + \ + if (!isfinite (norm2)) \ + abort (); \ + \ + if (!isfinite (norm3)) \ + abort (); \ + \ + if (!isfinite (sub)) \ abort (); \ \ if (!isfinite (zero)) \ @@ -77,35 +118,119 @@ extern void abort(void); if (isnormal (huge)) \ abort (); \ \ - if (!isnormal (norm)) \ + if (!isnormal (norm1)) \ + abort (); \ + \ + if (!isnormal (norm2)) \ + abort (); \ + \ + if (!isnormal (norm3)) \ + abort (); \ + \ + if (isnormal (sub)) \ abort (); \ \ if (isnormal (zero)) \ abort (); \ \ \ - if (signbit (norm)) \ + if (!!signbit (nan) != neg) \ + abort (); \ + \ + if (!!signbit (inf) != neg) \ + abort (); \ + \ + if (!!signbit (huge) != neg) \ + abort (); \ + \ + if (!!signbit (norm1) != neg) \ abort (); \ \ - if (!signbit (-(norm))) \ + if (!!signbit (norm2) != neg) \ abort (); \ \ + if (!!signbit (norm3) != neg) \ + abort (); \ + \ + if (!!signbit (sub) != neg) \ + abort (); \ + \ + if (!!signbit (zero) != neg) \ + abort (); \ + \ + \ + if (neg) \ + { \ + if (!isless ((inf), (norm1))) \ + abort (); \ + \ + if (!isless ((inf), (norm2))) \ + abort (); \ \ - if (!isgreater ((inf), (norm))) \ + if (!isless ((inf), (norm3))) \ + abort (); \ + \ + if (!islessequal ((inf), (huge))) \ + abort (); \ + \ + if (!isgreater ((norm1), (inf))) \ + abort (); \ + \ + if (!isgreater ((norm2), (inf))) \ + abort (); \ + \ + if (!isgreater ((norm3), (inf))) \ + abort (); \ + \ + if (!isgreaterequal ((huge), (inf))) \ + abort (); \ + } \ + else \ + { \ + if (!isgreater ((inf), (norm1))) \ + abort (); \ + \ + if (!isgreater ((inf), (norm2))) \ + abort (); \ + \ + if (!isgreater ((inf), (norm3))) \ + abort (); \ + \ + if (!isgreaterequal ((inf), (huge))) \ + abort (); \ + \ + if (!isless ((norm1), (inf))) \ + abort (); \ + \ + if (!isless ((norm2), (inf))) \ + abort (); \ + \ + if (!isless ((norm3), (inf))) \ + abort (); \ + \ + if (!islessequal ((huge), (inf))) \ + abort (); \ + } \ + \ + if (!islessgreater ((inf), (norm1))) \ abort (); \ \ - if (!isgreaterequal ((inf), (huge))) \ + if (!islessgreater ((inf), (norm2))) \ abort (); \ \ - if (!isless ((norm), (inf))) \ + if (!islessgreater ((inf), (norm3))) \ abort (); \ \ - if (!islessequal ((huge), (inf))) \ + if (!isunordered ((nan), (norm1))) \ abort (); \ \ - if (!islessgreater ((inf), (norm))) \ + if (!isunordered ((nan), (norm2))) \ abort (); \ \ - if (!isunordered ((nan), (norm))) \ + if (!isunordered ((nan), (norm3))) \ abort (); \ + \ + \ + if (fetestexcept (FE_ALL_EXCEPT) != 0) \ + abort(); \ } diff --git a/gnu/dist/gcc4/gcc/testsuite/gcc.dg/out-of-bounds-1.c b/gnu/dist/gcc4/gcc/testsuite/gcc.dg/out-of-bounds-1.c new file mode 100644 index 00000000000..14c4591a40a --- /dev/null +++ b/gnu/dist/gcc4/gcc/testsuite/gcc.dg/out-of-bounds-1.c @@ -0,0 +1,13 @@ +/* PR rtl-optimization/33822 */ +/* Origin: Andrew Pinski <pinskia@gcc.gnu.org> */ + +/* { dg-do compile } */ +/* { dg-options "-O -g" } */ +/* { dg-options "-O -g -mstrict-align" { target powerpc*-*-* } } */ + +void ProjectOverlay(const float localTextureAxis[2], char *lump) +{ + const void *d = &localTextureAxis; + int size = sizeof(float)*8 ; + __builtin_memcpy( &lump[ 0 ], d, size ); +} diff --git a/gnu/dist/gcc4/gcc/testsuite/gcc.dg/pr32450.c b/gnu/dist/gcc4/gcc/testsuite/gcc.dg/pr32450.c new file mode 100644 index 00000000000..9b36ce42d8b --- /dev/null +++ b/gnu/dist/gcc4/gcc/testsuite/gcc.dg/pr32450.c @@ -0,0 +1,33 @@ +/* Contributed by Joost VandeVondele <jv244@cam.ac.uk> */ + +/* { dg-do run } */ +/* { dg-require-profiling "-pg" } */ +/* { dg-options "-O2 -pg" } */ +/* { dg-options "-O2 -pg -static" { target hppa*-*-hpux* } } */ + +extern void abort (void); + +int stack_pointer; + +void +__attribute__((noinline)) +mystop () +{ + abort (); +} + +void +__attribute__((noinline)) +add () +{ + if (stack_pointer + 1 > 10) + mystop (); + + stack_pointer = stack_pointer + 1; +} + +int main () +{ + add (); + return stack_pointer - 1; +} diff --git a/gnu/dist/gcc4/gcc/testsuite/gcc.dg/pr32912-1.c b/gnu/dist/gcc4/gcc/testsuite/gcc.dg/pr32912-1.c new file mode 100644 index 00000000000..2f9e8593e29 --- /dev/null +++ b/gnu/dist/gcc4/gcc/testsuite/gcc.dg/pr32912-1.c @@ -0,0 +1,44 @@ +/* PR middle-end/32912 */ +/* { dg-do run } */ +/* { dg-options "-O2 -w" } */ + +extern void abort (void); + +typedef int __m128i __attribute__ ((__vector_size__ (16))); + +__m128i a, b, c, d, e, f; + +void +foo (__m128i x) +{ + a = x ^ ~x; + b = ~x ^ x; + c = x | ~x; + d = ~x | x; + e = x & ~x; + f = ~x & x; +} + +int +main (void) +{ + union { __m128i v; int i[sizeof (__m128i) / sizeof (int)]; } u; + int i; + + for (i = 0; i < sizeof (u.i) / sizeof (u.i[0]); i++) + u.i[i] = i * 49 - 36; + foo (u.v); +#define check(x, val) \ + u.v = (x); \ + for (i = 0; i < sizeof (u.i) / sizeof (u.i[0]); i++) \ + if (u.i[i] != (val)) \ + abort () + + check (a, ~0); + check (b, ~0); + check (c, ~0); + check (d, ~0); + check (e, 0); + check (f, 0); + return 0; +} diff --git a/gnu/dist/gcc4/gcc/testsuite/gcc.dg/pr32912-2.c b/gnu/dist/gcc4/gcc/testsuite/gcc.dg/pr32912-2.c new file mode 100644 index 00000000000..3ea81da789c --- /dev/null +++ b/gnu/dist/gcc4/gcc/testsuite/gcc.dg/pr32912-2.c @@ -0,0 +1,45 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -w" } */ + +extern void abort (void); + +typedef int __m128i __attribute__ ((__vector_size__ (16))); + +__m128i a, b, c, d, e, f; + +__m128i +foo (void) +{ + __m128i x = { 0x11111111, 0x22222222, 0x44444444 }; + return x; +} + +__m128i +bar (void) +{ + __m128i x = { 0x11111111, 0x22222222, 0x44444444 }; + return ~x; +} + +int +main (void) +{ + union { __m128i v; int i[sizeof (__m128i) / sizeof (int)]; } u, v; + int i; + + u.v = foo (); + v.v = bar (); + for (i = 0; i < sizeof (u.i) / sizeof (u.i[0]); i++) + { + if (u.i[i] != ~v.i[i]) + abort (); + if (i < 3) + { + if (u.i[i] != (0x11111111 << i)) + abort (); + } + else if (u.i[i]) + abort (); + } + return 0; +} diff --git a/gnu/dist/gcc4/gcc/testsuite/gcc.dg/pr33826.c b/gnu/dist/gcc4/gcc/testsuite/gcc.dg/pr33826.c new file mode 100644 index 00000000000..3e08b14fa97 --- /dev/null +++ b/gnu/dist/gcc4/gcc/testsuite/gcc.dg/pr33826.c @@ -0,0 +1,41 @@ +/* Regression test for PR middle-end/33826 */ +/* Verify that recursive functions cannot be pure or const. */ + +/* { dg-do compile } */ +/* { dg-require-effective-target nonpic } */ +/* { dg-options "-O1 -fdump-ipa-pure-const" } */ + +int recurese1 (int i) +{ + return recurse1 (i+1); +} + +int recurse2a (int i) +{ + return recurse2b (i+1); +} + +int recurse2b (int i) +{ + return recurse2a (i+1); +} + +int norecurse1a (int i) +{ + return norecurse1b (i+1); +} + +int norecurse1b (int i) +{ + return i+1; +} + +/* { dg-final { scan-ipa-dump "found to be const: norecurse1a" "pure-const" } } */ +/* { dg-final { scan-ipa-dump "found to be const: norecurse1b" "pure-const" } } */ +/* { dg-final { scan-ipa-dump-not "found to be pure: recurse1" "pure-const" } } */ +/* { dg-final { scan-ipa-dump-not "found to be pure: recurse2a" "pure-const" } } */ +/* { dg-final { scan-ipa-dump-not "found to be pure: recurse2b" "pure-const" } } */ +/* { dg-final { scan-ipa-dump-not "found to be const: recurse1" "pure-const" } } */ +/* { dg-final { scan-ipa-dump-not "found to be const: recurse2a" "pure-const" } } */ +/* { dg-final { scan-ipa-dump-not "found to be const: recurse2b" "pure-const" } } */ +/* { dg-final { cleanup-ipa-dump "pure-const" } } */ diff --git a/gnu/dist/gcc4/gcc/testsuite/gcc.dg/pr34003-1.c b/gnu/dist/gcc4/gcc/testsuite/gcc.dg/pr34003-1.c new file mode 100644 index 00000000000..ff97fe6d23e --- /dev/null +++ b/gnu/dist/gcc4/gcc/testsuite/gcc.dg/pr34003-1.c @@ -0,0 +1,8 @@ +/* PR bootstrap/34003 */ +/* { dg-do link } */ +/* { dg-options "-O0" } */ +/* { dg-additional-sources "pr34003-2.c" } */ + +extern void foo (void); +int bar (void) { foo (); return 1; } +extern void foo (void); diff --git a/gnu/dist/gcc4/gcc/testsuite/gcc.dg/pr34003-2.c b/gnu/dist/gcc4/gcc/testsuite/gcc.dg/pr34003-2.c new file mode 100644 index 00000000000..a5330567f50 --- /dev/null +++ b/gnu/dist/gcc4/gcc/testsuite/gcc.dg/pr34003-2.c @@ -0,0 +1,20 @@ +/* PR bootstrap/34003 */ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +extern void abort (void); + +int seen = 0; + +void foo (void) +{ + ++seen; +} + +int main (void) +{ + extern int bar (void); + if (bar () != 1 || seen != 1) + abort (); + return 0; +} diff --git a/gnu/dist/gcc4/gcc/testsuite/gcc.dg/tf_to_di-1.c b/gnu/dist/gcc4/gcc/testsuite/gcc.dg/tf_to_di-1.c new file mode 100644 index 00000000000..f4f478a0f7c --- /dev/null +++ b/gnu/dist/gcc4/gcc/testsuite/gcc.dg/tf_to_di-1.c @@ -0,0 +1,47 @@ +/* { dg-do run { target s390*-*-* } } */ +/* { dg-options "-O0 -mlong-double-128" } */ + +#include <stdio.h> +#include <stdlib.h> + +void +check_ll (long double ld, long long ll) +{ + if ((long long)ld != ll) + { + printf ("ld: %Lf expect: %lld result: %lld\n", + ld, ll, (long long)ld); + abort (); + } +} + +void +check_ull (long double ld, unsigned long long ull) +{ + if ((unsigned long long)ld != ull) + { + printf ("ld: %Lf expect: %llu result: %llu\n", + ld, ull, (unsigned long long)ld); + abort (); + } +} + +int +main () +{ + const long long ll_max = (long long)((1ULL << 63) - 1); + const long long ll_min = -ll_max - 1; + + check_ll (206.23253, 206LL); + check_ull (206.23253, 206ULL); + check_ll ((long double)ll_max, ll_max); + check_ull ((long double)ll_max, ll_max); + check_ll ((long double)ll_min, ll_min); + check_ll (0.0, 0); + check_ull (0.0, 0); + check_ll (-1.0, -1); + check_ll ((long double)0xffffffffffffffffULL, ll_max); + check_ull ((long double)0xffffffffffffffffULL, 0xffffffffffffffffULL); + + return 0; +} diff --git a/gnu/dist/gcc4/gcc/testsuite/gcc.dg/tree-ssa/20030714-1.c b/gnu/dist/gcc4/gcc/testsuite/gcc.dg/tree-ssa/20030714-1.c index 34fb26697d3..a48cfdb7596 100644 --- a/gnu/dist/gcc4/gcc/testsuite/gcc.dg/tree-ssa/20030714-1.c +++ b/gnu/dist/gcc4/gcc/testsuite/gcc.dg/tree-ssa/20030714-1.c @@ -34,13 +34,6 @@ find_base_value (src) } -/* There should be four IF conditionals. */ -/* { dg-final { scan-tree-dump-times "if " 4 "dom3"} } */ - /* There should be no casts to short unsigned int. */ /* { dg-final { scan-tree-dump-times "\\(short unsigned int\\)" 0 "dom3"} } */ -/* There should be two loads of ->code. */ -/* { dg-final { scan-tree-dump-times "->code" 2 "dom3"} } */ - -/* { dg-final { cleanup-tree-dump "dom3" } } */ diff --git a/gnu/dist/gcc4/gcc/testsuite/gcc.dg/tree-ssa/loop-3.c b/gnu/dist/gcc4/gcc/testsuite/gcc.dg/tree-ssa/loop-3.c index 82d1d2d73c5..c71791480c6 100644 --- a/gnu/dist/gcc4/gcc/testsuite/gcc.dg/tree-ssa/loop-3.c +++ b/gnu/dist/gcc4/gcc/testsuite/gcc.dg/tree-ssa/loop-3.c @@ -3,7 +3,8 @@ assume something about memory addressing modes. */ /* { dg-do compile { target i?86-*-* x86_64-*-* } } */ -/* { dg-options "-O1 -fdump-tree-vars" } */ +/* { dg-skip-if "" { i?86-*-* x86_64-*-* } { "-fpic" "-fPIC" } { "" } } */ +/* { dg-options "-O1 -fno-pic -fno-PIC -fdump-tree-vars" } */ int arr_base[100]; diff --git a/gnu/dist/gcc4/gcc/testsuite/gcc.dg/tree-ssa/pr31966.c b/gnu/dist/gcc4/gcc/testsuite/gcc.dg/tree-ssa/pr31966.c new file mode 100644 index 00000000000..a18f9d041ee --- /dev/null +++ b/gnu/dist/gcc4/gcc/testsuite/gcc.dg/tree-ssa/pr31966.c @@ -0,0 +1,50 @@ +/* Contributed by Jack Lloyd <lloyd@randombit.net> */ + +/* { dg-options "-O2 -ftree-vectorize" } */ +/* { dg-options "-O2 -ftree-vectorize -march=nocona" { target { i?86-*-* x86_64-*-* } } } */ + +typedef unsigned long long word; + +const unsigned int MP_WORD_BITS = 64; +const word MP_WORD_MASK = ~((word)0); +const word MP_WORD_TOP_BIT = (word)1 << (8*sizeof(word) - 1); + +extern void abort (void); + +word do_div(word n1, word n0, word d) +{ + word high = n1 % d, quotient = 0; + unsigned int j; + + for(j = 0; j != MP_WORD_BITS; ++j) + { + word high_top_bit = (high & MP_WORD_TOP_BIT); + + high <<= 1; + high |= (n0 >> (MP_WORD_BITS-1-j)) & 1; + quotient <<= 1; + + if(high_top_bit || high >= d) + { + high -= d; + quotient |= 1; + } + } + + return quotient; +} + +int main() +{ + word result; + + result = do_div(0x0000000000200000ll, + 0x0000000000000000ll, + 0x86E53497CE000000ll); + + + if (result != 0x3CBA83) + abort (); + + return 0; +} diff --git a/gnu/dist/gcc4/gcc/testsuite/gcc.dg/vect/vect-ifcvt-9.c b/gnu/dist/gcc4/gcc/testsuite/gcc.dg/vect/vect-ifcvt-9.c index 75941d7f10f..b4a74cf9b44 100644 --- a/gnu/dist/gcc4/gcc/testsuite/gcc.dg/vect/vect-ifcvt-9.c +++ b/gnu/dist/gcc4/gcc/testsuite/gcc.dg/vect/vect-ifcvt-9.c @@ -11,7 +11,7 @@ extern void abort(void); int A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11}; int B[N] = {0,0,42,42,42,0,0,0,0,0,42,42,42,42,42,0}; -void foo () __attribute__((always_inline)); +inline void foo () __attribute__((always_inline)); void foo () { int i, j; diff --git a/gnu/dist/gcc4/gcc/testsuite/gcc.target/arm/stack-corruption.c b/gnu/dist/gcc4/gcc/testsuite/gcc.target/arm/stack-corruption.c new file mode 100644 index 00000000000..3a63950cc53 --- /dev/null +++ b/gnu/dist/gcc4/gcc/testsuite/gcc.target/arm/stack-corruption.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-O -mthumb -fno-omit-frame-pointer" } */ + +int main() { + return 0; +} + +/* { dg-final { scan-assembler-not "\tadd\tr7, sp, #8\n" } } */ diff --git a/gnu/dist/gcc4/gcc/testsuite/gcc.target/i386/pr21291.c b/gnu/dist/gcc4/gcc/testsuite/gcc.target/i386/pr21291.c index acfc43df67f..f7348bdf6e1 100644 --- a/gnu/dist/gcc4/gcc/testsuite/gcc.target/i386/pr21291.c +++ b/gnu/dist/gcc4/gcc/testsuite/gcc.target/i386/pr21291.c @@ -1,4 +1,9 @@ -/* { dg-do compile } */ +/* The asm has 2 "r" in/out operands, 1 earlyclobber "r" output, 1 "r" + input and 2 fixed "r" clobbers (eax and edx), so there are a total of + 6 registers that must not conflict. Add to that the PIC register, + the frame pointer, and the stack pointer, and we've run out of + registers on 32-bit targets. */ +/* { dg-do compile { target { { ! ilp32 } || nonpic } } } */ /* { dg-options "-O" } */ typedef unsigned long bngdigit; diff --git a/gnu/dist/gcc4/gcc/testsuite/gcc.target/i386/pr32389.c b/gnu/dist/gcc4/gcc/testsuite/gcc.target/i386/pr32389.c new file mode 100644 index 00000000000..3f4cb3e6228 --- /dev/null +++ b/gnu/dist/gcc4/gcc/testsuite/gcc.target/i386/pr32389.c @@ -0,0 +1,10 @@ +/* Testcase by Mike Frysinger <vapier@gentoo.org> */ + +/* { dg-do compile { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ +/* { dg-options "-msse" } */ + +double f1(); +int f2() { + __builtin_ia32_stmxcsr(); + return f1(); +} diff --git a/gnu/dist/gcc4/gcc/testsuite/gcc.target/mips/mips.exp b/gnu/dist/gcc4/gcc/testsuite/gcc.target/mips/mips.exp index d88a867db1b..a00f7b6631d 100644 --- a/gnu/dist/gcc4/gcc/testsuite/gcc.target/mips/mips.exp +++ b/gnu/dist/gcc4/gcc/testsuite/gcc.target/mips/mips.exp @@ -37,6 +37,7 @@ load_lib gcc-dg.exp # $mips_forced_isa: true if the command line uses -march=* or -mips* # $mips_forced_abi: true if the command line uses -mabi=* or -mgp* # $mips_forced_float: true if the command line uses -mhard/soft-float +# $mips_forced_le true if the command line uses -EL or -mel proc setup_mips_tests {} { global mips_isa global mips_arch @@ -47,6 +48,7 @@ proc setup_mips_tests {} { global mips_forced_isa global mips_forced_abi global mips_forced_float + global mips_forced_le global compiler_flags global tool @@ -81,6 +83,7 @@ proc setup_mips_tests {} { set mips_forced_isa [regexp -- {(-mips|-march)} $compiler_flags] set mips_forced_abi [regexp -- {(-mgp|-mabi)} $compiler_flags] set mips_forced_float [regexp -- {-m(hard|soft)-float} $compiler_flags] + set mips_forced_le [regexp -- {-(EL|mel)[[:>:]]} $compiler_flags] } # Return true if command-line option FLAG forces 32-bit code. @@ -116,6 +119,10 @@ proc is_gp32_flag {flag} { # -mhard-float # Select the given floating-point mode. Skip the test if the # multilib flags force a different selection. +# +# -EB +# Select big-endian code. Skip the test if the multilib flags +# force a little-endian target. proc dg-mips-options {args} { upvar dg-extra-tool-flags extra_tool_flags upvar dg-do-what do_what @@ -129,6 +136,7 @@ proc dg-mips-options {args} { global mips_forced_isa global mips_forced_abi global mips_forced_float + global mips_forced_le set flags [lindex $args 1] set matches 1 @@ -170,6 +178,10 @@ proc dg-mips-options {args} { if {$mips_float != $float && $mips_forced_float} { set matches 0 } + } elseif {[regexp -- {^-(EB|meb)$} $flag]} { + if {$mips_forced_le} { + set matches 0 + } } } if {$matches} { diff --git a/gnu/dist/gcc4/gcc/testsuite/gcc.target/mips/pr33256.c b/gnu/dist/gcc4/gcc/testsuite/gcc.target/mips/pr33256.c new file mode 100644 index 00000000000..d5db110fba5 --- /dev/null +++ b/gnu/dist/gcc4/gcc/testsuite/gcc.target/mips/pr33256.c @@ -0,0 +1,11 @@ +/* GCC used to report an ICE for this test because we generated a LO_SUM + for an illegitimate constant. */ +/* { dg-mips-options "-mabi=64 -mips3 -msym32 -O2 -EB -mno-abicalls" } */ +extern unsigned long a[]; +int b (int); + +int +c (void) +{ + return b (a[0]); +} diff --git a/gnu/dist/gcc4/gcc/testsuite/lib/target-supports.exp b/gnu/dist/gcc4/gcc/testsuite/lib/target-supports.exp index 01120ab6bdf..c473826b00c 100644 --- a/gnu/dist/gcc4/gcc/testsuite/lib/target-supports.exp +++ b/gnu/dist/gcc4/gcc/testsuite/lib/target-supports.exp @@ -490,6 +490,16 @@ proc check_effective_target_fpic { } { return 0 } +# Return 1 if the current multilib does not generate PIC by default. + +proc check_effective_target_nonpic { } { + return [check_no_compiler_messages nonpic assembly { + #if __PIC__ || __pic__ + #error FOO + #endif + }] +} + # Return true if iconv is supported on the target. In particular IBM1047. proc check_iconv_available { test_what } { |
