optimization bug in g77

Toon Moene toon@moene.indiv.nluug.nl
Sun Feb 28 23:30:00 GMT 1999


Mike Stump wrote:

> > Date: Sun, 21 Feb 1999 15:41:05 -0800
> > From: Mark Mitchell <mark@markmitchell.com>

> > I think it's a good deal more responsible to invert your suggestion:
> > disable the (known to be broken) optimization by default, and then
> > provide an option to *enable* it.  Thus, the "power users", who want
> > maximum speed, can know what they're getting into: the documentation
> > will say explicitly that the option is, in general, known to be
> > unsafe.

> No, I prefer to ship a compiler with a known bug in it when
> optimizing, then to introduce a flag that is documented as being
> dangerous and known to generate bad code.  This is non-negotiable.

> Only flags that last 10 years should ever be put in, because they
> will.

> All compilers have bugs, all compilers ship with bugs, this is just a
> fact of life.  The `badness' of the bug drives the resources to fix
> it, if it is unfixed, it means it isn't that bad.  (fatalist
> viewpoint) If it is so bad, then it should just be disabled.

I do not agree.  My favorite unfixed bug is the COMPLEX problem on
64-bit targets.  Because it has been known and unfixed for a long time,
g77 defaults to "emulating complex arithmetic in the front-end", enabled
(by default) with the flag -femulate-complex.

This doesn't stop me from explaining to people who run into the
performance problems this brings about to try and compile their stuff
with -fno-emulate-complex *iff* they have a means to compare the
resulting output of the compiled program against some known correct
output or know how to check otherwise that -f[no-]emulate-complex gives
the same answers in all known paths through the program (yes, I know
that in general this is unsolvable, but in practice this is sometimes
possible).

In fact, with such options, one wants to stress two issues:

1. Do expect the option to go away, and hence:
2. Do not put it in makefiles, etc.

The latter is even easier with the flag Mark proposes, because we
already know exactly at which version of the compiler the flag will go
away (1.2), something we don't know for the -f[no-]emulate-complex flag.

Cheers,

-- 
Toon Moene (toon@moene.indiv.nluug.nl)
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
Phone: +31 346 214290; Fax: +31 346 214286
g77 Support: fortran@gnu.org; egcs: egcs-bugs@cygnus.com



More information about the Gcc-bugs mailing list