Fwd: (Re)allocation of allocatable arrays on assignment - F2003

Paul Richard Thomas paul.richard.thomas@gmail.com
Sat Oct 23 09:28:00 GMT 2010


Cc: fortran@gcc.gnu.org


Dear Dominique and Tobias,

I thought I should update you on the present state of the allocate on
assignment patch.  It clears all the testcases and the remarks that
you had previously.  At the end of the testcase, you will see that
there is something untoward with scalar references.  I think that I am
picking up the wrong dimensions from the loop_info.  I'll get that
sorted this weekend and then I'll move on to allocatable scalars,
including character(:).

Cheers

Paul

On Sat, Oct 9, 2010 at 3:40 PM, Dominique Dhumieres <dominiq@lps.ens.fr> wrote:
>
> 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



--
The knack of flying is learning how to throw yourself at the ground and miss.
       --Hitchhikers Guide to the Galaxy



--
The knack of flying is learning how to throw yourself at the ground and miss.
       --Hitchhikers Guide to the Galaxy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: check2310.diff
Type: text/x-diff
Size: 15798 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20101023/0da49fef/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-alloc.f90
Type: text/x-fortran
Size: 2442 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20101023/0da49fef/attachment-0001.bin>


More information about the Fortran mailing list