Print

Print


One thought: since different routines can map out a common area in different ways, use of the common by one routine could be undone by its use by another, mapping it differently. Perhaps that is what was meant. But then how would SAVE fix this?

RAR

-----Original Message-----
From: Fortran 90 List [mailto:[log in to unmask]]On Behalf
Of Russell, Richard
Sent: Tuesday, March 02, 2004 4:23 PM
To: [log in to unmask]
Subject: COMMON & SAVE


(I sent this to the Lahey forum early today, but so far it hasn't been posted. Re-posted for this audience:)

I noticed something in the LF95 language manual (rev. F, p.90), under COMMON. "Execution of a RETURN or END statement can cause data objects in a named common to become undefined unless the common block name has been declared in a SAVE statement." This strikes me as peculiar, since the whole purpose of a named COMMON block is to make the data in it globally available to any subprogram that references the block. Loss of data upon RETURN suggests that preservation of data is ensured only in the forward direction (A sets something and calls B; B can use it). Loss of data is almost as though COMMON were treated like local variables, usually allocated on the stack upon entry. In practice, the linker collects the maximum size of a COMMON area defined in the object files and allocates a fixed area in memory for it, then relocates the pointers to it in the object subprograms. That is why I have never had to use SAVE in conjunction with a COMMON block.

So, can someone explain the statement in the manual? Perhaps static assignment of COMMON areas is the way implementation is done in practice, but I can't imagine how data in a named COMMON could be lost upon return if the data are to be "common" with other routines.

RAR


-----------------------------------------
*****************Internet Email Confidentiality Footer****************** 

Privileged/Confidential Information may be contained in this message.  
If you are not the addressee indicated in this message (or responsible 
for delivery of the message to such person), you may not copy or deliver
this message to anyone. In such case, you should destroy this message
and notify the sender by reply email. Please advise immediately if you
or your employer do not consent to Internet email for messages of this
kind. Opinions, conclusions and other information in this message that
do not relate to the official business of The Shaw Group Inc. or its

subsidiaries shall be understood as neither given nor endorsed by it.
________________________________________________________________________
The Shaw Group Inc.
http://www.shawgrp.com