Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Error in arguments of MOVE_ALLOC

A__Valle
Beginner
680 Views

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:

[fortran]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 !}[/fortran]

What am I missing?

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

Thanks for any help.

Dirk

0 Kudos
2 Replies
Simon_Geard
New Contributor I
680 Views

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?

0 Kudos
A__Valle
Beginner
680 Views

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

My fault

Dirk

0 Kudos
Reply