[Bug fortran/41478] Corrupted memory using PACK for derived-types with allocated components

tkoenig at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Fri Dec 4 20:34:00 GMT 2009



------- Comment #14 from tkoenig at gcc dot gnu dot org  2009-12-04 20:33 -------
The problem is with the allocatable components for
intrinsics, at least.

This has the same problem:

program main

 type :: container_t
    integer, dimension(:), allocatable :: entry
 end type container_t

 type(container_t), dimension(2) :: a1, a2
 integer :: i

 do i = 1, 2
    allocate (a1(i)%entry (1), a2(i)%entry (1))
    a1(i)%entry = 1
    a2(i)%entry = 0
 end do

 a1 = eoshift(a2, 1)

end program main

What we must do is to deallocate anything on the
left hand side of the assignment, so instead of
using

  a1 = eoshift(a2,1)

we shoud loop over a1, deallocate everything, and then
do the assignment.

This looks like heavy front-end work, is anybody up for this? :-)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41478



More information about the Gcc-bugs mailing list