(j3.2006) deallocating pointer function results

Bill Long longb
Wed Nov 4 18:33:22 EST 2015


On Nov 4, 2015, at 5:17 PM, Robert Corbett <robert.corbett at oracle.com> wrote:

> On 11/04/15 06:04, Bill Long wrote:
>> On Nov 4, 2015, at 12:31 AM, Malcolm Cohen<malcolm at nag-j.co.jp>  wrote:
>> 
>>> I agree with that.  Moreover, the DEALLOCATE sets the pointer association
>>> status of the dummy argument (and thus the actual) to disassociated, which
>>> clearly cannot be done unless it is a "real" pointer variable.
>> 
>> The fact that deallocation of a pointer causes it to become disassociated is clearly stated in 16.5.2.4(2).  While entirely expected, I don?t see a corresponding statement in that subclause that a pointer that is argument, host, or use associated with a pointer that is deallocated also becomes disassociated.  Should there be a statement like that in 16.5.2.4 (Events that cause pointers to become disassociated) ?   It then becomes relevant how the statement is worded.  If ?A pointer becomes disassociated if it is argument, use, or host associated with a pointer that becomes disassociated.?, then the case of the argument in the caller being a function reference is not a problem, since there is no ?pointer? in the caller that is argument associated.
>> 
> 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.

I assume you meant 16.5.2.6.  Thanks for the reference - that?s what I was looking for.   But this wording seems to avoid the problem with the example.  This applies if two pointers are name associated, but the example does not have pointer (in the name sense) on the caller side.  So there is no corresponding disassociation of the actual argument.  Which makes sense, since the actual is an expression (function reference). 

Cheers,
Bill


> 
> Robert Corbett
> 
> _______________________________________________
> 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 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