Optimisation prevents overflow?
Daniel Franke
franke.daniel@gmail.com
Thu Jul 19 21:35:00 GMT 2007
On Thursday 19 July 2007 23:05:06 Davide Mancusi wrote:
> Is optimisation preventing overflow? What is really happening here?
In other mail:
> ...and yes, -ffloat-store fixes it. What does it do? I could not find
> documentation about it.
I'd guess, that's the (in)famous extended precision, 80 vs. 64 bits (iirc).
Try an external function to force the usage of the default precision, like
this:
program fk
double precision a, olda
integer i
a=1.d0
i=0
do
i=i+1
olda=a
a=f(a)
if(a.le.olda) exit
end do
print *, "when not printing, overflow at step ", i
end program fk
function f(a)
double precision, intent(in) :: a
double precision f
f = a * 1.5d18
end function
$> gfortran-svn -O3 ml.f90 &&./a.out
when not printing, overflow at step 18
More information about the Fortran
mailing list