An allocate error

An allocate error

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!

1 contenuto / 0 nuovi
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione