Optimisation prevents overflow?

Brooks Moses brooks.moses@codesourcery.com
Thu Jul 19 21:39:00 GMT 2007


At 02:23 PM 7/19/2007, Davide Mancusi wrote:
>...and yes, -ffloat-store fixes it. What does it do? I could not find 
>documentation about it.

It should be documented in the main GCC manual.  (The GFortran manual only 
documents the options specific to the Fortran front end, and this is a 
global GCC option.)

What that option does is guarantee that the results of calculations always 
go through a memory store, rather than simply being left in registers 
between operations.  I thought that this was an instance of PR323 (see 
http://gcc.gnu.org/PR323 for details), which that's designed to fix, but on 
reflection that still shouldn't produce anything nearly as high as 273 for 
the erroneous answer.  So probably what's happening is that this has a side 
effect of changing whatever optimization is causing the problem.

What version of GFortran are you using, and what platform, again?  This 
does seem like a bug of some sort.

Also: What optimization options are you using?  You copied the wrong 
command line in your original post, and didn't include those.  :)

- Brooks



More information about the Fortran mailing list