From patchwork Thu Jun 18 09:54:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Enkovich X-Patchwork-Id: 486241 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 3253114018C for ; Thu, 18 Jun 2015 19:55:06 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=iHH1Rbxb; 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=xdIpJyy1UfocNFsmS/qHwqa/T2NG5zMBHgYfpv2gahxTJsxsVcAUE aOaEIeFcTxwZvnZCvgLfCNt55AgXbyazxJT4rSPzUOK/dE6TmPY5kHizlxEEAax/ uJSAqrJWhGgOYKkEofeJeCxQC1IuUlA3Z2UiXMLylkIKfGrjsLsqck= 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=iOiAcJlK3xw1egfex2AA5p4dyqg=; b=iHH1RbxbisEbKFFOy4Mx ar7+8qLg9YPSRTmhLY7OgaLNcjPDu/BuqI9iRoiwPEk3OiFsyKJVT2oDtYo2HjqE nkAHCTh7AKpO1hMp0jKJex05C6ITHjq60Oc/dqQkL9jpml9nMOQtkU3gutwfk69Z xndHW13QKQholmdgKItdSbA= Received: (qmail 67293 invoked by alias); 18 Jun 2015 09:54:53 -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 67277 invoked by uid 89); 18 Jun 2015 09:54:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wi0-f177.google.com Received: from mail-wi0-f177.google.com (HELO mail-wi0-f177.google.com) (209.85.212.177) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 18 Jun 2015 09:54:51 +0000 Received: by wibdq8 with SMTP id dq8so81377723wib.1 for ; Thu, 18 Jun 2015 02:54:48 -0700 (PDT) X-Received: by 10.194.62.228 with SMTP id b4mr14063031wjs.2.1434621288568; Thu, 18 Jun 2015 02:54:48 -0700 (PDT) Received: from msticlxl57.ims.intel.com ([192.55.54.40]) by mx.google.com with ESMTPSA id m10sm12324535wib.17.2015.06.18.02.54.45 for (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 18 Jun 2015 02:54:47 -0700 (PDT) Date: Thu, 18 Jun 2015 12:54:33 +0300 From: Ilya Enkovich To: gcc-patches@gcc.gnu.org Subject: [PATCH, PR ipa/66566] Fix ICE in early_inliner: internal compiler error: in operator[] Message-ID: <20150618095415.GA28183@msticlxl57.ims.intel.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Hi, In early_inliner we do recompute inline summaries for edges after optimize_inline_calls, but check this summary exists in case new edges appear. But then it calls inline_update_overall_summary which also going through edges inline summaries but with no check this time causing segfault. This patch fixes it. Bootstrapped and regtested for x86_64-unknown-linux-gnu. Is it OK for trunk and gcc-5-branch? Thanks, Ilya --- gcc/ 2015-06-18 Ilya Enkovich PR ipa/66566 * ipa-inline-analysis.c (estimate_calls_size_and_time): Check edge summary is available. gcc/testsuite/ 2015-06-18 Ilya Enkovich PR ipa/66566 * gcc.target/i386/mpx/pr66566.c: New test. diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c index bbde855..e910ac5 100644 --- a/gcc/ipa-inline-analysis.c +++ b/gcc/ipa-inline-analysis.c @@ -3122,6 +3122,9 @@ estimate_calls_size_and_time (struct cgraph_node *node, int *size, struct cgraph_edge *e; for (e = node->callees; e; e = e->next_callee) { + if (inline_edge_summary_vec.length () <= (unsigned) e->uid) + continue; + struct inline_edge_summary *es = inline_edge_summary (e); /* Do not care about zero sized builtins. */ @@ -3153,6 +3156,9 @@ estimate_calls_size_and_time (struct cgraph_node *node, int *size, } for (e = node->indirect_calls; e; e = e->next_callee) { + if (inline_edge_summary_vec.length () <= (unsigned) e->uid) + continue; + struct inline_edge_summary *es = inline_edge_summary (e); if (!es->predicate || evaluate_predicate (es->predicate, possible_truths)) diff --git a/gcc/testsuite/gcc.target/i386/mpx/pr66566.c b/gcc/testsuite/gcc.target/i386/mpx/pr66566.c new file mode 100644 index 0000000..a405c20 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/pr66566.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fcheck-pointer-bounds -mmpx" } */ + +union jsval_layout +{ + void *asPtr; +}; +union jsval_layout a; +union jsval_layout b; +union jsval_layout __inline__ fn1() { return b; } + +void fn2() { a = fn1(); }