(j3.2006) deallocating pointer function results

Bill Long longb
Mon Nov 9 14:47:57 EST 2015

On Nov 9, 2015, at 1:11 AM, Cohen Malcolm <malcolm at nag-j.co.jp> wrote:

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

So, the effective argument is a pointer.  You seem to be saying that pointer cannot become disassociated.  That seems like obvious nonsense to me. Pointers with the INTENT(IN) attribute have that restriction, but that is not the case here.   Sure, when the procedure completes, that pointer will disappear, but that is not relevant.   The effect of deallocating the dummy argument is to deallocate the target of the pointer that is the effective argument, and to mark both the dummy pointer and the effective argument pointer to disassociated.  Simple.  I don?t see how that has anything to do with the ?X+1? non-anology.  

I?m coming around to believe that the point of the inconsistency in the original program example was that the statement

   deallocate (pointer_valued_func_ref( ) )

should be allowed, and the current text in the standard is too restrictive.


Bill Long                                                                       longb at cray.com
Fortran Technical Support  &                                  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