From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14334 invoked by alias); 26 Oct 2012 16:47:42 -0000 Received: (qmail 14137 invoked by uid 48); 26 Oct 2012 16:47:19 -0000 From: "janus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/37336] Fortran 2003: Finish derived-type finalization Date: Fri, 26 Oct 2012 16:47: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: X-Bugzilla-Severity: enhancement 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: 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/msg02480.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37336 --- Comment #13 from janus at gcc dot gnu.org 2012-10-26 16:47:08 UTC --- Latest patch at: http://gcc.gnu.org/ml/fortran/2012-10/msg00126.html This patch compiles the test case in comment 6 without errors, but the finalizer is not called. However, when changing the main program to ... program main use child_module implicit none class(child),allocatable :: infant allocate(infant,source=new_child()) end ... the finalizer is called twice: Once at the end of the main program, and once through the _copy procedure (which is invoked by the ALLOCATE statement), I think. Not sure if this is the expected behavior. If the "class(child)" here is changed to "type(child)", no finalization is done (and in fact not even a finalization routine is generated for the type 'child'). But certainly it should, just as for the original test case in comment 6.