When compiled with gcc version 4.3.0 20070309, the following code #include <math.h> #include <stdio.h>
int main() { __complex__ double x; __real__ x = -1.0; __imag__ x = 0.0; __complex__ double t = __builtin_clog(x); double tmp = 0.5 * (__imag__ t); x = __builtin_cexpi(tmp); printf("%g %g\n", (__real__ x), (__imag__ x)); printf("%g %g\n", cos(tmp), sin(tmp)); } gives an ICE: failure_v2.c: In function 'main': failure_v2.c:15: internal compiler error: in expand_builtin_cexpi, at builtins.c:2380 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. It compiles with g++ and without optimization gives: [karma] bug/cexp_pb% g++-4 failure_v2.c [karma] bug/cexp_pb% a.out -1 1.22465e-16 6.12323e-17 1 where the last line is the expected result. With -O1 the result is: [karma] bug/cexp_pb% g++-4 -O1 failure_v2.c [karma] bug/cexp_pb% a.out -1 1.22465e-16 -1 1.22465e-16 this is PR30980!-( -- Summary: __builtin_cexpi is broken on Darwin Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dominiq at lps dot ens dot fr GCC target triplet: powerpc-apple-darwin7 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31161