[Bug target/60181] New: constant folding of complex number incorrect
krebbel at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Feb 13 16:19:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60181
Bug ID: 60181
Summary: constant folding of complex number incorrect
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: krebbel at gcc dot gnu.org
The following testcase fails on s390x and Power. Constant folding and runtime
execution of a division of complex numbers produce different results.
The testcase works fine on x86 so it looks like S/390 and Power do something
different here.
It looks somewhat like:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30789
#include <complex.h>
#include <stdio.h>
#include <stdlib.h>
_Complex float __attribute__ ((noinline))
calc (_Complex float a, _Complex float b)
{
return a / b;
}
int
main (int argc, char **argv)
{
_Complex float a = calc (10 + 6 * I, 5 + 12 * I);
_Complex float b = (10 + 6 * I) / (5 + 12 * I);
printf ("%ap + %ap * i\n", creal (a), cimag (a));
printf ("%ap + %ap * i\n", creal (b), cimag (b));
if (a != b)
abort ();
return 0;
}
gcc -O0 t.c -o f
./f
0x1.719c08p-1p + -0x1.10a9a8p-1p * i
0x1.719c06p-1p + -0x1.10a9a8p-1p * i
Aborted
More information about the Gcc-bugs
mailing list