An allocate error

An allocate error

Portrait de hillyuan

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 contribution / 0 nouveau(x)
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.