Hi!
I have to read some data into an array, but the number of points is not known on beforehand. Therefore, I made the array ALLOCATABLE. To keep my main routine clean, I deferred the actual reading and allocation to a subroutine. I narrowed down the problem to just a few lines, see below. The compiler refuses to accept the code, telling me:
pgf90 testallo.f90 -o testallo.exe
PGF90-S-0134-Illegal attribute - conflict with intent (testallo.f90: 8)
0 inform, 0 warnings, 1 severes, 0 fatal for allocateandfillarray
The code runs fine with g95. Changing the INTENT to anything else did not make any difference.
Do you have a suggestion?
Regards,
Arjan
MODULE MyModule
IMPLICIT NONE
PRIVATE
PUBLIC :: AllocateAndFillArray
CONTAINS
!
SUBROUTINE AllocateAndFillArray(MyArray)
INTEGER, DIMENSION(:), ALLOCATABLE, INTENT(INOUT) :: MyArray
INTEGER :: i,N
N = 7
ALLOCATE(MyArray(7))
DO i = 1,N
MyArray(i) = 3i-10
ENDDO
END SUBROUTINE AllocateAndFillArray
!
END MODULE MyModule
PROGRAM Test
USE MyModule
INTEGER, DIMENSION(:), ALLOCATABLE :: MyArray
INTEGER :: I,N
CALL AllocateAndFillArray(MyArray)
N = SIZE(MyArray)
WRITE(,) ‘Array has ‘,N,’ elements:’
DO i=1,N
WRITE(,*) ‘Array[’,I,’] = ',MyArray(i)
ENDDO
DEALLOCATE(MyArray)
END PROGRAM Test