diff options
author | Jan Hubicka <jh@suse.cz> | 2010-06-12 14:43:02 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2010-06-12 12:43:02 +0000 |
commit | 02d635a2f81e72f3ce3302abd54a2daf7941ae24 (patch) | |
tree | 65fd83e0010f199a3093c2816ea1ffcd8347839c /gcc/tree-cfgcleanup.c | |
parent | 153a30276e1c07f7e7d6d926fa45c056cdca9e85 (diff) | |
download | gcc-02d635a2f81e72f3ce3302abd54a2daf7941ae24.tar.gz |
re PR tree-optimization/44485 (ICE in get_expr_operands, at tree-ssa-operands.c:1020)
PR tree-optimize/44485
* tree-cfgcleanup.c (fixup_noreturn_call): Remove basic blocks containing
use of return value of noreturn function.
* gcc.c-torture/compile/pc44485.c: New testcase.
From-SVN: r160659
Diffstat (limited to 'gcc/tree-cfgcleanup.c')
-rw-r--r-- | gcc/tree-cfgcleanup.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c index fc2141f48c1..62db2581239 100644 --- a/gcc/tree-cfgcleanup.c +++ b/gcc/tree-cfgcleanup.c @@ -559,18 +559,34 @@ fixup_noreturn_call (gimple stmt) { tree op = gimple_call_lhs (stmt); gimple_call_set_lhs (stmt, NULL_TREE); + /* We need to remove SSA name to avoid checking. All uses are dominated by the noreturn and thus will - be removed afterwards. */ + be removed afterwards. + We proactively remove affected non-PHI statements to avoid + fixup_cfg from trying to update them and crashing. */ if (TREE_CODE (op) == SSA_NAME) { use_operand_p use_p; imm_use_iterator iter; gimple use_stmt; + bitmap_iterator bi; + unsigned int bb_index; + + bitmap blocks = BITMAP_ALLOC (NULL); FOR_EACH_IMM_USE_STMT (use_stmt, iter, op) - FOR_EACH_IMM_USE_ON_STMT (use_p, iter) - SET_USE (use_p, error_mark_node); + { + if (gimple_code (use_stmt) != GIMPLE_PHI) + bitmap_set_bit (blocks, gimple_bb (use_stmt)->index); + else + FOR_EACH_IMM_USE_ON_STMT (use_p, iter) + SET_USE (use_p, error_mark_node); + } + EXECUTE_IF_SET_IN_BITMAP (blocks, 0, bb_index, bi) + delete_basic_block (BASIC_BLOCK (bb_index)); + BITMAP_FREE (blocks); + release_ssa_name (op); } update_stmt (stmt); changed = true; |