From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31014 invoked by alias); 26 Oct 2010 13:27:32 -0000 Received: (qmail 31002 invoked by uid 22791); 26 Oct 2010 13:27:30 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,MISSING_MID X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 26 Oct 2010 13:27:18 +0000 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/46174] [OOP] ALLOCATE with SOURCE: Deep copy missing 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: burnus at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: CC 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 Date: Tue, 26 Oct 2010 13:27:00 -0000 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: 2010-10/txt/msg02170.txt.bz2 Message-ID: <20101026132700.Xr80dsQURv26ALM2EKSVvsRJOYdKx945P0V-4BwhM-8@z> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46174 Tobias Burnus changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |domob at gcc dot gnu.org --- Comment #3 from Tobias Burnus 2010-10-26 13:27:11 UTC --- Possible implementation scheme: vtab$t contains besides the normal type-bound procedures and init/size/hash also an two function points: $copy and $free, which are of the kind: void $free (struct *DT) { ... free derived types if (DT->$vtab->$extends && DT->$vtab->$extends->$free) DT->$vtab->$extends->$free (DT) } That is, each effective type cleans up its own allocatable components and moves on to the parent. If the parent does not have an allocatable component itself, the $free pointer directly points to an ancestor which has -- or is NULL if no such ancestor exists. The $copy version works alike.