Question on using SAVE for arrays

Hello,

After declaring an array in a subroutine, I would like to save it for future calls to the subroutine. My code looks as follows:

SUBROUTINE SUB (a,b,VAR1,x,y)
REAL VAR1(3, x, y)
SAVE VAR1

When I compile, I get an error as follows:
PGF90-S-0050-Assumed size array, VAR1, is not a dummy argument

This code was compiled successfully with XLF, but f90 chokes.
Any suggestions on how to compile this successfully with f90?

Thanks.

Sarav

Hi Sarav,

The error message is a bit off but the problem is that Fortran does not allow the use of the SAVE attribute on dummy arguments. One thing you could do instead would be to put VAR1 into a module and make it an allocatable array.

I don’t know why XLF allows this since it is illegal. Do they issue a warning and just ignore the save attribute?

  • Mat

Hi Mat,

Thanks for the response.

From what you wrote, pgf90’s error message that I got seems to be quite the opposite. Hope someone from PGF90 is reading this. Let me try what you suggested.

Your guess with XLF was right on. Yeah, it gave me a warning, ignored the save and proceeded with the compilation.

Sarav