From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 90543 invoked by alias); 7 Mar 2017 16:17:01 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 90531 invoked by uid 89); 7 Mar 2017 16:17:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 07 Mar 2017 16:16:59 +0000 Received: from smtp.corp.redhat.com (int-mx16.intmail.prod.int.phx2.redhat.com [10.5.11.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5A93E80463; Tue, 7 Mar 2017 16:17:00 +0000 (UTC) Received: from localhost.localdomain (unknown [10.10.120.51]) by smtp.corp.redhat.com (Postfix) with ESMTP id ABC75AE2C0; Tue, 7 Mar 2017 16:16:58 +0000 (UTC) Subject: Re: [PATCH 2/5] Get bounds for a PARM_DECL (PR ipa/79761). To: =?UTF-8?Q?Martin_Li=c5=a1ka?= , Richard Biener References: Cc: GCC Patches From: Jeff Law Message-ID: <36e0438f-46af-9988-3dbb-e4dabb9d72f2@redhat.com> Date: Tue, 07 Mar 2017 16:17:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2017-03/txt/msg00318.txt.bz2 On 03/07/2017 09:07 AM, Martin Liška wrote: > On 03/07/2017 03:57 PM, Richard Biener wrote: >> On Thu, Mar 2, 2017 at 6:06 PM, marxin wrote: >>> gcc/ChangeLog: >>> >>> 2017-03-06 Martin Liska >>> >>> PR ipa/79761 >>> * tree-chkp.c (chkp_get_bound_for_parm): Get bounds for a param. >>> (chkp_find_bounds_1): Remove gcc_unreachable. >>> >>> gcc/testsuite/ChangeLog: >>> >>> 2017-03-06 Martin Liska >>> >>> PR ipa/79761 >>> * g++.dg/pr79761.C: New test. >>> --- >>> gcc/testsuite/g++.dg/pr79761.C | 34 ++++++++++++++++++++++++++++++++++ >>> gcc/tree-chkp.c | 3 +-- >>> 2 files changed, 35 insertions(+), 2 deletions(-) >>> create mode 100644 gcc/testsuite/g++.dg/pr79761.C >>> >>> diff --git a/gcc/testsuite/g++.dg/pr79761.C b/gcc/testsuite/g++.dg/pr79761.C >>> new file mode 100644 >>> index 00000000000..b1f92d2b036 >>> --- /dev/null >>> +++ b/gcc/testsuite/g++.dg/pr79761.C >>> @@ -0,0 +1,34 @@ >>> +/* { dg-do compile { target { ! x32 } } } */ >>> +/* { dg-options "-fcheck-pointer-bounds -mmpx -mabi=ms" } */ >>> + >>> +struct Foo >>> +{ >>> + Foo() : a(1), b(1), c('a') {} >>> + int a; >>> + int b; >>> + char c; >>> +}; >>> + >>> +static Foo copy_foo(Foo) __attribute__((noinline, noclone)); >>> + >>> +static Foo copy_foo(Foo A) >>> +{ >>> + return A; >>> +} >>> + >>> +struct Bar : Foo >>> +{ >>> + Bar(Foo t) : Foo(copy_foo(t)) {} >>> +}; >>> + >>> +Foo F; >>> + >>> +int main (void) >>> +{ >>> + Bar B (F); >>> + >>> + if (B.a != 1 || B.b != 1 || B.c != 'a') >>> + __builtin_abort (); >>> + >>> + return 0; >>> +} >>> diff --git a/gcc/tree-chkp.c b/gcc/tree-chkp.c >>> index 3d497f51ed8..d5683b1b9cf 100644 >>> --- a/gcc/tree-chkp.c >>> +++ b/gcc/tree-chkp.c >>> @@ -2353,7 +2353,7 @@ chkp_get_next_bounds_parm (tree parm) >>> static tree >>> chkp_get_bound_for_parm (tree parm) >>> { >>> - tree decl = SSA_NAME_VAR (parm); >>> + tree decl = TREE_CODE (parm) == PARM_DECL ? parm : SSA_NAME_VAR (parm); >>> tree bounds; >>> >>> gcc_assert (TREE_CODE (decl) == PARM_DECL); >>> @@ -3602,7 +3602,6 @@ chkp_find_bounds_1 (tree ptr, tree ptr_src, gimple_stmt_iterator *iter) >>> break; >>> >>> case PARM_DECL: >>> - gcc_unreachable (); >>> bounds = chkp_get_bound_for_parm (ptr_src); >> But this is just useless work ... just do >> >> case PARM_DECL: >> /* Handled above but failed. */ >> break; > Ok, let's return invalid bounds. Please see updated patch. > > Martin > >> the SSA_NAME case is similarly redundantly calling chkp_get_registered_bounds. >> >> Richard. >> >>> break; >>> >>> -- >>> 2.11.1 >>> >>> > > 0002-Get-bounds-for-a-PARM_DECL-PR-ipa-79761-v3.patch > > > From feb00580b4f084ccd376a548d1121b1718a4806e Mon Sep 17 00:00:00 2001 > From: marxin > Date: Thu, 2 Mar 2017 18:06:39 +0100 > Subject: [PATCH 2/5] Get bounds for a PARM_DECL (PR ipa/79761). > > gcc/ChangeLog: > > 2017-03-06 Martin Liska > > PR ipa/79761 > * tree-chkp.c (chkp_get_bound_for_parm): Get bounds for a param. > (chkp_find_bounds_1): Remove gcc_unreachable. > > gcc/testsuite/ChangeLog: > > 2017-03-06 Martin Liska > > PR ipa/79761 > * g++.dg/pr79761.C: New test. OK. Sadly, I don't think any of these patches fix the P1 regressions we have for MPX. jeff