From patchwork Tue May 31 06:35:35 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Backport the fix for PR47714 to the 4.5 branch Date: Mon, 30 May 2011 20:35:35 -0000 From: Duncan Sands X-Patchwork-Id: 97966 Message-Id: <4DE48C37.1000508@free.fr> To: gcc-patches 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 + + Backported from 4.6 branch + 2011-03-09 Martin Jambor + + PR tree-optimization/47714 + * method.c (use_thunk): Clear addressable flag of thunk arguments. + 2011-04-27 Jason Merrill 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 + + Backported from 4.6 branch + 2011-03-09 Martin Jambor + + PR tree-optimization/47714 + * g++.dg/torture/pr47714.C: New test. + 2011-05-05 Jason Merrill * 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; +}