(j3.2006) Did we intend to prohibit this?

Van Snyder Van.Snyder
Thu Mar 9 19:25:23 EST 2017


I have a function F that returns an allocatable result.

I want that put into an allocatable variable V.

I tried

  call move_alloc ( F(X), V )

but that apparently isn't allowed because F(x) isn't a variable.  The
description of move_alloc doesn't say FROM has to be a variable, but its
intent is INOUT.  The OUT part of its INOUT has nothing to do with its
value, only its allocation status (which becomes unallocated).

We don't have any trouble saying that an allocatable function result is
deallocated after it's used.  Why do we have a problem with FROM?

Did we intend to prohibit this?

If I do

  V = F(X)

will most processors do the same as move_alloc, or will they allocate a
new v, copy the contents of the result of F(X) to it, and deallocate the
result of F(X)?





More information about the J3 mailing list