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

anlauf at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Aug 17 18:03:31 GMT 2020


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

--- Comment #5 from anlauf at gcc dot gnu.org ---
(In reply to kargl from comment #4)
> I thought that this might be a good candidate for frontend fix.  
> Similar to thomas's frontend optimizations except except the 
> transformation is always done.  That is, we should be able to do
> substitutions based on Table 16.3 before we even get to backend.

If frontend optimization is preferred, I'll step out of the way.

Nevertheless, one also need to address issues like:

% cat maxmin.f90
program p
  implicit none
  print *, min (2.0, 1.d0)
  print *, min (2.d0, 1.0)
  print *, kind (min (2.0, 1.d0))
  print *, kind (min (2.d0, 1.0))
end program p

% gfc-11 maxmin.f90 && ./a.out 
   1.00000000    
   1.0000000000000000     
           4
           8

The only compiler I found having the same is PGI/NVIDIA.

OTOH ifort (and similarly sunf95, g95(!)) result in the expected:

   1.00000000000000     
   1.00000000000000     
           8
           8


More information about the Gcc-bugs mailing list