From 065789b7b2e8bf94f1caf2a610c5acc1831c20bc 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 | 10 ++++++++++
2 files changed, 12 insertions(+), 1 deletion(-)
create mode 100644 gcc/testsuite/g++.dg/ipa/pr65465.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);
new file mode 100644
@@ -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