This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: # Re: [RFD] -ffinite-math-only.
- From: Brad Lucier <lucier at math dot purdue dot edu>
- To: toon at moene dot indiv dot nluug dot nl (Toon Moene)
- Cc: lucier at math dot purdue dot edu (Brad Lucier), gcc-patches at gcc dot gnu dot org
- Date: Mon, 26 Aug 2002 13:00:09 -0500 (EST)
- Subject: Re: # Re: [RFD] -ffinite-math-only.
> Toon Moene wrote:
>
> No, your mixing "undefined behaviour" with "yields a processor-dependent
> approximation to". Undefined behaviour in Fortran speak means: The
> `processor' (compiler+assembler+linker+OS+hardware) can do what it likes
> with your program, because it just broke the rules.
Actually, I don't think I'm mixing those two things. I just looked through
the f77 standard and I can't find where dividing by zero, for example,
leads to "undefined behavior". It may be there, but I can't find it.
I did find "A processor must not consider a negative zero to be different
from a positive zero" but that's in the non-normative Index B.
I don't think that the f77 standard is precise enough to say that
1.0/0.0 leads to "undefined behavior". And I don't think that g77
should, by default, compile (1.0/0.0)*0.0 to zero when, on many machines,
the natural interpretation of this code is NaN. (I know that g77
can't do this now, but if it checked the signs of the constant arguments,
it could under your interpretation.)
> Well, I'd say that if people use Fortran 77, they should either (1) know
> the model of arithmetic it supplies and adhere to that
I don't think that f77 *has* a model of arithmetic precise enough to
"adhere to". So, in its absence, I again suggest that -ffinite-math-only
should *not* be the default in g77; the default should be what the
processor gives you. People who are really worried about performance
without all the IEEE funny FP values will use -ffast-math anyway,
which should include -ffinite-math-only.
Brad