https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91690
Wilco <wilco at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |wilco at gcc dot gnu.org --- Comment #4 from Wilco <wilco at gcc dot gnu.org> --- (In reply to Steve Kargl from comment #3) > On Mon, Sep 09, 2019 at 08:05:33AM +0000, rguenth at gcc dot gnu.org wrote: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91690 > > > > --- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- > > __builtin_isnan is required to preserve FPU state, not sure why the Fortran > > FE > > thinks it needs some extra magic around it? > > > > The magic seems to come from trans-decl.c > > /* Generate code for a function. */ > > void > gfc_generate_function_code (gfc_namespace * ns) > { > > ... > > /* Check if an IEEE module is used in the procedure. If so, save > the floating point state. */ > ieee = is_ieee_module_used (ns); > if (ieee) > fpstate = gfc_save_fp_state (&init); > > ... > > /* If IEEE modules are loaded, restore the floating-point state. */ > if (ieee) > gfc_restore_fp_state (&cleanup, fpstate); > > } > > The Fortran standard may require this behavior. 18-007r1 page 435 But none of that is needed since a correct implementation of isnan etc does not affect the floating point state at all (see PR66462).