From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32212 invoked by alias); 2 Oct 2012 21:52:07 -0000 Received: (qmail 32162 invoked by uid 48); 2 Oct 2012 21:51:50 -0000 From: "janus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/54784] [OOP] allocation of extended types with polymorphic allocatable members Date: Tue, 02 Oct 2012 21:52:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: janus at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Status Keywords Last reconfirmed CC Ever Confirmed Summary Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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: 2012-10/txt/msg00170.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54784 janus at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Keywords| |wrong-code Last reconfirmed| |2012-10-02 CC| |janus at gcc dot gnu.org Ever Confirmed|0 |1 Summary|[oop] allocation of |[OOP] allocation of |extended types with |extended types with |polymorphic allocatable |polymorphic allocatable |members |members --- Comment #1 from janus at gcc dot gnu.org 2012-10-02 21:51:49 UTC --- Thanks for reporting this. I can reproduce it with 4.7 and trunk. Here is a reduced test case: program bug implicit none type :: block real, allocatable :: fields end type type :: list class(block),allocatable :: B end type type :: domain type(list),dimension(2) :: L end type type(domain) :: d type(block) :: b1 allocate(d%L(2)%B,source=b1) end program bug This fails at runtime with: Program received signal SIGSEGV: Segmentation fault - invalid memory reference. Backtrace for this error: #0 0x7F379D1FDA97 #1 0x7F379D1FE074 #2 0x7F379C72ED9F #3 0x400804 in __copy_bug_Block at bug.f90:9 #4 0x40097C in bug at bug.f90:19 (discriminator 2) Segmentation fault valgrind shows: ==11046== Invalid read of size 8 ==11046== at 0x400804: __copy_bug_Block (bug.f90:9) ==11046== by 0x40097C: MAIN__ (bug.f90:19) ==11046== by 0x400A88: main (bug.f90:21) ==11046== Address 0x0 is not stack'd, malloc'd or (recently) free'd