This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GCSE store motion


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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]