From patchwork Mon Mar 30 11:31:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Enkovich X-Patchwork-Id: 456073 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 A247D14007F for ; Mon, 30 Mar 2015 22:31:55 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass reason="1024-bit key; unprotected key" header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=L4OYrunQ; dkim-adsp=none (unprotected policy); dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; q=dns; s=default; b=BHa5h5AoaUiP6W1tE EpwCeOeefaEzRAYaIGtsCCR+VDhAf+ZpNAjmathnjKkD1eCZQ8ZGbEaI7h52lGUF N4/DQ83hPm1BaFL4rWuc93e5P/CikRhnevKSY339FyqiQRZx0qGpiVf30Cbc0NJg JxeTg3mPKkniW9vzebpYnnBpNQ= 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:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=default; bh=MvvhOnjp6zSm90w20vKgPI9 aF4o=; b=L4OYrunQXnnpp/F8Sqcrv98r0Mb4ci6qAs5X0WSiUyf209deAYNvLKj aYE9K8DmvB8aPSjnTsRUGUqHrFAFJPzoqyGoqkZ5Iia7KCB5nKRnTwoMd30N6WsH uX09OBJZyKw0soEzULCXVN/hxLjAbs7hl9s9rBuWMJ/HxGcNEDTM= 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-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 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 14:31:21 +0300 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-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes 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;