------- Comment #2 from dominiq at lps dot ens dot fr  2007-03-13 10:58 -------
Subject: Re:  __builtin_cexpi is broken on Darwin

> you should not use __builtin_cexpi if neither sincos nor cexp is available.

Yes indeed, but an ICE is certainly not the best way to say it!

Now I have tested __builtin_cexpi, not because I want to use it, but because
it is used by the optimizer with a wrong result I would like to see fixed
ASAP.

Note that __builtin_cexp is available on Darwin and seems to work:


#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_cexp(0.5*t);
  printf("%g %g\n", (__real__ x), (__imag__ x));
  printf("%g %g\n", cos(tmp), sin(tmp));

}

gives with gcc and with or without optimization:

6.12323e-17 1
6.12323e-17 1

while when compiled with g++ -O1, it gives:

6.12323e-17 1
-1 1.22465e-16


-- 


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

Reply via email to