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]

[c++, PR 47714] Reset the addressable flag of thunk PARM_DECLs


Hi,

the patch below fixes PR 47714.  The problem is that as thunk function
declarations are built, their PARM_DECLs are copied from the thunked
function together with their TREE_ADDRESSABLE flags.  This then means
the parameters are not considered gimple registers when they are
supposed to be converted to SSA which makes the SSA verifier very
unhappy later.  The solution is to clear the addressable flag for the
PARM_DECLs which reflects the reality as their addresses are not taken
in thunks.

The fix seems to be rather obvious (and Jakub wrote that in bugzilla
too) and the bug is a P1 which can potentially postpone the release so
my plan is to take the liberty and commit it if no-one stops me in the
next few hours.  Needless to say, the patch has been successfully
bootstrapped and tested on x86_64-linux.

Thanks,

Martin


2011-03-08  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/47714
	* cp/method.c (use_thunk): Clear addressable flag of thunk arguments.

	* testsuite/g++.dg/torture/pr47714.C: New test.

Index: src/gcc/cp/method.c
===================================================================
--- src.orig/gcc/cp/method.c
+++ src/gcc/cp/method.c
@@ -372,6 +372,7 @@ use_thunk (tree thunk_fndecl, bool emit_
       DECL_CONTEXT (x) = thunk_fndecl;
       SET_DECL_RTL (x, NULL);
       DECL_HAS_VALUE_EXPR_P (x) = 0;
+      TREE_ADDRESSABLE (x) = 0;
       t = x;
     }
   a = nreverse (t);
Index: src/gcc/testsuite/g++.dg/torture/pr47714.C
===================================================================
--- /dev/null
+++ src/gcc/testsuite/g++.dg/torture/pr47714.C
@@ -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;
+}


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