https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88678

Peter Bergner <bergner at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2019-01-08
                 CC|                            |bergner at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #4 from Peter Bergner <bergner at gcc dot gnu.org> ---
Confirmed.  I don't think the mentioned revision caused the problem, other than
adding a new test case that fails the same way.  I simplified test case fails
for me with gcc 7.3.  I don't have anything older to test with.

bergner@pike:~/gcc/BUGS/PR88678$ cat bug.f90 
program foo
   use ieee_arithmetic
   implicit none
   real x
   x = ieee_value(x, ieee_signaling_nan)
   if (.not. ieee_is_nan(x)) stop 1
end program foo
bergner@pike:~/gcc/BUGS/PR88678$ gfortran -ffpe-trap=invalid -static bug.f90 
bergner@pike:~/gcc/BUGS/PR88678$ ./a.out 

Program received signal SIGFPE: Floating-point exception - erroneous arithmetic
operation.

Backtrace for this error:
#0  0x10001b1b
Floating point exception

bergner@pike:~/gcc/BUGS/PR88678$ gdb ./a.out
(gdb) break * 0x1000aad8
Breakpoint 1 at 0x1000aad8
(gdb) run
Starting program: /home/bergner/gcc/BUGS/PR88678/a.out 

Breakpoint 1, 0x000000001000aad8 in __ieee_arithmetic_MOD_ieee_value_4 ()
1: x/i $pc
=> 0x1000aad8 <__ieee_arithmetic_MOD_ieee_value_4+120>: fsqrts  f1,f1
(gdb) info registers f1
f1             -1       (raw 0xbff0000000000000)
(gdb) stepi

Program received signal SIGFPE, Arithmetic exception.
0x000000001000aad8 in __ieee_arithmetic_MOD_ieee_value_4 ()
1: x/i $pc
=> 0x1000aad8 <__ieee_arithmetic_MOD_ieee_value_4+120>: fsqrts  f1,f1



So it seems, we still have floating point exceptions enabled when we try and
generate the signaling nan value which is causing the SIGFPE.  Who was supposed
to disable them before we execute the fsqrt with -1 as the source value?

Reply via email to