From patchwork Sun Sep 15 12:51:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 275019 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id BD45B2C0101 for ; Sun, 15 Sep 2013 22:51:38 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=IaZxA6LyanUfwSsni+UYE8s1HSiCVZf0ji/eNtggMiTcwB ZC24BR5KYJORUzQnx2Bv7nQE6ct0pfuZD4jQxICKZcet+HyC4IAvieE7Ab1vyxQ8 uTg4qksS0T5szzowdPnjMeJ6iDQseDsVA0vfTo8n2KTKAr+3DRly71vd00ZF0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=Jau6t6s1nG41UWZs0i5ZEvM7CUw=; b=B6P+09Y1JK2L/4UkJ5b2 lc9HalioPQ+m3tH/lChP9ctDUZmde7fFn7vG2ZtwjoRDoLvnIoJU7/w7R7oBqus5 wLlAtnZRQ6IkX71My1+dIclveFxDdyZblnYZ5lZWh1ap2NPP3M9hu0nV5/OqxDkm DgXCTUeT5LOPY6fEr6NqYHE= Received: (qmail 24272 invoked by alias); 15 Sep 2013 12:51:27 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 24254 invoked by uid 89); 15 Sep 2013 12:51:27 -0000 Received: from mx02.qsc.de (HELO mx02.qsc.de) (213.148.130.14) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Sun, 15 Sep 2013 12:51:27 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: Yes, score=6.5 required=5.0 tests=AWL, BAYES_00, KHOP_DYNAMIC, RCVD_IN_BRBL_LASTEXT, RCVD_IN_PBL, RCVD_IN_SEMBLACK, RCVD_IN_SORBS_DUL, RDNS_DYNAMIC autolearn=no version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx02.qsc.de Received: from archimedes.net-b.de (port-92-194-31-5.dynamic.qsc.de [92.194.31.5]) by mx02.qsc.de (Postfix) with ESMTP id 20CB727783; Sun, 15 Sep 2013 14:51:21 +0200 (CEST) Message-ID: <5235AD49.30303@net-b.de> Date: Sun, 15 Sep 2013 14:51:21 +0200 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: gcc patches , gfortran Subject: [Patch, Fortran] PR58356 - fix ICE with finalizer in type extension A rather obvious patch. Build and regtested on x86-64-gnu-linux. OK for the trunk? Tobias 2013-09-15 Tobias Burnus PR fortran/58356 * class.c (generate_finalization_wrapper): Init proc_tree if not yet resolved. 2013-09-15 Tobias Burnus PR fortran/58356 * gfortran.dg/finalize_19.f90: New. diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c index 629b052..7117e83 100644 --- a/gcc/fortran/class.c +++ b/gcc/fortran/class.c @@ -1881,6 +1881,8 @@ generate_finalization_wrapper (gfc_symbol *derived, gfc_namespace *ns, for (fini = derived->f2k_derived->finalizers; fini; fini = fini->next) { + if (!fini->proc_tree) + fini->proc_tree = gfc_find_sym_in_symtree (fini->proc_sym); if (fini->proc_tree->n.sym->attr.elemental) { fini_elem = fini; diff --git a/gcc/testsuite/gfortran.dg/finalize_19.f90 b/gcc/testsuite/gfortran.dg/finalize_19.f90 new file mode 100644 index 0000000..1eeb6af --- /dev/null +++ b/gcc/testsuite/gfortran.dg/finalize_19.f90 @@ -0,0 +1,21 @@ +! { dg-do compile } +! +! PR fortran/58356 +! +! Contributed by Andrew Benson +! +module ct + type :: cfl + contains + final :: cfld + end type cfl + type, extends(cfl) :: cfde + contains + end type cfde +contains + subroutine cfld(self) + implicit none + type(cfl), intent(inout) :: self + return + end subroutine cfld +end module ct