Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!spool.mu.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!magnus.ircc.ohio-state.edu!csn!pikes!aspen.craycos.com!pmk From: pmk@craycos.com (Peter Klausler) Newsgroups: comp.lang.fortran Subject: Re: SAVEing FORTRAN variables Message-ID: <1991Feb15.172635.17261@craycos.com> Date: 15 Feb 91 17:26:35 GMT References: <1991Feb15.000230.18585@news.arc.nasa.gov> Organization: Cray Computer Corporation Lines: 22 In article <1991Feb15.000230.18585@news.arc.nasa.gov> chau@xenon.arc.nasa.gov writes: >I am looking for a tool which scans FORTRAN source code and identifies >variables which should be saved. > >This is a simple example of a FORTRAN source code that needs to scan >and insert a SAVE statement: > > subroutine sub (val) > integer val, i > data i/10/ > > 10 val = val * i > i = i -1 > goto 10 > return > end > >When subroutine sub is called the second time the value of i may not be the >same. Therefore, it needs to have a SAVE statement to make i become static. Variables that are initially defined with a DATA statement are static, and don't need a SAVE statement.