[Bug libfortran/96613] New: SIGFPE on min1() with -ffpe-trap=invalid switch

thomas.huxhorn at web dot de gcc-bugzilla@gcc.gnu.org
Fri Aug 14 09:09:13 GMT 2020


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

            Bug ID: 96613
           Summary: SIGFPE on min1() with -ffpe-trap=invalid switch
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: thomas.huxhorn at web dot de
  Target Milestone: ---

The program fails if -ffpe-trap=invalid is present and no optimization flag is
set. It print 5000 with any optimization level set.

The expected behavior is that it print 5000 with no optimization.

Perhaps it is possible to first calculate the minimum of both real values and
then convert it to integer?

Testet with gcc 10.1 and 4.9
Compile with gfortran -ffpe-trap=invalid  -g -ggdb -fbacktrace   test.f90 

program test
  implicit none
  real :: X
  integer :: IX

  X = 7.7643945e+09
  IX = MIN1(5000.0, X)
  write(*,*) IX
end program

gdb ./a.out 
(gdb) run
Starting program: /home/thomas/a.out 
Program received signal SIGFPE, Arithmetic exception.
0x0000000000400794 in test () at test.f90:8
8         IX = MIN1(5000.0, X)


More information about the Gcc-bugs mailing list