From patchwork Fri Mar 27 15:23:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 455456 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 A2CBF1400D5 for ; Sat, 28 Mar 2015 02:23:28 +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=vvN6NGFn; 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:subject:message-id:mime-version:content-type; q=dns; s= default; b=kYR8k+XcCvr+rBfdQYkPUeysGQgP/5i8t1YTotlDll6rn+PGps9ET y1A1p1fk+fC3WVdccy/IC+COcODi+df5besg7j1HWbmogYY+s+sa97nnnT+ewyC4 ZmJXd3cR2/1edaVtT19cc9/vZGfuDNG37bRsiGWRox/gyraFo7J9rk= 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:subject:message-id:mime-version:content-type; s= default; bh=Bz9wGrLdO+4ClLC3T2faLL1/WFY=; b=vvN6NGFn+DPkFW7sRcjW U8yiO9Qg39jzamcAfFO5NIWa4Csj7GGdkjWzO/EBR3a6xo4v7/2BwU0wSQA2WfwL dLrbnaBxn94zvmQHohrfnGyfVxa6foTVryUHenWkEsO8+b953dbOoIDOlXq0jFMo vP5j/w6nG7VKC7LyJKKEnRk= Received: (qmail 126848 invoked by alias); 27 Mar 2015 15:23:21 -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 126838 invoked by uid 89); 27 Mar 2015 15:23:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: nikam.ms.mff.cuni.cz Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 27 Mar 2015 15:23:13 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 83680546B46; Fri, 27 Mar 2015 16:23:09 +0100 (CET) Date: Fri, 27 Mar 2015 16:23:09 +0100 From: Jan Hubicka To: gcc-patches@gcc.gnu.org, ilya.enkovich@intel.com Subject: Fix ice on comdat groups with -check-pointer-bounds Message-ID: <20150327152309.GD63825@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Hi, this patch fixes bug in symtab_node::verify_symtab_nodes pointed out by Ilya. The loop checking that there all comdats are linked by same_comdat_group was completely bogus. In addition it checked also external symbols that are currently not kept in groups. This bug was in mainline for months but apparently bounds checking is first code producing interesting comdat groups to trigger it. Ilya, can you please mind comitting the testcase? I am not quite sure where bounds checking should go offhand. Also concerning linking the comdat groups, currently all non-DECL_EXTERNAL symbols are linked and all !DECL_EXTERNAL symbols are non-linked. Bounds checking should follow this scheme. It may be cleaner to keep links for DECL_EXTERNAL, but lets deffer that for next stage1. Bootstrapped/regtested x86_64-linux. Committed. Honza Index: ChangeLog =================================================================== --- ChangeLog (revision 221735) +++ ChangeLog (working copy) @@ -1,5 +1,11 @@ 2015-03-27 Jan Hubicka + PR target/65531 + * symtab.c (symtab_node::verify_symtab_nodes): Fix verification of + comdat groups. + +2015-03-27 Jan Hubicka + PR ipa/65600 * cgraph.c (cgraph_update_edges_for_call_stmt_node): Fix the case of optimized out indirect call. 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) + ; if (!s || s == *entry) { - error ("Two symbols with same comdat_group are not linked by the same_comdat_group list."); + error ("Two symbols with same comdat_group are not linked by " + "the same_comdat_group list."); (*entry)->debug (); node->debug (); internal_error ("symtab_node::verify failed"); } + } } } }