Patchwork Backport the fix for PR47714 to the 4.5 branch

login
register
mail settings
Submitter Duncan Sands
Date May 31, 2011, 6:35 a.m.
Message ID <4DE48C37.1000508@free.fr>
Download mbox | patch
Permalink /patch/97966/
State New
Headers show

Comments

Duncan Sands - May 31, 2011, 6:35 a.m.
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.
Jakub Jelinek - May 31, 2011, 6:39 a.m.
On Tue, May 31, 2011 at 08:35:35AM +0200, Duncan Sands wrote:
> 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?

Yes.

> 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  <baldrick@free.fr>
> +
> +	Backported from 4.6 branch
> +	2011-03-09  Martin Jambor  <mjambor@suse.cz>
> +
> +	PR tree-optimization/47714
> +	* method.c (use_thunk): Clear addressable flag of thunk arguments.
> +
>  2011-04-27  Jason Merrill  <jason@redhat.com>
> 
>  	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  <baldrick@free.fr>
> +
> +	Backported from 4.6 branch
> +	2011-03-09  Martin Jambor  <mjambor@suse.cz>
> +
> +	PR tree-optimization/47714
> +	* g++.dg/torture/pr47714.C: New test.
> +
>  2011-05-05  Jason Merrill  <jason@redhat.com>
> 
>  	* 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;
> +}

	Jakub
Duncan Sands - May 31, 2011, 7:05 a.m.
On 31/05/11 08:39, Jakub Jelinek wrote:
> On Tue, May 31, 2011 at 08:35:35AM +0200, Duncan Sands wrote:
>> 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?
>
> Yes.

Thanks.  Applied as revision 174467.

Ciao, Duncan.

Patch

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  <baldrick@free.fr>
+
+	Backported from 4.6 branch
+	2011-03-09  Martin Jambor  <mjambor@suse.cz>
+
+	PR tree-optimization/47714
+	* method.c (use_thunk): Clear addressable flag of thunk arguments.
+
  2011-04-27  Jason Merrill  <jason@redhat.com>

  	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  <baldrick@free.fr>
+
+	Backported from 4.6 branch
+	2011-03-09  Martin Jambor  <mjambor@suse.cz>
+
+	PR tree-optimization/47714
+	* g++.dg/torture/pr47714.C: New test.
+
  2011-05-05  Jason Merrill  <jason@redhat.com>

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