This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Draft "Unsafe fp optimizations" project description.
- To: dewar at gnat dot com, toon at moene dot indiv dot nluug dot nl, tprince at computer dot org
- Subject: Re: Draft "Unsafe fp optimizations" project description.
- From: dewar at gnat dot com
- Date: Sun, 5 Aug 2001 07:40:16 -0400 (EDT)
- Cc: gcc at gcc dot gnu dot org, lucier at math dot purdue dot edu
<<One of my original reasons for provoking this discussion was my hope of
dealing with the need to conform with C and Fortran standards, which
require re-association to be preventable by parentheses, even though
optimizations such as -ffast-math are in effect. According to my
>>
No, that's wrong, there is nothing to prevent -ffast-math from ignoring
parentheses in Fortran. The Fortran standard has nothing to say about
compiler switches that deliberately provide other than standard semantics,
and such switches are perfectly reasonable.
Remember that in Fortran, one might use parens to override precedence
or simply for documentation purposes. The fact that these intefere with
desired optimizations might be annoying in some circumstances, and if
you take the "anything goes, speed all important" viewpoint of
-ffast-math, then it would be entirely reasonable to have this switch
override the effect of parens.
Indeed that's what makes sense to me in Fortran. After all it is allowable
by default in the absence of parens to do some of the transformations
we have been discussing here, so I would think that -ffast-math in
Fortran would be about forcing additional freedom beyond that provided
by the standard.
A Fortran expert writes parens where needed, and is not allowed to be
surprised by transformations in the absence of parens (of course there's
still discussion there, but the use of parens is in any case good style
to ensure canonical evaluation semantics).