[Bug fortran/39314] -ffpe-trap=invalid gives no FPE for acos(-5.0)

burnus at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Tue Mar 10 15:30:00 GMT 2009



------- Comment #10 from burnus at gcc dot gnu dot org  2009-03-10 15:29 -------
> Can someone reproduce this with C code?

Yes: The following gives a SIGFPE with -m32 (logf, sqrtf) and with -m64 and
"sqrtf" but not with -m64 with "logf". (Compile with "-fsignaling-nans" and
"-lm".)

-----------------<cut>--------------------

#ifndef __SUPPORT_SNAN__
#  error No SNAN support - use "-fsignaling-nans"
#endif
#define _WANT_SNAN 1
#include <stdio.h>
#include <math.h>
#include <fenv.h>

int main()
{
  float x = -5.0, y;
  feenableexcept(FE_ALL_EXCEPT);
  y = logf(x);
  printf("%e\n",y);
  return 0;
}


-- 


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



More information about the Gcc-bugs mailing list