This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: What is acceptable for -ffast-math? (Was: associative law in combine)
- To: dewar at gnat dot com, torvalds at transmeta dot com
- Subject: Re: What is acceptable for -ffast-math? (Was: associative law in combine)
- From: dewar at gnat dot com
- Date: Mon, 30 Jul 2001 14:52:34 -0400 (EDT)
- Cc: gcc at gcc dot gnu dot org, moshier at moshier dot ne dot mediaone dot net,tprince at computer dot org
<<What if I told you that it's actually legal? Go check it out.
>>
Of course it's legal - I *do* know the Fortran standard :-)
Indeed, read what I said more carefully, what I was saying was that *even
though* the Fortran standard allows this transformation, I would be shocked
at a compiler that actually did this particular one, since it is seriously
misguided to do so. Permission in the standard to do unwise things does
not mean that you have to do them.
<<Fortran, while being a pretty horrible language for anything else, does
exactly this for FP math. It doesn't do it for much anything else, of
course.
>>
Fortran is by no means such a horrible language for numerical calculations
(I say this having written many hundreds of thousands of lines of Fortran
numerical code). Yes, I know perfectly well that the standard allows this,
and that is why competent Fortran programmers use parentheses extensively,
but at least in my experience, Fortran compilers are fairly judicious about
taking advantage of the permissions in the absence of parens. Most certainly
one would expect that a Fortran compiler would NOT bother to preserve the
"proper" negative zero semantics in the case where parens are not used,
and so would for example feel free to transform
a-b
into
-(b-a)
which is of course not a valid transformation from a strict IEEE point of view.