This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: Optimisation prevents overflow?
- From: Daniel Franke <franke dot daniel at gmail dot com>
- To: fortran at gcc dot gnu dot org
- Cc: Davide Mancusi <arekfu at yahoo dot it>
- Date: Thu, 19 Jul 2007 23:35:15 +0200
- Subject: Re: Optimisation prevents overflow?
- Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:from:to:subject:date:user-agent:cc:references:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:message-id; b=iqI408pft4bgBpy05Om1avNnkwXmdCQBY2JImMkSZ6iD7jOD/zoNgmdOW7znVlf33pUU/lUqQDMghkKDd4FnMFCGfsOVqE23v3qE7zu9MtSA6Yv1B+qqGQazjsz6aByOkb6spdgzOM3s/qaA+DzILnd2bDUhMU6SvqMQZyxMHSM=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:from:to:subject:date:user-agent:cc:references:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:message-id; b=LGleSQ2JsbGSEjsQJbopLj7XY2T8kKq/klMf9APwotd9WjoA1Ub12+n5d8f7QHj9OFwpA0fRJtGg9mWvNZwDlYV631kUAsBSYwe6/Lu9+yrZLFng06zuJ0vp/Fzm4P43dvJMmCaZhWms27ircoFav8F8pKin0unE2vmESqo/+vE=
- References: <469FD202.7080407@yahoo.it>
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