Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

-save compiler option question

chauvjo
Novice
225 Views
Operating System: Red Hat Enterprise Linux 5.3 Intel Fortran Compiler: ifort (IFORT) 13.0.1 20121010 According to the Intel Fortran documentation, the –save compiler option saves all variables in static allocation except local variables within a recursive routine and variables declared as AUTOMATIC. I recently discovered what appears to be a difference in the interpretation of this option between two different computer systems. Consider the following code segment which is called multiple times: DOUBLE PRECISION Function GetValue(a, b, c, d) IMPLICIT NONE DOUBLE PRECISION a, b, c, d WRITE(6,10) GetValue 10 FORMAT(F8.4) GetValue = a + b + c + d RETURN END On a SGI UNIX system with the code segment compiled with the -static option (equivalent to -save and -zero), the previous value of GetValue has been saved and is printed out. Under RHEL 5.3 with the code segment compiled with the –save and -zero options, the previous value of GetValue has not been saved and is printed as zero. Is this a compiler bug? Thanks…
0 Kudos
1 Reply
Steven_L_Intel1
Employee
225 Views
GetValue here is a function result, not a variable. It may well be that -save doesn't apply to it. You're not allowed to SAVE a function result, so it would not astonish me if -save didn't work here either. Please don't make assumptions on how -save is implemented. I think you are on very shaky ground trying to depend on this behavior.
0 Kudos
Reply