This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GCSE store motion
- From: Toon Moene <toon at moene dot indiv dot nluug dot nl>
- To: Robert Dewar <dewar at gnat dot com>
- Cc: mark at codesourcery dot com, dberlin at dberlin dot org, gcc at gcc dot gnu dot org, law at redhat dot com, roger at eyesopen dot com
- Date: Wed, 15 May 2002 22:30:22 +0200
- Subject: Re: GCSE store motion
- Organization: Moene Computational Physics, Maartensdijk, The Netherlands
- References: <20020515200501.CB8B4F2CB5@nile.gnat.com>
Robert Dewar wrote:
> I wrote:
> Given the number of times my advice on comp.lang.fortran of compiling
> with -fno-automatic actually `stopped the bug', I'd think that's rather
> important ...
> >
>
> Interesting, considering that *every* version of the Fortran standard has
> emphasized that there is no requirement for local variables in subroutines
> to keep their values from call to call
[ ... sigh, yes, I know - this is from the my-compiler-accepts-this
so-it-must-be-valid department ... ]
At least from Fortran 77 onwards:
"17.3 Events That Caused Entities to Become Undefined
6.The execution of a RETURN statement or an END statement within a
subprogram causes all entities within the subprogram to become
undefined except for the following:
a.Entities in blank common
b.Initially defined entities that have neither been redefined
nor become undefined
c.Entities specified by SAVE statements
d.Entities in a named common block that appears in the
subprogram and appears in at least one other program unit
that is either directly or indirectly referencing the
subprogram "
(Of course, those programmers should have used the SAVE statement to
cause the value of the variable to be kept)
> (the only exception is initialized
> data that is never reassigned).
Indeed, see the above.
--
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
Join GNU Fortran 95: http://g95.sourceforge.net/ (under construction)