This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/31161] __builtin_cexpi is broken on Darwin



------- Comment #16 from dominiq at lps dot ens dot fr  2007-03-17 00:22 -------
As far as I can tell the problem is fixed, at least for Mac OSX 10.3. Thanks
Richard for your
patience.

I have just noticed the following oddity with the 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);

  printf("%g %g\n", cos(tmp), sin(tmp));

  x = __builtin_cexpi(tmp);
  printf("%g %g\n", (__real__ x), (__imag__ x));

  x = __builtin_cexpi(tmp);
  printf("%g %g\n", (__real__ x), (__imag__ x));

  tmp = 0.5 * tmp;

  x = __builtin_cexpi(tmp);
  printf("%g %g\n", (__real__ x), (__imag__ x));

  tmp = 0.0;

  x = __builtin_cexpi(tmp);
  printf("%g %g\n", (__real__ x), (__imag__ x));
}

leads to:

[karma] bug/cexp_pb% g++-4 -O1 failure_v6.c
failure_v6.c: In function 'int main()':
failure_v6.c:4: warning: canonical types differ for identical types double
__complex__ and double __complex__
 <complex_type 0x9958c0
    type <real_type 0x42e238c0 double sizes-gimplified DF
        size <integer_cst 0x42e0a740 constant invariant 64>
        unit size <integer_cst 0x42e0a760 constant invariant 8>
        align 64 symtab 0 alias set -1 canonical type 0x42e238c0 precision 64
        pointer_to_this <pointer_type 0x42e23a10>>
    DC
    size <integer_cst 0x42e0a860 type <integer_type 0x42e1d070 bit_size_type>
constant invariant 128>
    unit size <integer_cst 0x42e0a880 type <integer_type 0x42e1d000 long
unsigned int> constant invariant 16>
    align 64 symtab 0 alias set -1 canonical type 0x9958c0>
 <complex_type 0x42e26000 complex double
    type <real_type 0x42e238c0 double sizes-gimplified DF
        size <integer_cst 0x42e0a740 constant invariant 64>
        unit size <integer_cst 0x42e0a760 constant invariant 8>
        align 64 symtab 0 alias set -1 canonical type 0x42e238c0 precision 64
        pointer_to_this <pointer_type 0x42e23a10>>
    sizes-gimplified DC
    size <integer_cst 0x42e0a860 type <integer_type 0x42e1d070 bit_size_type>
constant invariant 128>
    unit size <integer_cst 0x42e0a880 type <integer_type 0x42e1d000 long
unsigned int> constant invariant 16>
    align 64 symtab 0 alias set -1 canonical type 0x42e26000>
failure_v6.c:4: warning: canonical types differ for identical types double
__complex__ and double __complex__
 <complex_type 0x9958c0
    type <real_type 0x42e238c0 double sizes-gimplified DF
        size <integer_cst 0x42e0a740 constant invariant 64>
        unit size <integer_cst 0x42e0a760 constant invariant 8>
        align 64 symtab 0 alias set -1 canonical type 0x42e238c0 precision 64
        pointer_to_this <pointer_type 0x42e23a10>>
    DC
    size <integer_cst 0x42e0a860 type <integer_type 0x42e1d070 bit_size_type>
constant invariant 128>
    unit size <integer_cst 0x42e0a880 type <integer_type 0x42e1d000 long
unsigned int> constant invariant 16>
    align 64 symtab 0 alias set -1 canonical type 0x9958c0>
 <complex_type 0x42e26000 complex double
    type <real_type 0x42e238c0 double sizes-gimplified DF
        size <integer_cst 0x42e0a740 constant invariant 64>
        unit size <integer_cst 0x42e0a760 constant invariant 8>
        align 64 symtab 0 alias set -1 canonical type 0x42e238c0 precision 64
        pointer_to_this <pointer_type 0x42e23a10>>
    sizes-gimplified DC
    size <integer_cst 0x42e0a860 type <integer_type 0x42e1d070 bit_size_type>
constant invariant 128>
    unit size <integer_cst 0x42e0a880 type <integer_type 0x42e1d000 long
unsigned int> constant invariant 16>
    align 64 symtab 0 alias set -1 canonical type 0x42e26000>

without -O1, I don't get the warnings, nor with similar codes (as the ones in
comments), nor
with gcc. The executable works as expected. Any idea?


-- 


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]