From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 70858 invoked by alias); 30 Mar 2015 11:31:48 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 70846 invoked by uid 89); 30 Mar 2015 11:31:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=2.9 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KAM_FROM_URIBL_PCCC,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-wi0-f182.google.com Received: from mail-wi0-f182.google.com (HELO mail-wi0-f182.google.com) (209.85.212.182) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 30 Mar 2015 11:31:45 +0000 Received: by wiaa2 with SMTP id a2so124959401wia.0 for ; Mon, 30 Mar 2015 04:31:43 -0700 (PDT) X-Received: by 10.180.72.175 with SMTP id e15mr22109850wiv.28.1427715102932; Mon, 30 Mar 2015 04:31:42 -0700 (PDT) Received: from msticlxl57.ims.intel.com (fmdmzpr03-ext.fm.intel.com. [192.55.54.38]) by mx.google.com with ESMTPSA id pv2sm15319829wjc.33.2015.03.30.04.31.37 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 30 Mar 2015 04:31:42 -0700 (PDT) Date: Mon, 30 Mar 2015 11:31:00 -0000 From: Ilya Enkovich To: Jan Hubicka Cc: gcc-patches Subject: Re: Fix ice on comdat groups with -check-pointer-bounds Message-ID: <20150330113121.GA52842@msticlxl57.ims.intel.com> References: <20150327152309.GD63825@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2015-03/txt/msg01543.txt.bz2 On 30 Mar 14:05, Ilya Enkovich wrote: > 2015-03-27 18:23 GMT+03:00 Jan Hubicka : > > Index: symtab.c > > =================================================================== > > --- symtab.c (revision 221734) > > +++ symtab.c (working copy) > > @@ -1130,15 +1130,20 @@ symtab_node::verify_symtab_nodes (void) > > &existed); > > if (!existed) > > *entry = node; > > - else > > - for (s = (*entry)->same_comdat_group; s != NULL && s != node; s = s->same_comdat_group) > > + else if (!DECL_EXTERNAL (node->decl)) > > + { > > + for (s = (*entry)->same_comdat_group; s != NULL && s != node; > > + s = s->same_comdat_group) > > + ; > > With no if-statement in the loop body you need an additional exit > condition for a case when you reach the entry. > > Thanks, > Ilya > Here is a patch to add a testcase, fix the loop and avoid same_comdat_group for instrumented external symbols. Does it look OK? BTW should we check same_comdat_group is NULL for external symbols? Thanks, Ilya -- gcc/ 2015-03-30 Ilya Enkovich PR target/65531 * ipa-chkp.c (chkp_maybe_create_clone): Don't set same_comdat_group for external symbols. * symtab.c (symtab_node::verify_symtab_nodes): Avoid infinite same_comdat_group traversal loop. gcc/testsuite/ 2015-03-30 Ilya Enkovich PR target/65531 * gcc.target/i386/mpx/pr65531.cc: New. diff --git a/gcc/ipa-chkp.c b/gcc/ipa-chkp.c index a9933e2..3218d42 100644 --- a/gcc/ipa-chkp.c +++ b/gcc/ipa-chkp.c @@ -574,7 +574,8 @@ chkp_maybe_create_clone (tree fndecl) /* Clones have the same comdat group as originals. */ if (node->same_comdat_group - || DECL_ONE_ONLY (node->decl)) + || (DECL_ONE_ONLY (node->decl) + && !DECL_EXTERNAL (node->decl))) clone->add_to_same_comdat_group (node); if (gimple_has_body_p (fndecl)) diff --git a/gcc/symtab.c b/gcc/symtab.c index eb41d62..156fa3d 100644 --- a/gcc/symtab.c +++ b/gcc/symtab.c @@ -1132,7 +1132,8 @@ symtab_node::verify_symtab_nodes (void) *entry = node; else if (!DECL_EXTERNAL (node->decl)) { - for (s = (*entry)->same_comdat_group; s != NULL && s != node; + for (s = (*entry)->same_comdat_group; + s != NULL && s != node && s != *entry; s = s->same_comdat_group) ; if (!s || s == *entry) diff --git a/gcc/testsuite/gcc.target/i386/mpx/pr65531.cc b/gcc/testsuite/gcc.target/i386/mpx/pr65531.cc new file mode 100644 index 0000000..049569c --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/pr65531.cc @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fcheck-pointer-bounds -mmpx" } */ + +#pragma interface + +struct S +{ + ~S () + { + } +}; + +S s;