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: r149858
This commit is contained in:
Jakub Jelinek 2009-07-21 16:59:43 +02:00 committed by Jakub Jelinek
parent ddb5ae22bd
commit 8315f63c79
4 changed files with 55 additions and 2 deletions

View File

@ -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 Uros Bizjak <ubizjak@gmail.com>
Backport from mainline:

View File

@ -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 Uros Bizjak <ubizjak@gmail.com>
PR target/40809

View File

@ -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 ());
}

View File

@ -1355,8 +1355,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;
}