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

An allocate error

hillyuan
Beginner
582 Views
I am encounting a very strange run-time error at following code
----------------------------------------------------------
DOUBLE PRECISION,ALLOCATABLE, DIMENSION(:,:) :: coordinate
INTEGER, ALLOCATABLE, DIMENSION(:,:) :: element
INTEGER, ALLOCATABLE, DIMENSION(:) :: elementType
INTEGER, DIMENSION(n) :: a,b

DO i=1,n
...
ALLOCATE(coordinate(a(i),3),STAT=status)
ALLOCATE(element(b(i),3),STAT=status)
ALLOCATE(elementType(b(i)),STAT=status)
...
DEALLOCATE(coordinate,element,elementType)
...
ENDO
----------------------------------------------------------

When i==1,no problem.
When i==2. At first, all the allocatble arrays are in the state of undefined pointer/array. But after ALLOCATE(coordinate(a(i),3) is excuted, Array element turns to be allocated automatically with its size as (b(1),3), but elementType is still an undefined array. Therefore, the excution of Allocate(element(b(2),3)) would give rise to a severe error" allocatable array is already allocated" (status=151). Could you tell me what's the possible reason?
Thanks!
0 Kudos
0 Replies
Reply