------- Comment #3 from sje at cup dot hp dot com 2010-06-25 20:21 ------- I see this failure on ia64 linux and hp-ux. The interesting thing is that it fails when compiled with C++ but not when compiled with C. Here is a smaller test case that shows that the imaginary part of c1 is +0 in the good case (compiled with C) and -0 in the bad case (compiled with C++). This only shows up when not doing any optimization (-O0) because with optimization everything seems to get correctly folded.
#ifdef __cplusplus extern "C" { #endif extern void exit(int); int printf(const char *format, ...); #ifdef __cplusplus } #endif int main (void) { _Complex float a1, b1, c1; a1 = 0.0f + 0.0if; b1 = 0.0f - 0.0if; c1 = a1 + b1; if (__builtin_copysignf (1.0, __imag__ (a1)) != + 1.0) printf("one\n"); if (__builtin_copysignf (1.0, __imag__ (b1)) != - 1.0) printf("two\n"); if (__builtin_copysignf (1.0, __imag__ (c1)) != + 1.0) printf("three\n"); printf("%f\n",__imag__ (c1)); exit (0); } -- sje at cup dot hp dot com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |sje at cup dot hp dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44583