(j3.2006) does move_alloc violate restrictions in 12.5.2.13?

Robert Corbett Robert.Corbett
Fri Oct 30 04:15:00 EDT 2009


Van Snyder wrote:
> Is this subroutine standard conforming?
> 
> subroutine Move_Alloc ( A, B )
>  real, intent(inout), allocatable :: A
>  real, intent(out), allocatable :: B
>  allocate ( b )
>  b = a
>  deallocate ( a )
> end subroutine Move_Alloc
> 
> Now, how about if I call it
>  call move_alloc ( x, x )
> 
> The call is a problem, not the subroutine.
> 
> There's no problem with the standard's description of the intrinsic 
> subroutine Move_Alloc.

I don't think your Fortran subroutine Move_Alloc demonstrates the
case that bothers Jim.  I think his concern is about the transfer
of an allocated object from the argument FROM to the argument TO.
No such transfer happens in your example.

Bob Corbett



More information about the J3 mailing list