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

--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> 2010-10-24 
10:04:19 UTC ---
Actually, it does not have anything to do with PACK but rather with the
assignment -- which implicitly also happens if one uses
  print *, pack(a2,[.true.])

The assignment works as follows:

a) Free the pointer target of a1(1:1)%entry
b) Pack: a1 = a2  ! struct a1 is OK, but a1%entry points to b1%entry
c) allocate(tmp), allocate(tmp%entry), memcopy(tmp%entry = a1%entry)
d) a1 = tmp  ! i.e. a1%entry now points to tmp%entry
e) free(tmp) ! but not free(tmp%entry)

Reply via email to