re PR c/30360 (Complex divide bug)

PR c/30360
	* libgcc2.c (__divdc3): Compare c and d against 0.0 instead of
	denom against 0.0.

	* gcc.dg/pr30360.c: New test.

From-SVN: r120486
This commit is contained in:
Jakub Jelinek 2007-01-05 16:49:05 +01:00 committed by Jakub Jelinek
parent 2220652d3f
commit 698ac9345a
4 changed files with 37 additions and 1 deletions

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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;
}