From patchwork Tue Jan 27 12:48: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: 433466 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 8E8ED14019D for ; Tue, 27 Jan 2015 23:49:22 +1100 (AEDT) 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=S6H+ATERvELaZ63VOhhgwppIFJmco2JjsKUYQqvK/JDugPmDBOYws OiF99rTMcnAOrBvbXEsUPip8ypqxy7O1qBrmX3DXdVfBy/UC3G/ICTB6HC9oW/+q NNg5/DGMIeHD0z4NRgqKBlBXI+bM2adYufCEwP1IQVel+k6L/6Bp+s= 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=zvyA9R+WbV8i6Lmlor//7WC/L3Q=; b=ggP4IeRVYq4x7u2iLGMM jUE4k50WfeNiVCbeT/y87CauA0SK7Bd5xhNtJU9n4WzqsufijdDvMGLymH92dBZ8 RdyoVSYwAgwpauZt3VClPnHMNlIlUH6fZN0pIVgtWbLxvdNQlayOpQBQgsYvTRsc D40i3gzNO2kkySZuGlLCXLg= Received: (qmail 5364 invoked by alias); 27 Jan 2015 12:48:58 -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 5277 invoked by uid 89); 27 Jan 2015 12:48:49 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-qg0-f51.google.com Received: from mail-qg0-f51.google.com (HELO mail-qg0-f51.google.com) (209.85.192.51) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 27 Jan 2015 12:48:46 +0000 Received: by mail-qg0-f51.google.com with SMTP id z107so11391080qgd.10 for ; Tue, 27 Jan 2015 04:48:44 -0800 (PST) X-Received: by 10.140.87.71 with SMTP id q65mr1441017qgd.67.1422362924565; Tue, 27 Jan 2015 04:48:44 -0800 (PST) Received: from msticlxl57.ims.intel.com (fmdmzpr03-ext.fm.intel.com. [192.55.54.38]) by mx.google.com with ESMTPSA id c63sm991741qga.11.2015.01.27.04.48.42 for (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 27 Jan 2015 04:48:44 -0800 (PST) Date: Tue, 27 Jan 2015 15:48:33 +0300 From: Ilya Enkovich To: gcc-patches@gcc.gnu.org Subject: [PATCH, CHKP] Fix PR middle-end/64805 Message-ID: <20150127124833.GE47190@msticlxl57.ims.intel.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Hi, Some time ago removal of not instrumented version of funtion with 'always_inline' was delayed to enable their inlining. With this change we may have situations when we inline into a not instrumented version of a function which also has an instrumented version (happens when both of them have 'always_inline'). It causes ICE in cgraph_node verifier because we clear all references before inlining and verifier expects IPA_REF_CHKP reference for all functions having instrumented version. This patch fixes it by rebuilding IPA_REF_CHKP reference. Bootstrapped and tested on x86_64-unknown-linux-gnu. OK for trunk? Thanks, Ilya --- 2015-01-27 Ilya Enkovich PR middle-end/64805 * ipa-inline.c (early_inliner): Rebuild IPA_REF_CHKP reference to avoid error in cgraph node verification. 2015-01-27 Ilya Enkovich PR middle-end/64805 * gcc.target/i386/pr64805.c: New. diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c index c0ff329..d341619 100644 --- a/gcc/ipa-inline.c +++ b/gcc/ipa-inline.c @@ -2464,6 +2464,13 @@ early_inliner (function *fun) #endif node->remove_all_references (); + /* Rebuild this reference because it dosn't depend on + function's body and it's required to pass cgraph_node + verification. */ + if (node->instrumented_version + && !node->instrumentation_clone) + node->create_reference (node->instrumented_version, IPA_REF_CHKP, NULL); + /* Even when not optimizing or not inlining inline always-inline functions. */ inlined = inline_always_inline_functions (node); diff --git a/gcc/testsuite/gcc.target/i386/pr64805.c b/gcc/testsuite/gcc.target/i386/pr64805.c new file mode 100644 index 0000000..8ba0a97 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr64805.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target mpx } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + +#include + +static inline void __attribute ((always_inline)) functionA(void) +{ + return; +} + +static inline void __attribute ((always_inline)) functionB(void) +{ + functionA(); +} + +int test(void) +{ + functionB(); + + return 0; +}