The following patch backports the one-line fix for PR47714 from the 4.6 branch
to the 4.5 branch. I hit this while working on the dragonegg plugin. OK to
apply?
Ciao, Duncan.
Index: gcc/cp/method.c
===================================================================
--- gcc/cp/method.c (revision 173485)
+++ gcc/cp/method.c (working copy)
@@ -374,6 +374,7 @@
DECL_CONTEXT (x) = thunk_fndecl;
SET_DECL_RTL (x, NULL_RTX);
DECL_HAS_VALUE_EXPR_P (x) = 0;
+ TREE_ADDRESSABLE (x) = 0;
t = x;
}
a = nreverse (t);
Index: gcc/cp/ChangeLog
===================================================================
--- gcc/cp/ChangeLog (revision 173485)
+++ gcc/cp/ChangeLog (working copy)
@@ -1,3 +1,11 @@
+2011-05-31 Duncan Sands <[email protected]>
+
+ Backported from 4.6 branch
+ 2011-03-09 Martin Jambor <[email protected]>
+
+ PR tree-optimization/47714
+ * method.c (use_thunk): Clear addressable flag of thunk arguments.
+
2011-04-27 Jason Merrill <[email protected]>
PR c++/48046
Index: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog (revision 173485)
+++ gcc/testsuite/ChangeLog (working copy)
@@ -1,3 +1,11 @@
+2011-05-31 Duncan Sands <[email protected]>
+
+ Backported from 4.6 branch
+ 2011-03-09 Martin Jambor <[email protected]>
+
+ PR tree-optimization/47714
+ * g++.dg/torture/pr47714.C: New test.
+
2011-05-05 Jason Merrill <[email protected]>
* g++.dg/init/new30.C: New.
Index: gcc/testsuite/g++.dg/torture/pr47714.C
===================================================================
--- gcc/testsuite/g++.dg/torture/pr47714.C (revision 0)
+++ gcc/testsuite/g++.dg/torture/pr47714.C (revision 0)
@@ -0,0 +1,16 @@
+struct A { virtual ~A () {} };
+struct B { virtual ~B () {} };
+struct C { virtual const A *foo (int) const = 0; };
+struct E : public B, public A { };
+struct F : public C
+{
+ virtual const E *foo (int) const;
+};
+void bar (int &);
+
+const E *
+F::foo (int x) const
+{
+ bar (x);
+ return __null;
+}