diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 30a3bca86f1..648c97b6a01 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2005-01-31 Richard Henderson + + * gcc.c-torture/execute/ieee/copysign1.c: Special case sizeof + long double for intel double extended format. + * gcc.c-torture/execute/ieee/copysign2.c: Likewise. + 2005-01-30 Mark Mitchell PR c++/19555 diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/copysign1.c b/gcc/testsuite/gcc.c-torture/execute/ieee/copysign1.c index 3197d2e813b..6f6a215ad48 100644 --- a/gcc/testsuite/gcc.c-torture/execute/ieee/copysign1.c +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/copysign1.c @@ -1,5 +1,22 @@ #include #include +#include + +#define fpsizeoff sizeof(float) +#define fpsizeof sizeof(double) +#define fpsizeofl sizeof(long double) + +/* Work around the fact that with the Intel double-extended precision, + we've got a 10 byte type stuffed into some amount of padding. And + the fact that -ffloat-store is going to stuff this value temporarily + into some bit of stack frame that we've no control over and can't zero. */ +#if LDBL_MANT_DIG == 64 +# if defined(__i386__) || defined(__x86_64__) || defined (__ia64__) +# undef fpsizeofl +# define fpsizeofl 10 +# endif +#endif + #define TEST(TYPE, EXT) \ TYPE c##EXT (TYPE x, TYPE y) \ @@ -25,12 +42,10 @@ void test##EXT (void) \ { \ int i, n = sizeof (T##EXT) / sizeof (T##EXT[0]); \ TYPE r; \ - /* Make sure to avoid comparing unused bits in the type. */ \ - memset (&r, 0, sizeof r); \ for (i = 0; i < n; ++i) \ { \ r = c##EXT (T##EXT[i].x, T##EXT[i].y); \ - if (memcmp (&r, &T##EXT[i].z, sizeof r) != 0) \ + if (memcmp (&r, &T##EXT[i].z, fpsizeof##EXT) != 0) \ abort (); \ } \ } diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/copysign2.c b/gcc/testsuite/gcc.c-torture/execute/ieee/copysign2.c index d7159925f08..a39d11574f2 100644 --- a/gcc/testsuite/gcc.c-torture/execute/ieee/copysign2.c +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/copysign2.c @@ -1,5 +1,23 @@ #include #include +#include + +#define fpsizeoff sizeof(float) +#define fpsizeof sizeof(double) +#define fpsizeofl sizeof(long double) + +/* Work around the fact that with the Intel double-extended precision, + we've got a 10 byte type stuffed into some amount of padding. And + the fact that -ffloat-store is going to stuff this value temporarily + into some bit of stack frame that we've no control over and can't zero. */ +#if LDBL_MANT_DIG == 64 +# if defined(__i386__) || defined(__x86_64__) || defined (__ia64__) +# undef fpsizeofl +# define fpsizeofl 10 +# endif +#endif + + #define TEST(TYPE, EXT) \ static TYPE Y##EXT[] = { \ @@ -13,8 +31,7 @@ static const TYPE Z##EXT[] = { \ void test##EXT (void) \ { \ TYPE r[8]; \ - /* Make sure to avoid comparing unused bits in the type. */ \ - memset (r, 0, sizeof r); \ + int i; \ r[0] = __builtin_copysign##EXT (1.0, Y##EXT[0]); \ r[1] = __builtin_copysign##EXT (1.0, Y##EXT[1]); \ r[2] = __builtin_copysign##EXT (-1.0, Y##EXT[2]); \ @@ -23,8 +40,9 @@ void test##EXT (void) \ r[5] = __builtin_copysign##EXT (-0.0, Y##EXT[5]); \ r[6] = __builtin_copysign##EXT (__builtin_inf##EXT (), Y##EXT[6]); \ r[7] = __builtin_copysign##EXT (-__builtin_nan##EXT (""), Y##EXT[7]); \ - if (memcmp (r, Z##EXT, sizeof r) != 0) \ - abort (); \ + for (i = 0; i < 8; ++i) \ + if (memcmp (r+i, Z##EXT+i, fpsizeof##EXT) != 0) \ + abort (); \ } TEST(float, f)