From patchwork Wed Jun 15 15:45:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Enkovich X-Patchwork-Id: 635938 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 3rV9sk620yz9sDk for ; Thu, 16 Jun 2016 01:48:42 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=PqoyoZPm; 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=xjpR3EytRgeKJ/99VYh14ZOfZOzsVPr84jisg/cgZFtx/DarZBx8g Y33MDBLJxH9k/2YZFF6oj49Wt1flg+zXyVfwclF4k7CrGvBWexa2wTXkMHqdhSUs h+hBR/YSmwIb3BCdvJgmrIQfLHq74UdLqRf5zJVVJo28iY8/ebI44w= 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=6+CfuXrAMjTJ/mCE+rROu4Bm3Dg=; b=PqoyoZPmW3UOXzdfIbMW QgeewFKVNOl5QZN/RwsSkh5Snxfe/oZC4KH6G5o+uxwztjIs+zfFWQDeWlBv+ts2 e4/as1FHmFB9K5ypE97XPUidWjgmUpiJLydjRQLdULNrfkreP0YQc1YWaavi4x92 51diVHA6ON8Bh+LtsiwD6o4= Received: (qmail 124012 invoked by alias); 15 Jun 2016 15:48:25 -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 123929 invoked by uid 89); 15 Jun 2016 15:48:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=ilya.enkovich@intel.com, ilyaenkovichintelcom X-HELO: mail-lb0-f196.google.com Received: from mail-lb0-f196.google.com (HELO mail-lb0-f196.google.com) (209.85.217.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 15 Jun 2016 15:48:13 +0000 Received: by mail-lb0-f196.google.com with SMTP id wy7so622721lbb.3 for ; Wed, 15 Jun 2016 08:48:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:user-agent; bh=sH0iHE416ZFk4wPaJq/koE1u/yyR9BgF0cRj8AhzPKw=; b=Ifstljkn7uzHdDWvMGszebAmIIgf18JgiIaU/wvPZrQ/F7ys0apRBnu0T2YFTVMirw YSkJRDioDeThEiLFANlZi4U5SVuf+aMTu+F8IzNcgCoEy2RuLZqMWowW91vKBugUeb5W JQifIm9mV0aH56sqJtXKESD/AQ4pEo/QJ72uU2VnzYORQ8R9XFVxaR1vrq0eTi8f/2lK P5ZYFcP9rFr8oBuCWJ88JHjvKU7IwH3psOpMLgUbMmlD2HLixBdQgIIYDMYHrzm4rgOZ YtewJ6q63iCpWuComh7PtPAvkRem6f4rkpWgUYsBlaQgKXzgUzqZd7XzI10w3edpDJGJ Vrtw== X-Gm-Message-State: ALyK8tKtoneaW2JJ4wp2a+qbkYbM507nU18QWiONRrcxxRayiHwWqhvYxeDRXgHsYinHIw== X-Received: by 10.28.147.7 with SMTP id v7mr51113wmd.37.1466005685631; Wed, 15 Jun 2016 08:48:05 -0700 (PDT) Received: from msticlxl57.ims.intel.com (irdmzpr01-ext.ir.intel.com. [192.198.151.36]) by smtp.gmail.com with ESMTPSA id kc2sm39063420wjb.5.2016.06.15.08.48.04 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Jun 2016 08:48:04 -0700 (PDT) Date: Wed, 15 Jun 2016 18:45:39 +0300 From: Ilya Enkovich To: gcc-patches@gcc.gnu.org Subject: [PATCH, CHKP, PR middle-end/71529] Fix DECL_CONTEXT for args of instrumentation clones with no body Message-ID: <20160615154539.GA62320@msticlxl57.ims.intel.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes Hi, Currently chkp_build_instrumented_fndecl copies arguments list in case function has no body. Copied arguments have incorrect DECL_CONTEXT and this patch fixes it. Bootstrapped and regtested for x86_64-unknown-linux-gnu. I'm going to commit it to trunk and later port to gcc-6-branch. Thanks, Ilya --- gcc/ 2016-06-15 Ilya Enkovich PR middle-end/71529 * ipa-chkp.c (chkp_build_instrumented_fndecl): Fix DECL_CONTEXT for copied arguments. gcc/testsuite/ 2016-06-15 Ilya Enkovich PR middle-end/71529 * gcc.target/i386/pr71529.C: New test. diff --git a/gcc/ipa-chkp.c b/gcc/ipa-chkp.c index 5f5df64..86c48f1 100644 --- a/gcc/ipa-chkp.c +++ b/gcc/ipa-chkp.c @@ -207,7 +207,13 @@ chkp_build_instrumented_fndecl (tree fndecl) /* For functions with body versioning will make a copy of arguments. For functions with no body we need to do it here. */ if (!gimple_has_body_p (fndecl)) - DECL_ARGUMENTS (new_decl) = copy_list (DECL_ARGUMENTS (fndecl)); + { + tree arg; + + DECL_ARGUMENTS (new_decl) = copy_list (DECL_ARGUMENTS (fndecl)); + for (arg = DECL_ARGUMENTS (new_decl); arg; arg = DECL_CHAIN (arg)) + DECL_CONTEXT (arg) = new_decl; + } /* We are going to modify attributes list and therefore should make own copy. */ diff --git a/gcc/testsuite/gcc.target/i386/pr71529.C b/gcc/testsuite/gcc.target/i386/pr71529.C new file mode 100644 index 0000000..3169101 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr71529.C @@ -0,0 +1,22 @@ +/* PR71529 */ +/* { dg-do compile { target { ! x32 } } } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx -O2" } */ + +class c1 +{ + public: + virtual ~c1 (); +}; + +class c2 +{ + public: + virtual ~c2 (); +}; + +class c3 : c1, c2 { }; + +int main (int, char **) +{ + c3 obj; +}