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