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: Toon Moene <toon at moene dot indiv dot nluug dot nl>
- To: Brad Lucier <lucier at math dot purdue dot edu>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 02 Aug 2002 22:00:03 +0200
- Subject: Re: # Re: [RFD] -ffinite-math-only.
- Organization: Moene Computational Physics, Maartensdijk, The Netherlands
- References: <200208020720.g727K7X02982@banach.math.purdue.edu>
Brad Lucier wrote:
> I'm weighing into this discussion late (I've been moving).
>
> I think one should not have -ffinite-math-only be the default in Fortran
> unless -ffast-math is also the default in Fortran. The optimizations you
> want to trigger with this will change the values that one will obtain with
> -O0, and will not match the model that programmers used to either IEEE
> arithmetic, the *87 in particular, or other programming languages will
> expect by default.
Yep, I'm fully aware of that, and I *am* doing this because I do not want
to perpetrate the myth that a Fortran 77 compiler can `somehow' be IEEE
conformant. No user of Fortran should be invoking undefined behaviour just
so that s/he can use the benefits of non-finite arithmetic _unless_ it's
very clear to him/her that this is an extension.
The flag -fno-finite-math-only clearly marks the fact that this is an
extension (and I pray that no part of the 200,000 line frontend violates
any of the assumptions necessary for IEEE compliance - I certainly didn't
check).
This all is not new, of course. In '97 we introduced alias analysis based
on the observation that in Fortran dummy arguments, common block entities
and local entities cannot overlap (work done by John Carr). Obviously,
this would invalidate code by people who invoked undefined behaviour here.
However, this cannot stop us - we provide compile time options so that
those users can keep running their software.
A similar move was made with GCC-2.95, where strict aliasing was introduced
for C programs. A lot of bogus error reports ensued (they continue until
this very day), but that cannot stop us - we introduced a flag so that
people can keep using their faulty software.
The only way to get the treatment of IEEE-754 conformance correct in
Fortran is to wait for the upcoming Fortran 2004 Standard, which will
detail the exact way in which to write programs that use non-finite math as
offered by IEEE-754 conformant hardware. Because of this, I want to have
language hooks, because Fortran 2004 will need IEEE-754 conformance on a
per-compilation-unit basis.
--
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
Join GNU Fortran 95: http://g95.sourceforge.net/ (under construction)