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: r120487
This commit is contained in:
Jakub Jelinek
2007-01-05 16:50:25 +01:00
committed by Jakub Jelinek
parent cec6b03fe6
commit 6f10cfef22
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-03 Jakub Jelinek <jakub@redhat.com>
* unwind-dw2.c (SIGNAL_FRAME_BIT, EXTENDED_CONTEXT_BIT): Define.

View File

@@ -1885,7 +1885,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 Richard Guenther <rguenther@suse.de>
PR middle-end/28116

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