(j3.2006) deallocating pointer function results

Cohen Malcolm malcolm
Mon Nov 9 02:11:45 EST 2015


> Subclause 15.5.2.6, paragraph 2, states
>
>       While two pointers are name associated, storage associated, or
>       inheritance associated, if the association status of one pointer
>       changes, the association status of the other changes accordingly.
>
> Argument association is a form of name association.
...
>But this wording seems to avoid the problem with the example.

No it does not.

>  This applies if two pointers are name associated,

And indeed there are two pointers, and indeed they are argument associated 
AND THEREFORE "name associated" (see end of message).

> but the example does not have pointer (in the name sense) on the caller 
> side.

Where are you getting this specification that argument association only 
applies to actual arguments that are simple names?  Simply not so.

Consider
   CALL ZAP(X%P)
   ...
   SUBROUTINE ZAP(Q)
   POINTER Q
   NULLIFY(Q)

Your argument would imply that this does not nullify the pointer X%P, 
because it is not a name.  That is an obviously fallacious argument.

>  So there is no corresponding disassociation of the actual argument.

The effective argument exists and is name associated.

>  Which makes sense, since the actual is an expression (function 
> reference).

No it does not make sense.  The dummy argument (which *is* a name, thus 
"name association") is associated with the effective argument, which is a 
pointer, being the result of a function reference.

Thus "changes accordingly" would mean the result of the function reference 
changes accordingly!  Obviously nonsense, just the same as the nonpointer 
case of assigning a value to a dummy associated with an actual argument of 
"X+1".

Look it up:
   "name association" is a defined term which does not say anything about it 
being between names, and includes the entirety of argument association.
  "argument association" is a defined term "association between an effective 
argument and a dummy argument (12.5.2)".

12.5.2 certainly covers this case.  Dummy arguments are always names (except 
for alternate return indicators), but an effective argument is never 
required to be a name.

Cheers,
-- 
........................Malcolm Cohen, Nihon NAG, Tokyo. 




More information about the J3 mailing list