This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PR ipa/65465


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 <mliska@suse.cz>
Date: Thu, 19 Mar 2015 15:36:34 +0100
Subject: [PATCH] Fix for PR ipa/65465.

gcc/ChangeLog:

2015-03-19  Martin Liska  <mliska@suse.cz>

	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  <jakub@redhat.com>

	* 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]