Hello,
using the Intel Fortran Compiler 5.0 for linux I encountered the
following problem using dynamic arrays:
!The arrays are declared:
REAL(DP), ALLOCATABLE, DIMENSION(:, :) :: c_coord, n_coord, o_coord
!and allocated
ALLOCATE (c_coord(3,n), n_coord(3,n), o_coord(3,n))
!then used by some subroutines and afterwards deallocated:
DEALLOCATE (c_coord, n_coord, o_coord)
The Program is runnig when compiled with
ifc -O0
but terminates with the error
Deallocate error 492: Array is not allocated
when compiled with
ifc -03
In order to find the error, I modified the Program:
WRITE(*,*) ALLOCATED(c_coord)
WRITE(*,*) ALLOCATED(n_coord)
WRITE(*,*) ALLOCATED(o_coord)
ALLOCATE (c_coord(3,n), n_coord(3,n), o_coord(3,n))
WRITE(*,*) ALLOCATED(c_coord)
WRITE(*,*) ALLOCATED(n_coord)
WRITE(*,*) ALLOCATED(o_coord)
... some calculation
WRITE(*,*) ALLOCATED(c_coord)
WRITE(*,*) ALLOCATED(n_coord)
WRITE(*,*) ALLOCATED(o_coord)
DEALLOCATE (c_coord)
WRITE(*,*) ALLOCATED(c_coord)
WRITE(*,*) ALLOCATED(n_coord)
WRITE(*,*) ALLOCATED(o_coord)
DEALLOCATE (n_coord)
WRITE(*,*) ALLOCATED(c_coord)
WRITE(*,*) ALLOCATED(n_coord)
WRITE(*,*) ALLOCATED(o_coord)
DEALLOCATE (o_coord)
WRITE(*,*) ALLOCATED(c_coord)
WRITE(*,*) ALLOCATED(n_coord)
WRITE(*,*) ALLOCATED(o_coord)
I get the output:
F
F
F
T
T
T
T
T
T
F
T
T
Deallocate error 492: Array is not allocated
So it seems that with c_coord everything is allright but not with
n_coord, which is used and treated the same way. Further I do not
understand, why ALLOCATED(n_coord) can be true and the
DEALLOCATE(n_coord) fails with the above error message.
I would be grateful, if somebody could help me to fix this.
Jens Bredenbeck
|