public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [c++, PR 47714] Reset the addressable flag of thunk PARM_DECLs
@ 2011-03-09 11:57 Martin Jambor
  2011-03-09 12:04 ` Eric Botcazou
  0 siblings, 1 reply; 2+ messages in thread
From: Martin Jambor @ 2011-03-09 11:57 UTC (permalink / raw)
  To: GCC Patches; +Cc: Jason Merrill

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;
+}

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [c++, PR 47714] Reset the addressable flag of thunk PARM_DECLs
  2011-03-09 11:57 [c++, PR 47714] Reset the addressable flag of thunk PARM_DECLs Martin Jambor
@ 2011-03-09 12:04 ` Eric Botcazou
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Botcazou @ 2011-03-09 12:04 UTC (permalink / raw)
  To: Martin Jambor; +Cc: gcc-patches, Jason Merrill

> 2011-03-08  Martin Jambor  <mjambor@suse.cz>
>
> 	PR tree-optimization/47714
> 	* cp/method.c (use_thunk): Clear addressable flag of thunk arguments.

This should go in cp/ChangeLog without the cp/ prefix.

-- 
Eric Botcazou

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-03-09 12:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-09 11:57 [c++, PR 47714] Reset the addressable flag of thunk PARM_DECLs Martin Jambor
2011-03-09 12:04 ` Eric Botcazou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).