(j3.2006) does move_alloc violate restrictions in

Van Snyder van.snyder
Thu Oct 29 22:59:04 EDT 2009

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.

Jim Xia wrote:
> > While I agree that intrinsics can be special, I would expect the
> > standard to call out the cases where they are.  As I explained in my
> > previous response (copied below), I think MOVE_ALLOC is
> > subject to the usual rules.
> Thanks Bob for your reply.  That is not what I have in mind 
> unfortunately.  I'm a bit of tired on the discussions on this very 
> topic, and have many other issues to work with.  But I'll not be 
> surprised to see the same question re-surface in a few years time when 
> more implementations available.  Someone might ask the same question 
> if the following code is standard conforming
> subroutine foo (a, b)
>    ...
>    call move_alloc(a,b)
> end subroutine
> As of right now, I doubt it is.  But let's put it aside as I don't 
> feel the email correspondence is really productive.
> Cheers,
> Jim Xia
> XL Fortran Compiler Test
> IBM Toronto Lab at 8200 Warden Ave, Markham, On, L6G 1C7
> Phone (905) 413-3444  Tie-line 313-3444
> email: jimxia at ca.ibm.com
> D2/YF7/8200 /MKM
> http://www.ibm.com/software/awdtools/fortran/xlfortran

More information about the J3 mailing list