From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 89609 invoked by alias); 27 Apr 2015 12:26:23 -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 Received: (qmail 82150 invoked by uid 48); 27 Apr 2015 12:26:18 -0000 From: "mathewc at nag dot co.uk" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/64921] [4.9/5/6 Regression] FAIL: gfortran.dg/class_allocate_18.f90 Date: Mon, 27 Apr 2015 12:26: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-Version: 5.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: mathewc at nag dot co.uk X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P4 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.9.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-04/txt/msg02278.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64921 --- Comment #14 from Mat Cross --- For the record, perhaps it is of interest for me to note that we are running into this (cf. PR64230 comment 9) on code like Program test Implicit None Type :: t1 Integer, Allocatable :: i End Type Type :: t2 Integer, Allocatable :: i End Type Type, Extends (t1) :: t3 Type (t2) :: j End Type Type, Extends (t3) :: t4 Integer, Allocatable :: k End Type Call s Print *, 'ok' Contains Subroutine s Class (t1), Allocatable :: x Allocate (t4 :: x) End Subroutine End Program Since the crash is in bad compiler-generated finalization code (since 4.9), and given that (if I recall correctly) gfortran is using the Fortran 2008 semantics for entities declared in a main program being implicitly saved, this is why removing the Deallocate (in the comment 12 example) works - the finalizer is never called then. In the interim, does anyone have any bright ideas for a reasonable (few-line) workaround? Thanks.