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

Dusty Deck Migration: Common block issue?

jstimatze
Beginner
512 Views
Folks,

I'm migrating a dusty deck of F77 simulation code from the IBM xlf compiler to ifort 8.1 under Linux and I have the following question:

There are several hundred variables in a half dozen common blocks defined for this simulation, but variables used in the code and not listed in common blocks behave differently between xlf and ifort. In xlf, the values of the non-common variables seem to be still maintained between procedure calls, whereas they are zeroed when using ifort. The code (sadly) depends on the older behavior, so I've been going through and finding which variables need to be added to the common blocks manually. However, is there something I'm missing here? Can I force ifort to support this older method? I've tried using -save, but that doesn't seem to help.

I'm still learning about the quirks of older fortran code, so any advice or assistance would be greatly appreciated!

- Justin
0 Kudos
2 Replies
TimP
Honored Contributor III
512 Views
Rather than moving local variables to COMMON, simply to prevent dynamic allocation, specifying them as SAVE variables should accomplish the original intent. A SAVE with no variables specified applies to all local variables. If -save with a current compiler doesn't have that effect, that would be a reportable bug.
0 Kudos
Steven_L_Intel1
Employee
512 Views
Or compile with -save. But giving the variables you want saved the SAVE attribute is by far the better approach.
0 Kudos
Reply