[J3] surprisingly PURE

Steven G. Kargl kargl at troutmask.apl.washington.edu
Sun Apr 19 18:47:27 EDT 2020


On Sun, Apr 19, 2020 at 08:43:24PM +0000, Bill Long via J3 wrote:
> 
> 
>> On Apr 19, 2020, at 2:16 PM, Steve Lionel via J3 <j3 at mailman.j3-fortran.org> wrote:
>> 
>> I admit that I am not all that good as a language lawyer, but I
>> think Steve K has it right.
>> 
>> C1594 says (with irrelevant parts removed):
>> 
>> In a pure subprogram any designator with a base object that
>> is in common or accessed by host or use association
> 
> The base object is Y which is local to the subprogram. 
> 
>> ,...  or an object that is storage associated with any such
>> variable, shall not be used
>>  (1) in a variable definition context (19.6.7),
> 
> Defining a pointer IS defining the target of the pointer.  X is
> host associated.  Defining y%p is defining X and so it might be
> already covered. 
> 
> Certainly disallowing this case is consistent with the intention
> that PURE procedures do not modify non-argument-asscoiated
> variables outside their scope. 
> 

I think we're looking for

19.5.2.7 Pointer definition status

The definition status of an associated pointer is that of its
target.  If a pointer is associated with a definable target, it
becomes defined or undefined according to the rules for a variable
(19.6).

Y%P is associated with the host-associated variable X.  Doesn't 
C1594 (1) then apply as X cannot appear in variable definition
context.

-- 
Steve


More information about the J3 mailing list