https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92178

--- Comment #3 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Tue, Oct 22, 2019 at 07:32:59PM +0000, kargl at gcc dot gnu.org wrote:
> 
> The effect of the intent(out) in assign is to deallocate the code on entry to
> assign. This is done with the if-block.  The side-effect of evaluating the
> first dummy argument is that 'a' in the expression of the 2nd dummy argument 
> is
> undefined.
> 
> F2018 (well 18-007r1) page 308:
> 
>    If a dummy argument has INTENT (OUT) or INTENT (INOUT), the actual
>    argument shall be definable.  If a dummy argument has INTENT (OUT)
>    and its associated actual argument is allocated, the actual argument
>    is deallocated on procedure invocation (9.7.3.2).
> 
> then later
> 
>    15.5.2.13 Restrictions on entities associated with dummy arguments
> 
>    While an entity is associated with a dummy argument, the following
>    restrictions hold.
> 
>    (1) Action that affects the allocation status of the entity or a
>        subobject thereof shall be taken through the dummy argument.
> 
>    (2) If the allocation status of the entity or a subobject thereof
>        is affected through the dummy argument, then at any time during
>        the invocation and execution of the procedure, either before or
>        after the allocation or deallocation, it shall be referenced only
>        through the dummy argument.
> 
> It seems that code is non-conforming.
> 

Seems to be some wiggle room.

  15.5.4 Subroutine reference

  A subroutine is invoked by execution of a CALL statement, ...
  When a subroutine is invoked, all actual argument expressions are
  evaluated, then the arguments are associated, and then the subroutine
  is executed. 

So, it comes down to when the deallocation occur?  P. 308 says the
deallocation occurs when the procedure is invoked.  But, 15.5.4
defines the sequence of events that occur when it procedure is
invoked.  Is the reference to the subroutine name the initiation
of invocation?  No where does it say when the deallocation occurs.

Reply via email to