This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: (Re)allocation of allocatable arrays on assignment - F2003
- From: dominiq at lps dot ens dot fr (Dominique Dhumieres)
- To: fortran at gcc dot gnu dot org
- Cc: burnus at net-b dot de, paul dot richard dot thomas at gmail dot com
- Date: Sat, 09 Oct 2010 15:40:01 +0200
- Subject: Re: (Re)allocation of allocatable arrays on assignment - F2003
Reduced test case for nf.f90
program NF
implicit none
integer,parameter :: dpkind=kind(1.0D0)
integer :: nx=9 , ny=10 , nz=9
real(dpkind),allocatable,dimension(:) :: ad,g
integer :: nxyz , nxy
nxy = nx*ny ; nxyz = nxy*nz
allocate(ad(nxyz),g(nxyz))
ad=111.001d0
call GetGI3D(1,nxyz)
deallocate(ad,g)
contains
subroutine GetGI3D(i1,i2)
integer :: i1 , i2
integer :: i
g = ad
print *, g(i1), g(i2), ad(i2), maxval(abs(ad-g))
end subroutine GetGI3D
end
result without patch
111.00100000000000 111.00100000000000 111.00100000000000 0.0000000000000000
with patch
111.00100000000000 0.0000000000000000 111.00100000000000 111.00100000000000
i.e., the last element of 'ad' is not assigned to 'g',
probably the signature of what Tobias reported in
http://gcc.gnu.org/ml/fortran/2010-10/msg00112.html
Dominique