Re f77 and -static option

cbas25 at vaxa.strath.ac.uk cbas25 at vaxa.strath.ac.uk
Fri Mar 1 07:01:15 AEST 1991


The following comment just may be relevant to the discussion on the
use of the -static option in F77 compilations.
Fortran 77 provides the option to ensure that values established
in one call to a subroutine are retained till the next call; this is
the statement 'save' put at the beginning of the routine.  
Maybe this is considered beyond the pale by the purists; but consider
the following requirement to pass arbitrarily chosen pairs of parameter
sets to a routine where the total number of sets (n) is not small. 
If this is done with explicitly coded calls there are n**2 possibilities;
if, however, a call is made to a routine with one set, and then a second 
call is made to a ENTRY point with the second set it is possible to 
reduce the total number of subroutine call statements  to 2n. Using the
'save' statement ensures that the first set of parameters are retained.
Use of this command allows some routines to retain values, and others 
not to do so. I know that if you use 'save' then the routines cannot 
be used recursively, but then I'm the sort of person who finds that
a little difficult anyway!!
And of course all of this does not help in the problems of porting
code from other hardware!!!
Now all of this does have a ulterior motive; using this device
I have had no difficulty in the code working as designed when I compiled
the program with the default level of optimization, but when the -O2
or -O3 options are used, the program fails in just those routines where
the above mentioned devide is used.  Any comments?

Peter Bladon, University of Strathclyde,    Phone +44 41 552 4400 x2285
Department of Pure and Applied Chemistry        or   041 552 4400 x2285      
Glasgow, U.K.                             email CBAS25 at uk.ac.strath.vaxa



More information about the Comp.sys.sgi mailing list