(j3.2006) VALUE attribute question

Lionel, Steve steve.lionel
Thu Apr 30 11:42:50 EDT 2015

Bill writes:

"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?  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.   Of course, if the dummy
argument with VALUE is never defined in the procedure, there is no reason to
make a temp copy (an obvious optimization if the argument is an array), and
in that case finalization would be a bad idea.   It's not clear how we would
say "only in the case where a temp is made" in the standard."

The standard says "become argument associated with a definable anonymous
data object whose initial value is the value of the actual argument". If the
type of the argument has a finalizer then I would expect it to become
finalized when it goes out of scope.  Depending on where the copy is made
(caller or callee), this might be in different scopes but it will happen
eventually. I don't see that the standard allows for the case of not
creating the temp, but if the implementation is clever enough to do this it
should probably always create a temp if the type has a finalizer somewhere
in it.

(This inspires me to write a test for this case to make sure we do it!)

Steve Lionel
Intel Developer Support
Merrimack, NH

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6616 bytes
Desc: not available
Url : http://mailman.j3-fortran.org/pipermail/j3/attachments/20150430/fe7c2849/attachment.bin 

More information about the J3 mailing list