Warning: SAVE statement at

Steve Kargl sgk@troutmask.apl.washington.edu
Tue May 31 22:54:00 GMT 2011


On Tue, May 31, 2011 at 03:45:55PM -0700, Hans Horn wrote:
> Folks,
> 
> what "danger" am I being warned about with this warning as issued by GNU 
> Fortran (GCC) 4.5.2:
> 
>   Warning: SAVE statement at (1) follows blanket SAVE statement
> 
> It is creating a lot of noise for me.
> Can I possibly turn it off individually?
> 
> Thx.,
> H.

Well, given you forgot to include a small example,
I'll writing one for you,

  program foo
    integer i
    save
    save i
    i = 42
    print *, i
  end program foo

troutmask:kargl[284] gfortran -o z foo.f90
foo.f90:4.8:

    save i
        1
Warning: SAVE statement at (1) follows blanket SAVE statement

So, we now look at the Fortran 2003 Standard, 

   C570 (R543) If a SAVE statement with an omitted saved entity
   list occurs in a scoping unit, no other explicit occurrence
   of the SAVE attribute or SAVE statement is permitted in the
   same scoping unit.

In short, your programs do not conform to the Fortran Standard.
Instead of trying to turn-off the warning with an option (which
btw does not exist), fix your code.

-- 
Steve



More information about the Fortran mailing list