diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a8b31ca0a1e4dbde78a4239a8efc32f5de397a43..c894c7229fcd762db25f567fa82b76f8d95721e9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2007-01-05 Jakub Jelinek <jakub@redhat.com> + + PR c/30360 + * libgcc2.c (__divdc3): Compare c and d against 0.0 instead of + denom against 0.0. + 2007-01-05 Joel Brobecker <brobecker@adacore.com> * doc/install.texi (Final install): Document the fact that diff --git a/gcc/libgcc2.c b/gcc/libgcc2.c index b78b8f6a387978123c1c837ba7a7ee9e37d014f1..8c0c9d1122d73ca69e55b7efdfdbc8b5213ce199 100644 --- a/gcc/libgcc2.c +++ b/gcc/libgcc2.c @@ -1909,7 +1909,7 @@ CONCAT3(__div,MODE,3) (MTYPE a, MTYPE b, MTYPE c, MTYPE d) are nonzero/zero, infinite/finite, and finite/infinite. */ if (isnan (x) && isnan (y)) { - if (denom == 0.0 && (!isnan (a) || !isnan (b))) + if (c == 0.0 && d == 0.0 && (!isnan (a) || !isnan (b))) { x = COPYSIGN (INFINITY, c) * a; y = COPYSIGN (INFINITY, c) * b; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 49786c58eccae82a101c9cabb91e8df31897575a..4636099980ac6e5c572e1e887a238596a584538e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2007-01-05 Jakub Jelinek <jakub@redhat.com> + + PR c/30360 + * gcc.dg/pr30360.c: New test. + 2007-01-05 Paul Thomas <pault@gcc.gnu.org> PR fortran/23232 diff --git a/gcc/testsuite/gcc.dg/pr30360.c b/gcc/testsuite/gcc.dg/pr30360.c new file mode 100644 index 0000000000000000000000000000000000000000..d4dae0d5f4779fa3cf9ea2c567fba192fb928a36 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr30360.c @@ -0,0 +1,25 @@ +/* PR c/30360 */ +/* { dg-do run { target i?86-*-linux* x86_64-*-linux* ia64-*-linux* s390*-*-linux* } } */ +/* { dg-options "-O2 -std=gnu99" } */ + +#define I (__extension__ 1.0iF) +#define H(x) asm ("" : "=m" (x) : "m" (x)) +extern void abort (void); + +int +main (void) +{ + _Complex double a = 1.0 + 1.0 * I, b = 0.0, c; + H (a); + H (b); + c = a / b; + if (!__builtin_isinf (__real__ c) && !__builtin_isinf (__imag__ c)) + abort (); + a = 0.0; + H (a); + H (b); + c = a / b; + if (!__builtin_isnan (__real__ c) || !__builtin_isnan (__imag__ c)) + abort (); + return 0; +}