aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2009-07-21 16:51:13 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2009-07-21 16:51:13 +0200
commit4a2b7f24116a4daf7599a9f6f64b84a6ee2b1b36 (patch)
treee4692f4567cd1393ba20839007ab91696fdb8a66 /gcc
parent513c5a5bd9e856bd90c8d6cc6909e007b533ca8f (diff)
downloadgcc-4a2b7f24116a4daf7599a9f6f64b84a6ee2b1b36.zip
gcc-4a2b7f24116a4daf7599a9f6f64b84a6ee2b1b36.tar.gz
gcc-4a2b7f24116a4daf7599a9f6f64b84a6ee2b1b36.tar.bz2
re PR tree-optimization/40813 (ICE in gsi_insert_seq_nodes_after, at gimple-iterator.c:222)
PR tree-optimization/40813 * tree-inline.c (copy_bb): Regimplify RHS after last stmt, not before it. * g++.dg/opt/inline15.C: New test. From-SVN: r149857
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/opt/inline15.C42
-rw-r--r--gcc/tree-inline.c4
4 files changed, 55 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 68a81cc..2ae1c41 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2009-07-21 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/40813
+ * tree-inline.c (copy_bb): Regimplify RHS after last stmt, not before
+ it.
+
2009-07-21 Kaz Kojima <kkojima@gcc.gnu.org>
* config/sh/sh.c (sh_gimplify_va_arg_expr): Wrap the result
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index a50af86..c140cdf 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2009-07-21 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/40813
+ * g++.dg/opt/inline15.C: New test.
+
2009-07-21 Paul Brook <paul@codesourcery.com>
* gcc.dg/vect/section-anchors-nest-1.c: New test.
diff --git a/gcc/testsuite/g++.dg/opt/inline15.C b/gcc/testsuite/g++.dg/opt/inline15.C
new file mode 100644
index 0000000..5da3a61
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/inline15.C
@@ -0,0 +1,42 @@
+// PR tree-optimization/40813
+// { dg-do compile }
+// { dg-options "-O -fcheck-new" }
+
+typedef __SIZE_TYPE__ size_t;
+typedef void *P;
+struct A;
+struct B
+{
+ void *b[5];
+ A *foo () { return (A *) & b[0]; }
+};
+struct A
+{
+ void *operator new (size_t x, B &y) { return y.foo (); }
+};
+struct C : public A
+{
+ virtual int bar () { }
+};
+struct D : public C
+{
+ static B baz (unsigned *x) { B b; new (b) D (x); return b; }
+ D (unsigned *x) { }
+};
+struct E
+{
+ B e;
+ B fn (unsigned *a) { return D::baz (a); }
+ E (P b, unsigned *a) : e (fn (a)) { }
+};
+
+static unsigned *
+fn2 ()
+{
+}
+
+void
+test (P x)
+{
+ E (x, fn2 ());
+}
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 8b5e1ff..3b7b666 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1383,8 +1383,8 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale,
{
tree new_rhs;
new_rhs = force_gimple_operand_gsi (&seq_gsi,
- gimple_assign_rhs1 (stmt),
- true, NULL, true, GSI_SAME_STMT);
+ gimple_assign_rhs1 (stmt),
+ true, NULL, false, GSI_NEW_STMT);
gimple_assign_set_rhs1 (stmt, new_rhs);
id->regimplify = false;
}