[mpich-discuss] mpich2-1.0.7 file mpif.h and fortran compiler g95

Martin Siegert siegert at sfu.ca
Sat Oct 11 16:13:10 CDT 2008


Surely this is not a mpich problem but a problem with the program
that includes the blanket save statement. The Fortran standard is
quite clear about this:

"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."

Thus, this is not a problem related to g95 since it follows the standard
(you could argue that the gfortran behaviour is actually incorrect).
Other compilers could (should) behave the same way.
In other words, if you do have a blanket save statement you either do not
include any other files or you must make sure that those included files
do not contain save statements. If you cannot guarantee that because,
e.g., those files are from third party software, you must not have
a blanket save statement, but list the saved variables explicitly.

Cheers,
Martin

-- 
Martin Siegert
Head, Research Computing
WestGrid Site Lead
IT Services                                phone: 778 782-4691
Simon Fraser University                    fax:   778 782-4242
Burnaby, British Columbia                  email: siegert at sfu.ca
Canada  V5A 1S6

On Sat, Oct 11, 2008 at 12:33:47PM +0200, cornelis.broeders at web.de wrote:
> problem is reproducable with following procedures:
> 
> 1) create file savetest.F with 4 lines:  
> 
>      save
> #include "sav.h"
>       stop
>       end
> 
> 2) create file sav.h with 2 lines:
> 
>       integer*4 j
>       save j
> 
> 3) run g95 result:
> 
> g95 -o savetest savetest.F
> In file sav.h:2
> 
>     Included at savetest.F:2
> 
>       save j
> 
> 
>           1
> Error: SAVE statement at (1) follows blanket SAVE statement
> 
> 4) for completeness gfortran: 
> 
> gfortran -o savetest savetest.F
> sav.h:2.10:
>     Included at savetest.F:3:
> 
>       save j
>          1
> Warning: SAVE statement at (1) follows blanket SAVE statement
> sav.h:1.17:
>     Included at savetest.F:3:
> 
>       integer*4 j
>                 1
> Warning: Duplicate SAVE attribute specified at (1)
> 
> I hope this information helps.
> 
> C.H.M. Broeders     http://www.cornelis-broeders.de     
> 
> 
> > -----Ursprüngliche Nachricht-----
> > Von: "Anthony Chan" <chan at mcs.anl.gov>
> > Gesendet: 10.10.08 22:23:43
> > An: mpich-discuss at mcs.anl.gov
> > Betreff: Re: [mpich-discuss] mpich2-1.0.7 file mpif.h and fortran compiler g95
> 
> 
> > 
> > I don't see mpif.h has any "blanket" SAVE statement (assume I don't
> > misinterpret what a "blanket" SAVE is).  To help us understand the issue,
> > can you send us a simple fortran MPI program that illustrates the need
> > of such a construct in mpif.h ?
> > 
> > Thanks,
> > A.Chan
> > 
> > ----- "cornelis broeders" <cornelis.broeders at web.de> wrote:
> > 
> > > Hello,
> > > I encountered the error message "SAVE statement at (1) follows blanket
> > > SAVE statement"  during installation of the huge package mcnpx. After
> > > some efforts I found that this message is generally issued by g95 (and
> > > gfortran?) if a program with a previous "save" statement includes a
> > > file, like mpif.h, containing  "save var" statements. Putting the SAVE
> > > statements of mpif.h in an exclude construct "#ifndef G95  ... #endif
> > > solved my problem. I propose to include such kind of patch for g95 in
> > > future releases of mpich2. Could somebody comment on this proposal?
> > > Best regards,  
> > > 
> > > 
> > > 
> > > C.H.M. Broeders,       http://www.cornelis-broeders.de
> > 
> > 
> 
> -- 
> http://www.cornelis-broeders.de 
> 
> 
> 
> 
> C.H.M. Broeders,       http://www.cornelis-broeders.de




More information about the mpich-discuss mailing list