This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/31161] New: __builtin_cexpi is broken on Darwin
- From: "dominiq at lps dot ens dot fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Mar 2007 09:19:47 -0000
- Subject: [Bug c/31161] New: __builtin_cexpi is broken on Darwin
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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