From bfb0b886347527f7747735d030a112b773b45098 Mon Sep 17 00:00:00 2001 From: Richard Guenther Date: Wed, 10 Sep 2008 15:07:04 +0000 Subject: [PATCH] re PR tree-optimization/37432 (ICE in VN_INFO, at tree-ssa-sccvn.c:180) 2008-09-10 Richard Guenther PR middle-end/37432 * tree-inline.c (insert_init_stmt): Make sure to not insert invalid gimple stores. * gcc.c-torture/compile/pr37432.c: New testcase. From-SVN: r140233 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.c-torture/compile/pr37432.c | 9 +++++++++ gcc/tree-inline.c | 16 ++++++++++++++++ 4 files changed, 36 insertions(+) create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr37432.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5ab022b246e..c1922b1ce5a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2008-09-10 Richard Guenther + + PR middle-end/37432 + * tree-inline.c (insert_init_stmt): Make sure to not + insert invalid gimple stores. + 2008-09-10 Sebastian Pop PR tree-optimization/37388 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f6a5b2b8173..cfa78e97aaf 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-09-10 Richard Guenther + + PR middle-end/37432 + * gcc.c-torture/compile/pr37432.c: New testcase. + 2008-09-10 H.J. Lu PR target/37434: diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37432.c b/gcc/testsuite/gcc.c-torture/compile/pr37432.c new file mode 100644 index 00000000000..747ec34c8f3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37432.c @@ -0,0 +1,9 @@ +static void print_wkb_byte(unsigned char val) { + print_wkb_bytes((unsigned char *)&val, 1, 1); +} +void InsertMultiPoint(int b) { + char a = 1; + if (b) a = 0; + print_wkb_byte(a); +} + diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index decdd6c0f31..c38c322cbc3 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -1907,6 +1907,22 @@ insert_init_stmt (basic_block bb, gimple init_stmt) { gimple_stmt_iterator si = gsi_last_bb (bb); + /* We can end up with init statements that store to a non-register + from a rhs with a conversion. Handle that here by forcing the + rhs into a temporary. gimple_regimplify_operands is not + prepared to do this for us. */ + if (!is_gimple_reg (gimple_assign_lhs (init_stmt)) + && is_gimple_reg_type (TREE_TYPE (gimple_assign_lhs (init_stmt))) + && gimple_assign_rhs_class (init_stmt) == GIMPLE_UNARY_RHS) + { + tree rhs = build1 (gimple_assign_rhs_code (init_stmt), + gimple_expr_type (init_stmt), + gimple_assign_rhs1 (init_stmt)); + rhs = force_gimple_operand_gsi (&si, rhs, true, NULL_TREE, false, + GSI_NEW_STMT); + gimple_assign_set_rhs_code (init_stmt, TREE_CODE (rhs)); + gimple_assign_set_rhs1 (init_stmt, rhs); + } gsi_insert_after (&si, init_stmt, GSI_NEW_STMT); gimple_regimplify_operands (init_stmt, &si); mark_symbols_for_renaming (init_stmt); -- 2.30.2