On Fri, Dec 28, 2018 at 4:38 PM Jerry DeLisle <jvdeli...@charter.net> wrote: > > On 12/28/18 10:43 AM, Steve Kargl wrote: > > Ping. > > > > On Mon, Dec 24, 2018 at 11:59:50AM -0800, Steve Kargl wrote: > >> All, > >> > >> The IEEE modules and -ffpe-trap are to some extent orthogonal > >> features of gfortran. Unfortunately, some users have the > >> expectation of using -ffpe-trap for debugging while also using only > >> some of the mechanisms provided by the IEEE modules. For example, > >> > >> % t.f90 > >> program test > >> use, intrinsic :: ieee_arithmetic > >> real :: inf > >> inf = ieee_value(inf, ieee_positive_inf) > >> end program test > >> % gfc8 -o z -ffpe-trap=overflow t.f90 && ./z > >> Floating exception (core dumped) > >> > >> The correct use of the module would be along the lines of > >> > >> program test > >> use, intrinsic :: ieee_arithmetic > >> real :: inf > >> logical h > >> call ieee_get_halting_mode(ieee_overflow, h) ! store halting > >> mode > >> call ieee_set_halting_mode(ieee_overflow, .false.) ! no halting > >> inf = ieee_value(inf, ieee_positive_inf) > >> call ieee_set_halting_mode(ieee_overflow, h) ! restore > >> halting mode > >> end program test > >> > >> Technically (as I have done in the patch), the user should also > >> use 'ieee_support_halting(ieee_overflow)', but that's just a detail. > >> > >> Now, IEEE_VALUE() is specifically included in the Fortran standard > >> to allow it to provide qNaN, sNaN, +inf, and -inf (among a few other > >> questionable constants). The attached patch allows gfortran to > >> generate an executable that does not abort with SIGFPE. > >> > >> 2018-12-24 Steven G. Kargl <ka...@gcc.gnu.org> > >> > >> PR fortran/88342 > >> * ieee/ieee_arithmetic.F90: Prevent exceptions in IEEE_VALUE if > >> -ffpe-trap=invalid or -ffpe-trap=overflow is used. > >> > >> 2018-12-24 Steven G. Kargl <ka...@gcc.gnu.org> > >> > >> PR fortran/88342 > >> * gfortran.dg/ieee/ieee_10.f90: New test. > >> > >> Regression tested on i586-*-freebsd and x86_64-*-freebsd. OK to commit? > >> > > OK Steve, thanks.
The test fails on Linux/x86: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88639 -- H.J.