From patchwork Thu Mar 19 17:08:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 452064 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 7133E140077 for ; Fri, 20 Mar 2015 04:08:22 +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=jCDgMfvF; 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:content-type; q=dns; s=default; b=uyDaZBIfkqERjCbiSHaaKxqHy2I6jPVQ+EdcJKJbQb5 xlUmOnBj9pNpDRNjgXfZpTE+a4RG6kFLtRDrNtOKTed44a/+/gOluCXbgq0Vf8Xg dpptvMwrP3kgcrHdSQnXMuafe8COYWpLyjjhMekBL5Txw6ej1AGXhplLkGEEblFQ = 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:content-type; s=default; bh=1rJZqlWQYgEo+j2QMC8wR4EBqa8=; b=jCDgMfvFS5d316bdg 54uEe8fKLiLObfQQl5kOJK+jh9KA1SMC+QpGZAgP1q34QiDVQ2GIKITkFA+iTYiU yP/HPmMT2wfjoSH9O4L8+m9j2VpmuDlOjJZTdaWYiBgnjIVxSRcbDr1CBOs9x/Uc wevCPGpLVaZeIVOOUuedxylc58= Received: (qmail 62390 invoked by alias); 19 Mar 2015 17:08:14 -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 62380 invoked by uid 89); 19 Mar 2015 17:08:13 -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:08:07 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 15172ABB1; Thu, 19 Mar 2015 17:08:03 +0000 (UTC) Message-ID: <550B0273.8000001@suse.cz> Date: Thu, 19 Mar 2015 18:08:03 +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 CC: jakub Jelinek Subject: [PATCH] Fix PR ipa/65465 X-IsSubscribed: yes Hello. Following patch is fix for the PR. Problem is caused if we fill up cgraph_thunk_info with some values (e.g. virtual_value != 0) and further analysis set thunk_p = false. In all situations IPA ICF needs to reset all fields of the struct as it sets thunk_p = true. Tested on x86_64-linux-pc, no new regression. Fixed ICE for the arm cross compiler. Ready for trunk? Thanks, Martin 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)); 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..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; +} -- 2.1.2