From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3615 invoked by alias); 4 Dec 2009 20:34:05 -0000 Received: (qmail 3508 invoked by uid 48); 4 Dec 2009 20:33:47 -0000 Date: Fri, 04 Dec 2009 20:34:00 -0000 Message-ID: <20091204203347.3507.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/41478] Corrupted memory using PACK for derived-types with allocated components In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "tkoenig at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2009-12/txt/msg00427.txt.bz2 ------- 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