http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57628
--- Comment #17 from Steve Kargl <sgk at troutmask dot apl.washington.edu> --- On Mon, Jun 17, 2013 at 10:07:32PM +0000, furue at hawaii dot edu wrote: > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57628 > > --- Comment #16 from Ryo Furue <furue at hawaii dot edu> --- > (In reply to Steve Kargl from comment #12) > > On Sun, Jun 16, 2013 at 11:33:49PM +0000, furue at hawaii dot edu wrote: > > > > > > Is this an inconsistency in the implementation of -no-range-check ? > > > > No. > > Then, what's the counterpart of -fno-range-check that takes care of such cases > as sqrt? To repeat the code: > > real, parameter:: a = -1.0 > if (a > 0) write(*,*) sqrt(a) > > With such a switch turned on, the compiler can replace sqrt(-1.0) with NaN and > let the code pass. > Why not replace it with 0 instead of NaN? Afterall, the real part of the imaginary number i (or j if you're an electrical engineer) is 0? 13.7.159 SQRT(X) Argument. X shall be of type real or complex. Unless X is complex, its value shall be greater than or equal to zero. Those "shall be" phrases are fair strong statements. Yeah, I get it. You don't like the choice that gfortran made 10+ years ago.