From patchwork Thu Mar 19 17:26:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 452082 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 42F8114011D for ; Fri, 20 Mar 2015 04:26:52 +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=GmXqMt0m; 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 :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; q=dns; s=default; b=jHFiUa0YCIu9TuNUM 7mWGhe1kKUZ/6BXVbpktr+JMAQWiCla9+2uZ0qk+v1Nz+2ZD+uasWFdwXOGO4UvR LyP56lsgFjuoRfSULyF7IKhomqpRUsw6+IwUzvlBMn4PO7osj/PMhSJ4GD9nLELu fl9zAq8iT5id6N9Xi0yJ4RAdfA= 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 :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; s=default; bh=3Tq8q+mHoBnNjKei6X0ClUD a914=; b=GmXqMt0m7UxYLlTwGLsULSW7rYvIDfcxAklmf2klGlbVOyRzEvQpEL1 h6tAGx/7dXz8aoIxoVS1qnp4hC8UY6f2Rt+80BV+xmn8EHUR8ZBm7s9xJQETdUJt ng7Iv/14F5XQaIeKnxT5vHTXc/GJykAZNnk9nJCuwkQiARyc+SAs= Received: (qmail 121671 invoked by alias); 19 Mar 2015 17:26:45 -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 121662 invoked by uid 89); 19 Mar 2015 17:26:45 -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 autolearn=ham version=3.3.2 X-HELO: mx2.suse.de Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Thu, 19 Mar 2015 17:26:43 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 4FE1AABB1; Thu, 19 Mar 2015 17:26:39 +0000 (UTC) Message-ID: <550B06CF.30202@suse.cz> Date: Thu, 19 Mar 2015 18:26:39 +0100 From: =?UTF-8?B?TWFydGluIExpxaFrYQ==?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: gcc-patches@gcc.gnu.org CC: jakub Jelinek Subject: Re: [PATCH] Fix PR ipa/65465 References: <550B0273.8000001@suse.cz> <20150319171348.GZ1746@tucnak.redhat.com> In-Reply-To: <20150319171348.GZ1746@tucnak.redhat.com> X-IsSubscribed: yes On 03/19/2015 06:13 PM, Jakub Jelinek wrote: > On Thu, Mar 19, 2015 at 06:08:03PM +0100, Martin Liška wrote: >> >From 1b0416658cf59348664d44b14518c994075fd9bd Mon Sep 17 00:00:00 2001 >> From: mliska >> Date: Thu, 19 Mar 2015 15:36:34 +0100 >> Subject: [PATCH] Fix for PR ipa/65465. >> >> gcc/ChangeLog: >> >> 2015-03-19 Martin Liska >> >> PR ipa/65465 >> * cgraphunit.c (cgraph_node::create_wrapper): Correctly reset >> all fields of cgraph_thunk_info. >> >> gcc/testsuite/ChangeLog: >> >> 2015-03-19 Jakub Jelinek >> >> * g++.dg/ipa/pr65465.C: New test. >> --- >> gcc/cgraphunit.c | 3 ++- >> gcc/testsuite/g++.dg/ipa/pr65465.C | 16 ++++++++++++++++ >> 2 files changed, 18 insertions(+), 1 deletion(-) >> create mode 100644 gcc/testsuite/g++.dg/ipa/pr65465.C >> >> diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c >> index e640907..8b7d056 100644 >> --- a/gcc/cgraphunit.c >> +++ b/gcc/cgraphunit.c >> @@ -2484,8 +2484,9 @@ cgraph_node::create_wrapper (cgraph_node *target) >> >> /* Turn alias into thunk and expand it into GIMPLE representation. */ >> definition = true; >> + >> + memset (&thunk, 0, sizeof(cgraph_thunk_info)); > > Please put space after sizeof. > >> thunk.thunk_p = true; >> - thunk.this_adjusting = false; >> create_edge (target, NULL, count, CGRAPH_FREQ_BASE); >> >> tree arguments = DECL_ARGUMENTS (decl); > > Ok for trunk with that change. > >> diff --git a/gcc/testsuite/g++.dg/ipa/pr65465.C b/gcc/testsuite/g++.dg/ipa/pr65465.C >> new file mode 100644 >> index 0000000..004b76e >> --- /dev/null >> +++ b/gcc/testsuite/g++.dg/ipa/pr65465.C >> @@ -0,0 +1,16 @@ >> +/* { dg-do compile } */ >> +/* { dg-options "-O2" } */ >> + >> +struct A {}; >> +struct B { virtual A foo () const; }; >> +struct C { A foo () const; }; >> +struct D : virtual B { A foo () const {} }; >> +struct F : D { virtual int bar () const; }; >> +int F::bar () const { return 0; } >> +A C::foo () const { return A (); } >> + >> +int >> +main () >> +{ >> + return 0; >> +} > > Why do you need main for a dg-do compile testcase? > And even if you do for some reason, the return 0; in there > is implicit in C++. > > Jakub > Thanks for both notes, there's fixed version I'm going to install. Martin From 065789b7b2e8bf94f1caf2a610c5acc1831c20bc Mon Sep 17 00:00:00 2001 From: mliska Date: Thu, 19 Mar 2015 15:36:34 +0100 Subject: [PATCH] Fix for PR ipa/65465. gcc/ChangeLog: 2015-03-19 Martin Liska PR ipa/65465 * cgraphunit.c (cgraph_node::create_wrapper): Correctly reset all fields of cgraph_thunk_info. gcc/testsuite/ChangeLog: 2015-03-19 Jakub Jelinek * g++.dg/ipa/pr65465.C: New test. --- gcc/cgraphunit.c | 3 ++- gcc/testsuite/g++.dg/ipa/pr65465.C | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/ipa/pr65465.C diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index e640907..8ac92e1 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -2484,8 +2484,9 @@ cgraph_node::create_wrapper (cgraph_node *target) /* Turn alias into thunk and expand it into GIMPLE representation. */ definition = true; + + memset (&thunk, 0, sizeof (cgraph_thunk_info)); thunk.thunk_p = true; - thunk.this_adjusting = false; create_edge (target, NULL, count, CGRAPH_FREQ_BASE); tree arguments = DECL_ARGUMENTS (decl); diff --git a/gcc/testsuite/g++.dg/ipa/pr65465.C b/gcc/testsuite/g++.dg/ipa/pr65465.C new file mode 100644 index 0000000..436d88f --- /dev/null +++ b/gcc/testsuite/g++.dg/ipa/pr65465.C @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +struct A {}; +struct B { virtual A foo () const; }; +struct C { A foo () const; }; +struct D : virtual B { A foo () const {} }; +struct F : D { virtual int bar () const; }; +int F::bar () const { return 0; } +A C::foo () const { return A (); } -- 2.1.2