https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89821
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- The invalid exception is raised here: Program received signal SIGFPE, Arithmetic exception. 0x0000000000400cde in demo_nan () at t.f90:17 17 if ( (r32<=0.0_real32) .or. (r32>=0.0_real32) )then 0x0000000000400cd2 <+416>: movss -0x134(%rbp),%xmm1 0x0000000000400cda <+424>: pxor %xmm0,%xmm0 => 0x0000000000400cde <+428>: comiss %xmm1,%xmm0 where %xmm1 is NaN. (gdb) p $xmm1 $2 = ( v4_float = (nan(0x400000), 0, 0, 0), so not sure what you are expecting? Is Fortran supposed to use the C equivalent of isgreaterequal (aka comparisons that do not raise exceptions?)