Fortran 90 doesn't keep lower/upper array bounds after copy to another allocatable array
问题 This doesn't work program main implicit none integer :: nx = 3 integer :: ny = 5 integer :: nz = 8 real, allocatable, dimension(:,:,:) :: A real, allocatable, dimension(:,:) :: B allocate(A(nx,0:ny,nz) ) ! ...do something with array A and at some point cope a slice of A to B: B = A(:,:,1) ! in this case B is (1:nx, 1: ny+1) end program main The code above automatically allocates B and copies A(:,:,1) to B. However it doesn't keep the lower/upper bound of 0/ny, instead B has its lower bound to