This is the mail archive of the gcc@gcc.gnu.org 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: -f[no-]finite-math-only


On Thu, Jul 2, 2009 at 12:02 PM, Daniel Franke<franke.daniel@gmail.com> wrote:
>
> Dear all,
>
> some Fortran77 code I inherited gives wrong results if compiled
> with '-ffast-math', especially with '-ffinite-math-only' enabled
> ('-ffast-math -fno-finite-math-only' seems to work).
>
> As '-ffinite-math-only' does "Allow optimizations for floating-point
> arithmetic that assume that arguments and results are not NaNs or +-Infs", it
> is to assume that the code uses either or both. If so, it's very likely that
> this was not intended by the original author.
>
> Any pointers on how to track down these issues in ~25kloc of Fortran77 to
> double check what's going on?

The code is likely using isinf/isnan intrinsics (if such exist) or
comparisons like x != x which check for NaN.  Those are optimized
away with -ffinite-math-only.

Richard.

> Thanks
>
>
> ? ? ? ?Daniel
>
>
> P.S. Not using '-ffast-math' would of course be an option, but knowing that
> there might be something fishy going on with NaN/Inf does not improve the
> confidence in the application's results ...
>


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