Problem with passing an allocatable array

I’m having trouble compiling the following test code:

module mymod
  subroutine mysub( A )
    real, allocatable, dimension(:,:) :: A
    allocate( A(4,3) )
    A = 3.14
  end subroutine mysub
end module mymod

program test
  use mymod, only : mysub
  real, allocatable, dimension(:,:) :: A
  call mysub( A )
  deallocate( A )
end program test

The error message I get is:

PGF90-S-0084-Illegal use of symbol a - must be an allocatable array (test.f90: 5)

The code compiles OK if I change it so that A is no longer being passed out of subroutine mysub. Is there something wrong with my code? Is there a better way to code this? For what it’s worth, this code compiles fine with Intel’s compiler. Thanks for the help.

Hi gte258v,

Using an allocatable array as a dummy argument is illegal in F95. However, it is part of F2003 and often implemented as an extention to F95. Our next major release (7.0) due out soon will support this feature.

  • Mat