public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/39314]  New: -ffpe-trap=invalid gives no FPE for acos(-5.0)
@ 2009-02-26 15:28 janus at gcc dot gnu dot org
  2009-02-26 15:35 ` [Bug fortran/39314] " kargl at gcc dot gnu dot org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-02-26 15:28 UTC (permalink / raw)
  To: gcc-bugs

The following produces an FPE when compiled with -ffpe-trap=invalid:

real :: x = 1.0
print *, sqrt(-1.0*x)

However, using acos or asin does not:

real :: x = 1.0
print *, acos(5.0*x)
print *, asin(5.0*x)

Instead it just prints out "NaN". The FPE is missing both in 4.3 and on trunk.


-- 
           Summary: -ffpe-trap=invalid gives no FPE for acos(-5.0)
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: janus at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug fortran/39314] -ffpe-trap=invalid gives no FPE for acos(-5.0)
  2009-02-26 15:28 [Bug fortran/39314] New: -ffpe-trap=invalid gives no FPE for acos(-5.0) janus at gcc dot gnu dot org
@ 2009-02-26 15:35 ` kargl at gcc dot gnu dot org
  2009-02-26 15:45 ` janus at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: kargl at gcc dot gnu dot org @ 2009-02-26 15:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from kargl at gcc dot gnu dot org  2009-02-26 15:35 -------
What target?

Works for me on FreeBSD.

laptop:kargl[23] ~/work/bin/gfortran -static -o z -ffpe-trap=invalid j.f90
laptop:kargl[24] ./z
Floating exception (core dumped)
laptop:kargl[25] cat j.f90
real :: x = 1.0
print *, acos(5.0*x)
print *, asin(5.0*x)

end


-- 


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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug fortran/39314] -ffpe-trap=invalid gives no FPE for acos(-5.0)
  2009-02-26 15:28 [Bug fortran/39314] New: -ffpe-trap=invalid gives no FPE for acos(-5.0) janus at gcc dot gnu dot org
  2009-02-26 15:35 ` [Bug fortran/39314] " kargl at gcc dot gnu dot org
@ 2009-02-26 15:45 ` janus at gcc dot gnu dot org
  2009-02-26 18:04 ` burnus at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-02-26 15:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from janus at gcc dot gnu dot org  2009-02-26 15:45 -------
Sorry, forgot to specify the target: x86_64-unknown-linux-gnu.


-- 

janus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 GCC target triplet|                            |x86_64-unknown-linux-gnu


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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug fortran/39314] -ffpe-trap=invalid gives no FPE for acos(-5.0)
  2009-02-26 15:28 [Bug fortran/39314] New: -ffpe-trap=invalid gives no FPE for acos(-5.0) janus at gcc dot gnu dot org
  2009-02-26 15:35 ` [Bug fortran/39314] " kargl at gcc dot gnu dot org
  2009-02-26 15:45 ` janus at gcc dot gnu dot org
@ 2009-02-26 18:04 ` burnus at gcc dot gnu dot org
  2009-02-26 18:05 ` pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-02-26 18:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from burnus at gcc dot gnu dot org  2009-02-26 18:03 -------
Confirm: Here, I get the same result with -m64 on Linux (NaN and no SIGFPE),
but with -m32 (with both -mfpmath=sse and -mfpmath=387) I get the SIGFPE.

The FPE settings are used in libgfortran/config/*; maybe fpu-387.h does
something wrong in the x86-64 mode?


-- 


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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug fortran/39314] -ffpe-trap=invalid gives no FPE for acos(-5.0)
  2009-02-26 15:28 [Bug fortran/39314] New: -ffpe-trap=invalid gives no FPE for acos(-5.0) janus at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2009-02-26 18:04 ` burnus at gcc dot gnu dot org
@ 2009-02-26 18:05 ` pinskia at gcc dot gnu dot org
  2009-02-26 19:22 ` janus at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-02-26 18:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2009-02-26 18:05 -------
Or maybe libc's acos is broken ....  In which case this is not a GCC bug.


-- 


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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug fortran/39314] -ffpe-trap=invalid gives no FPE for acos(-5.0)
  2009-02-26 15:28 [Bug fortran/39314] New: -ffpe-trap=invalid gives no FPE for acos(-5.0) janus at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2009-02-26 18:05 ` pinskia at gcc dot gnu dot org
@ 2009-02-26 19:22 ` janus at gcc dot gnu dot org
  2009-02-27  9:02 ` janus at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-02-26 19:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from janus at gcc dot gnu dot org  2009-02-26 19:22 -------
Also on i386-apple-darwin9.6.0 the FPEs are thrown correctly.


-- 


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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug fortran/39314] -ffpe-trap=invalid gives no FPE for acos(-5.0)
  2009-02-26 15:28 [Bug fortran/39314] New: -ffpe-trap=invalid gives no FPE for acos(-5.0) janus at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2009-02-26 19:22 ` janus at gcc dot gnu dot org
@ 2009-02-27  9:02 ` janus at gcc dot gnu dot org
  2009-02-27  9:13 ` janus at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-02-27  9:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from janus at gcc dot gnu dot org  2009-02-27 09:01 -------
On x86_64-unknown-linux-gnu I *do* get the ICE when I compile with -ffast-math
-mfpmath=387. Cf. http://gcc.gnu.org/ml/fortran/2008-11/msg00250.html.


-- 


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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug fortran/39314] -ffpe-trap=invalid gives no FPE for acos(-5.0)
  2009-02-26 15:28 [Bug fortran/39314] New: -ffpe-trap=invalid gives no FPE for acos(-5.0) janus at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2009-02-27  9:02 ` janus at gcc dot gnu dot org
@ 2009-02-27  9:13 ` janus at gcc dot gnu dot org
  2009-02-27 10:49 ` burnus at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-02-27  9:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from janus at gcc dot gnu dot org  2009-02-27 09:13 -------
Note that the problem also appears for log, while it does not for acosh and
atanh:

real :: x = -5.0

! FPE is not thrown
print *, log(x)
print *, log10(x)
print *, acos(x)
print *, asin(x)

! FPE is thrown
!print *, sqrt(x)
!print *, atanh(x)
!print *, acosh(x)

end 


-- 


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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug fortran/39314] -ffpe-trap=invalid gives no FPE for acos(-5.0)
  2009-02-26 15:28 [Bug fortran/39314] New: -ffpe-trap=invalid gives no FPE for acos(-5.0) janus at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2009-02-27  9:13 ` janus at gcc dot gnu dot org
@ 2009-02-27 10:49 ` burnus at gcc dot gnu dot org
  2009-02-27 13:15 ` janus at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-02-27 10:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from burnus at gcc dot gnu dot org  2009-02-27 10:49 -------
> Note that the problem also appears for log, while it does not for acosh and
> atanh:

If it works with some but not all libm routines, it sounds more like a GLIBC
than like a GCC problem.


-- 


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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug fortran/39314] -ffpe-trap=invalid gives no FPE for acos(-5.0)
  2009-02-26 15:28 [Bug fortran/39314] New: -ffpe-trap=invalid gives no FPE for acos(-5.0) janus at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2009-02-27 10:49 ` burnus at gcc dot gnu dot org
@ 2009-02-27 13:15 ` janus at gcc dot gnu dot org
  2009-03-10 15:30 ` burnus at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-02-27 13:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from janus at gcc dot gnu dot org  2009-02-27 13:15 -------
(In reply to comment #8)
> If it works with some but not all libm routines, it sounds more like a GLIBC
> than like a GCC problem.

Can someone reproduce this with C code?


-- 


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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug fortran/39314] -ffpe-trap=invalid gives no FPE for acos(-5.0)
  2009-02-26 15:28 [Bug fortran/39314] New: -ffpe-trap=invalid gives no FPE for acos(-5.0) janus at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2009-02-27 13:15 ` janus at gcc dot gnu dot org
@ 2009-03-10 15:30 ` burnus at gcc dot gnu dot org
  2009-03-28  8:44 ` [Bug libfortran/39314] " fxcoudert at gcc dot gnu dot org
  2009-03-28 12:24 ` burnus at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-03-10 15:30 UTC (permalink / raw)
  To: gcc-bugs



------- 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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libfortran/39314] -ffpe-trap=invalid gives no FPE for acos(-5.0)
  2009-02-26 15:28 [Bug fortran/39314] New: -ffpe-trap=invalid gives no FPE for acos(-5.0) janus at gcc dot gnu dot org
                   ` (9 preceding siblings ...)
  2009-03-10 15:30 ` burnus at gcc dot gnu dot org
@ 2009-03-28  8:44 ` fxcoudert at gcc dot gnu dot org
  2009-03-28 12:24 ` burnus at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2009-03-28  8:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from fxcoudert at gcc dot gnu dot org  2009-03-28 08:44 -------
The x86_64 FPE code in libgfortran works fine, as evidenced by the fact that it
works with some glibcs (RedHat's glibc-2.5 for example) and on Mac OS 10.5.6
(which uses the same FPE setter). Closing as INVALID, please report to glibc or
distro vendor (Tobias did it with Novell here:
https://bugzilla.novell.com/show_bug.cgi?id=487576)


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
          Component|fortran                     |libfortran
         Resolution|                            |INVALID


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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libfortran/39314] -ffpe-trap=invalid gives no FPE for acos(-5.0)
  2009-02-26 15:28 [Bug fortran/39314] New: -ffpe-trap=invalid gives no FPE for acos(-5.0) janus at gcc dot gnu dot org
                   ` (10 preceding siblings ...)
  2009-03-28  8:44 ` [Bug libfortran/39314] " fxcoudert at gcc dot gnu dot org
@ 2009-03-28 12:24 ` burnus at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-03-28 12:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from burnus at gcc dot gnu dot org  2009-03-28 12:23 -------
On #gcc it was confirmed to give a SIGFPE on gentoo with glibc 2.9 on x86-64. I
think it is one of the @amd.com patches for x86-64 which fixes some performance
problems but has the side effect that it doesn't honour the FPE.


-- 


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


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2009-03-28 12:24 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-26 15:28 [Bug fortran/39314] New: -ffpe-trap=invalid gives no FPE for acos(-5.0) janus at gcc dot gnu dot org
2009-02-26 15:35 ` [Bug fortran/39314] " kargl at gcc dot gnu dot org
2009-02-26 15:45 ` janus at gcc dot gnu dot org
2009-02-26 18:04 ` burnus at gcc dot gnu dot org
2009-02-26 18:05 ` pinskia at gcc dot gnu dot org
2009-02-26 19:22 ` janus at gcc dot gnu dot org
2009-02-27  9:02 ` janus at gcc dot gnu dot org
2009-02-27  9:13 ` janus at gcc dot gnu dot org
2009-02-27 10:49 ` burnus at gcc dot gnu dot org
2009-02-27 13:15 ` janus at gcc dot gnu dot org
2009-03-10 15:30 ` burnus at gcc dot gnu dot org
2009-03-28  8:44 ` [Bug libfortran/39314] " fxcoudert at gcc dot gnu dot org
2009-03-28 12:24 ` burnus at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).