This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: # Re: [RFD] -ffinite-math-only.

+ @cindex -fno-finite-math-only option
+ @cindex options, -fno-finite-math-only
+ @item -fno-finite-math-only
+ Fortran specifies all arithmetic that can result in a NaN or an
+ infinity as "giving undefined results", therefore the compiler
+ by default operates in a way that assumes no NaNs or +-Inf can
+ be generated.  If you want to use a NaN or an Inf produced by
+ means other than Fortran, use this option to compile your
+ Fortran program.

This wording seems to imply that Fortran code which produces a NaN or Inf
has undefined behaviour *even if -fno-finite-math-only is specified*.
I don't see how the option could possibly be useful if Fortran code
is still not allowed to produce Infs or NaNs, since almost all
operations on Infs or NaNs will result in another Inf or NaN being
produced.  OK, there are some exceptions, e.g. 1.0 / Inf = 0.0,
but I still don't see the point of a mode in which code is allowed
to use NaNs or Infs but is not allowed to produce them.

While I don't really care much about whether -ffinite-math-only is the
default or not, I do think it is very unfriendly to not support NaNs
or Infs even when the user explicitly asks for it.

So, I suggest that the second sentence be changed to this:

	If your program might generate or use NaNs or infinities,
	then you should use this option.

(Also, "..." should be ``...'' in TexInfo.)

Fergus Henderson <>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <>  |     -- the last words of T. S. Garp.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]