(j3.2006) VALUE attribute question

Bill Long longb
Thu Apr 30 11:59:56 EDT 2015

On Apr 30, 2015, at 10:42 AM, Lionel, Steve <steve.lionel at intel.com> wrote:

> 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

That was my expectation as well, although it appears that the standard does not say that in

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

I guess it is a reasonable argument that specifying finalization is already an admission that the programmer does not expect high performance. 


> (This inspires me to write a test for this case to make sure we do it!)
> Steve Lionel
> Intel Developer Support
> Merrimack, NH
> _______________________________________________
> J3 mailing list
> J3 at mailman.j3-fortran.org
> http://mailman.j3-fortran.org/mailman/listinfo/j3

Bill Long                                                                       longb at cray.com
Fortran Technical Suport  &                                  voice:  651-605-9024
Bioinformatics Software Development                     fax:  651-605-9142
Cray Inc./ Cray Plaza, Suite 210/ 380 Jackson St./ St. Paul, MN 55101

More information about the J3 mailing list