From patchwork Mon Dec 19 20:21:25 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 132309 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]) by ozlabs.org (Postfix) with SMTP id A0CC5B6FF3 for ; Tue, 20 Dec 2011 07:21:50 +1100 (EST) Received: (qmail 29810 invoked by alias); 19 Dec 2011 20:21:42 -0000 Received: (qmail 29792 invoked by uid 22791); 19 Dec 2011 20:21:40 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mx01.qsc.de (HELO mx01.qsc.de) (213.148.129.14) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 19 Dec 2011 20:21:27 +0000 Received: from [192.168.178.22] (port-92-204-92-59.dynamic.qsc.de [92.204.92.59]) by mx01.qsc.de (Postfix) with ESMTP id 986223CD52; Mon, 19 Dec 2011 21:21:25 +0100 (CET) Message-ID: <4EEF9CC5.6090002@net-b.de> Date: Mon, 19 Dec 2011 21:21:25 +0100 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 To: gcc patches , gfortran Subject: [Patch, Fortran, committed] PR 51605: Don't merge local labels with host-associated procedures 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 I have committed the attached patch as obvious (Rev. 182497). gfortran merged the symbol of a local label like: label_name: block end block label_name with a later-declared procedure with the same name ("subroutine label_name()") which lead to an ICE and interesting code paths. Built, regtested and committed on x86-64-linux. Tobias Index: gcc/fortran/ChangeLog =================================================================== --- gcc/fortran/ChangeLog (Revision 182496) +++ gcc/fortran/ChangeLog (Arbeitskopie) @@ -1,6 +1,12 @@ 2011-12-19 Tobias Burnus PR fortran/51605 + * parse.c (gfc_fixup_sibling_symbols): Regard FL_LABEL as + local symbol. + +2011-12-19 Tobias Burnus + + PR fortran/51605 * match.c (gfc_match_select_type): Handle scalar polymophic coarrays. (select_type_set_tmp, ): Ditto; avoid segfault if !class_ok. Index: gcc/fortran/parse.c =================================================================== --- gcc/fortran/parse.c (Revision 182496) +++ gcc/fortran/parse.c (Arbeitskopie) @@ -3908,6 +3908,7 @@ || old_sym->attr.intrinsic || old_sym->attr.generic || old_sym->attr.flavor == FL_NAMELIST + || old_sym->attr.flavor == FL_LABEL || old_sym->attr.proc == PROC_ST_FUNCTION)) { /* Replace it with the symbol from the parent namespace. */ Index: gcc/testsuite/gfortran.dg/block_10.f90 =================================================================== --- gcc/testsuite/gfortran.dg/block_10.f90 (Revision 0) +++ gcc/testsuite/gfortran.dg/block_10.f90 (Arbeitskopie) @@ -0,0 +1,34 @@ +! { dg-do compile } +! +! PR fortran/51605 +! + +contains + subroutine foo + BLOCK_NAME: block + end block BLOCK_NAME + end subroutine foo + + subroutine BLOCK_NAME() + end subroutine BLOCK_NAME + + subroutine bar() + end subroutine bar +end + +subroutine test() +contains + subroutine BLOCK_NAME() + end subroutine BLOCK_NAME + + subroutine foobar() + end subroutine foobar + + subroutine foo + BLOCK_NAME: block + end block BLOCK_NAME + end subroutine foo + + subroutine bar() + end subroutine bar +end Index: gcc/testsuite/ChangeLog =================================================================== --- gcc/testsuite/ChangeLog (Revision 182496) +++ gcc/testsuite/ChangeLog (Arbeitskopie) @@ -1,3 +1,8 @@ +2011-12-19 Tobias Burnus + + PR fortran/51605 + * gfortran.dg/block_10.f90: New. + 2011-12-19 Jason Merrill PR c++/51553