From patchwork Mon Mar 10 02:15:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jimmie.davis@l-3com.com X-Patchwork-Id: 328451 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 2F7C12C00AD for ; Mon, 10 Mar 2014 13:16:51 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:references:in-reply-to:content-type :content-transfer-encoding:mime-version; q=dns; s=default; b=WoB b1VYiNjx/HJDpFatG0RYMqYkSQ8TgPtJdpzFx6kcmJ/HCeoRU3EFfDrlBDn9YrXP xKeyg/xsLUdaV4snyjbGOXfwwmRouGa5v9KKk41Y0X5kWE2hgGEV9CC+hVrUxGk/ f1w4axH0lsiETZaligFx9BZdqHGAbfRjmuKKN/xE= 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:from :to:subject:date:message-id:references:in-reply-to:content-type :content-transfer-encoding:mime-version; s=default; bh=NuLaJQZhA V1pqiUZPDt3z3+Ad78=; b=K1b/SAeAeIjZYL6jKfk09fVvz13gsKnqCTbbxjO63 4LGCBzL5JTsPEKm+SBLMpC2ITYovgKkX4xXRCWIf2s6Fuxzb3dChAWGejN7yP9QQ n4uGfbiav78scmuNkPSmIlTVBkFWZqWcGDWpjL+j38x7epehU64c9mCwzPnhYMkL NM= Received: (qmail 15868 invoked by alias); 10 Mar 2014 02:16:32 -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 15812 invoked by uid 89); 10 Mar 2014 02:16:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.6 required=5.0 tests=AWL, BAYES_00, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: smtp4out.l-3com.com Received: from smtp4out.l-3com.com (HELO smtp4out.l-3com.com) (128.170.207.112) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 10 Mar 2014 02:16:22 +0000 X-filenames: X-filesizes: None X-filetypes: Received: from generichost.l-3com.com (HELO mail1.link.l-3com.com) ([130.210.100.25]) by smtp4out.l-3com.com with ESMTP; 10 Mar 2014 02:16:20 +0000 Received: from autodiscover.link.com (HELO ARLEXCHCAS02.lst.link.l-3com.com) ([130.210.91.128]) by mail1a.link.l-3com.com with ESMTP; 09 Mar 2014 21:16:19 -0500 Received: from ARLEXCHCASMBX01.lst.link.l-3com.com (130.210.91.183) by ARLEXCHCAS02.lst.link.l-3com.com (130.210.91.128) with Microsoft SMTP Server (TLS) id 14.2.347.0; Sun, 9 Mar 2014 21:15:58 -0500 Received: from ARLEXCHMBX01.lst.link.l-3com.com ([::1]) by ARLEXCHCASMBX01.lst.link.l-3com.com ([::1]) with mapi id 14.02.0347.000; Sun, 9 Mar 2014 21:15:48 -0500 From: To: , , Subject: RE: patch fortran, pr 59746, internal compiler error : segmentation fault Date: Mon, 10 Mar 2014 02:15:31 +0000 Message-ID: References: , <531CA574.2050900@sfr.fr> , <531CD1A3.6070303@sfr.fr> In-Reply-To: <531CD1A3.6070303@sfr.fr> MIME-Version: 1.0 Index: gcc/gcc/testsuite/gfortran.dg/pr59746.f90 =================================================================== --- gcc/gcc/testsuite/gfortran.dg/pr59746.f90 (revision 0) +++ gcc/gcc/testsuite/gfortran.dg/pr59746.f90 (revision 0) @@ -0,0 +1,18 @@ +! { dg-do compile } +!pr59746 + CALL RCCFL (NVE,IR,NU3,VE (1,1,1,I)) + COMMON /CCFILE/ INTG,NT1,NT2,NT3,NVM,NVE,NFRLE,NRESF,NRESL !{ dg-error "Unexpected COMMON" } + COMMON /CCFILE/ INTG,NT1,NT2,NT3,NVM,NVE,NFRLE,NRESF,NRESL !{ dg-error "Unexpected COMMON" } +! the PR only contained the two above. +! success is no segfaults or infinite loops. +! let's check some combinations + CALL ABC (INTG) + COMMON /CCFILE/ INTG,NT1,NT2,NT3,NVM,NVE,NFRLE,NRESF,NRESL !{ dg-error "Unexpected COMMON" } + COMMON /CCFILE/ INTG,NT1,NT2,NT3,NVM,NVE,NFRLE,NRESF,NRESL !{ dg-error "Unexpected COMMON" } + CALL DEF (NT1) + COMMON /CCFILE/ INTG,NT1,NT2,NT3,NVM,NVE,NFRLE,NRESF,NRESL !{ dg-error "Unexpected COMMON" } + COMMON /CCFILE/ INTG,NT1,NT2,NT3,NVM,NVE,NFRLE,NRESF,NRESL !{ dg-error "Unexpected COMMON" } + CALL GHI (NRESL) + COMMON /CCFILE/ INTG,NT1,NT2,NT3,NVM,NVE,NFRLE,NRESF,NRESL !{ dg-error "Unexpected COMMON" } + COMMON /CCFILE/ INTG,NT1,NT2,NT3,NVM,NVE,NFRLE,NRESF,NRESL !{ dg-error "Unexpected COMMON" } + END Index: gcc/gcc/fortran/symbol.c =================================================================== --- gcc/gcc/fortran/symbol.c (revision 208437) +++ gcc/gcc/fortran/symbol.c (working copy) @@ -3069,56 +3069,56 @@ FOR_EACH_VEC_ELT (latest_undo_chgset->syms, i, p) { - if (p->gfc_new) + /* Symbol was new. Or was old and just put in common. */ + if ( p->attr.in_common && p->common_block && p->common_block->head + && (p->gfc_new || !p->old_symbol->attr.in_common)) { - /* Symbol was new. */ - if (p->attr.in_common && p->common_block && p->common_block->head) - { - /* If the symbol was added to any common block, it - needs to be removed to stop the resolver looking - for a (possibly) dead symbol. */ + /* If the symbol was added to any common block, it + needs to be removed to stop the resolver looking + for a (possibly) dead symbol. */ - if (p->common_block->head == p && !p->common_next) + if (p->common_block->head == p && !p->common_next) + { + gfc_symtree st, *st0; + st0 = find_common_symtree (p->ns->common_root, + p->common_block); + if (st0) { - gfc_symtree st, *st0; - st0 = find_common_symtree (p->ns->common_root, - p->common_block); - if (st0) - { - st.name = st0->name; - gfc_delete_bbt (&p->ns->common_root, &st, compare_symtree); - free (st0); - } + st.name = st0->name; + gfc_delete_bbt (&p->ns->common_root, &st, compare_symtree); + free (st0); } + } - if (p->common_block->head == p) - p->common_block->head = p->common_next; - else - { - gfc_symbol *cparent, *csym; + if (p->common_block->head == p) + p->common_block->head = p->common_next; + else + { + gfc_symbol *cparent, *csym; - cparent = p->common_block->head; - csym = cparent->common_next; + cparent = p->common_block->head; + csym = cparent->common_next; - while (csym != p) - { - cparent = csym; - csym = csym->common_next; - } - - gcc_assert(cparent->common_next == p); - - cparent->common_next = csym->common_next; + while (csym != p) + { + cparent = csym; + csym = csym->common_next; } - } + gcc_assert (cparent->common_next == p); + cparent->common_next = csym->common_next; + } + } + if (p->gfc_new) + { /* The derived type is saved in the symtree with the first letter capitalized; the all lower-case version to the derived type contains its associated generic function. */ + if (p->attr.flavor == FL_DERIVED) gfc_delete_symtree (&p->ns->sym_root, gfc_get_string ("%c%s", - (char) TOUPPER ((unsigned char) p->name[0]), - &p->name[1])); + (char) TOUPPER ((unsigned char) p->name[0]), + &p->name[1])); else gfc_delete_symtree (&p->ns->sym_root, p->name); @@ -3127,7 +3127,6 @@ else restore_old_symbol (p); } - latest_undo_chgset->syms.truncate (0); latest_undo_chgset->tbps.truncate (0);