[Bug lto/42074] gcc.dg/torture/builtin-math-7.c failed

ghazi at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Tue Dec 8 07:19:00 GMT 2009



------- Comment #8 from ghazi at gcc dot gnu dot org  2009-12-08 07:18 -------
Here's a reduced testcase for the -flto/-fwhopr failures.  If you compile it
with "-O2 -flto" or "-O2 -fwhopr" you get the wrong answers:
nan nan
nan nan

If you use just -O2, you get the correct output, i.e. it contains an inf:
-inf nan
inf nan

It seems like the erroneous case occurs with the wrong value for
flag_complex_method during code-gen.  Although how/why that happens I can't
say.  I think someone more familiar with LTO should look as this part.



#define VAL ((_Complex double)__builtin_inf() * 1i)
#define PRINTIT(X) do { \
  __builtin_printf ("%g %g\n", __real (X), __imag (X)); \
} while (0)

int main(void)
{
  PRINTIT(VAL * VAL);
  PRINTIT((_Complex double) 1 / (_Complex double) 0);
  return 0;
}


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42074



More information about the Gcc-bugs mailing list