- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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…
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
![](/skins/images/2E08A100FB92911314A240D1EAFB2828/responsive_peak/images/icon_anonymous_message.png)
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page