g77: Different results when compiling with/without -fbounds-check ?!
Toon Moene
toon@moene.indiv.nluug.nl
Thu Jul 13 06:19:00 GMT 2000
Richard Ems wrote:
> After 2 days searching for errors and comparing my test case result's
> with different option combinations, I found
> that compiling with -fbounds-check and without it returns (for my test
> case) different results.
I can reproduce your results using g77-2.95.2 on i686-linux.
As far as I can see, the differences are in the 7th digit, not
unreasonable for a 32-bit floating point number.
The reason they are different at all is caused by the fact that the
extra code that -fbounds-check introduces leads to more intermediate
stores of register values into memory. On the Intel architecture that
means that more rounding from 80-bit floating point values to 32-bit
ones take place in case of -fbounds-check than when not compiling that
way.
You could work around this by adding the -ffloat-store option in all
cases - however, that would slow down your program considerably.
Hope this helps,
--
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
GNU Fortran 95: http://g95.sourceforge.net/ (under construction)
More information about the Gcc-bugs
mailing list