A complex float bug on alpha

H.J. Lu hjl@lucon.org
Tue Feb 24 11:39:00 GMT 1998


Hi,

There is a complex float bug on linux/alpha. Define
FPTYPE=double will stop the bug.

# gcc -O2 -g -mieee -o fcomplex complex.c -DFPTYPE=float
# fcomplex
zsh: 15815 abort      fcomplex

Thanks.


-- 
H.J. Lu (hjl@gnu.org)
---complex.c--
#include <stdio.h>

#ifndef FPTYPE
#define FPTYPE float
#endif

void foo (FPTYPE r, FPTYPE i)
{
  if (r != 1.0/0.0)
    abort ();

  printf ("r: %f, i: %f\n", r, i);
}

void bar (__complex__ FPTYPE x)
{
  foo (__real__ x, __imag__ x);
}

#define BUILD_COMPLEX(real, imag) \
  __extension__ ({ __complex__ FPTYPE __retval; \
     __real__ __retval = (real); \
     __imag__ __retval = (imag); \
     __retval; })

main ()
{
  bar (BUILD_COMPLEX (1.0/0.0, 2.3456));
}



More information about the Gcc mailing list