(j3.2006) VALUE attribute question

Malcolm Cohen malcolm
Thu Apr 30 22:35:22 EDT 2015

If a dummy argument has the VALUE attribute, variable used in the procedue is 
often a temp copy of the actual argument.  If the type has a FINAL routine, is 
the temp supposed to he finalized at the end of the procedure execution?

No, it is not.

I don?t see where the standard says that happens,


but the temp seems similar to a local variable of the procedure and some of 
those do get finalized at the end of the procedure execution.

I agree that the interaction here is "interesting".  However, the temp is not 
*assigned* the value, and there is no opportunity for the user program to do any 
necessary initialisation, such as deep-copying pointer components.  Thus 
finalising it is likely to be equivalent to finalising the actual argument; it 
would be extremely surprising indeed for passing a variable to a VALUE argument 
to effectively finalise that variable!

We had an interp a while back which addresses how finalisation was supposed to 
work, in particular, how it was supposed to be usable in at least a couple of 
the particular cases it was supposed to be addressing.  That interp has 
rationale which explains when certain things should or should not be finalised.

In particular, compiler temps are *NEVER* finalised.  The compiler can introduce 
any number of temps it wants to all over the place, without affecting the 
program semantics.

................................Malcolm Cohen, Nihon NAG, Tokyo. 

More information about the J3 mailing list