Error in arguments of MOVE_ALLOC

Error in arguments of MOVE_ALLOC

D.W. van Meeuwen's picture

Dear all,

When compiling the following code, I get an error that the argument of MOVE_ALLOC shall be an allocatable object:

error #8195: The argument to the MOVE_ALLOC intrinsic subroutine shall be an allocatable object.   [MOVE_ALLOC]

In this example both arguments are allocatable:

FUNCTION Test_MoveAllocFunc(newSize) RESULT(idPS) !{
   !** HEADER VARIABLES/ARGUMENTS
    IMPLICIT NONE
    INTEGER :: newSize
  
  !** RETURN VARIABLE
    INTEGER :: idPS
  !** LOCAL VARIABLES
    TYPE(PSType), POINTER :: TempPS(:)
    TYPE (PSType), POINTER :: UI_PS(:)=>null()
  !*****************************************************************************
    TempPS=>null()
    ALLOCATE(TempPS(-1:newSize-1), SOURCE=UI_PS)
    DEALLOCATE(UI_PS)
    ALLOCATE(UI_PS(-1:newSize))
    
    CALL MOVE_ALLOC(TempPS, UI_PS)
    idPS=newSize
    
  ENDFUNCTION Test_MoveAllocFunc !}

What am I missing?

I am using windows 7x64, VS2010, Composer 2013 latest update.

Thanks for any help.

Dirk

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
sgeard@cad-schroer.co.uk's picture

They're not allocatable they're pointer. If you delete lines 12 and 14, remove the initialization in line 10 and replace POINTER with ALLOCATABLE do you still get an error?

D.W. van Meeuwen's picture

Thanks for the fast response. This is very clear as well from the message when I read it again.

My fault

Dirk

Login to leave a comment.