diff options
author | Feng Xue <fxue@os.amperecomputing.com> | 2021-09-23 08:47:45 +0800 |
---|---|---|
committer | Feng Xue <fxue@os.amperecomputing.com> | 2021-09-24 11:00:00 +0800 |
commit | f91b11eb8891f3ae910eb3b2e4a48e2d7d670d2d (patch) | |
tree | f4f1b57aaf73cf23fd17d23852fbedfe4e49f55b /gcc/tree-ssa-dse.c | |
parent | ea0f450e98db5f18d3363679db4cd82961f44642 (diff) | |
download | gcc-f91b11eb8891f3ae910eb3b2e4a48e2d7d670d2d.zip gcc-f91b11eb8891f3ae910eb3b2e4a48e2d7d670d2d.tar.gz gcc-f91b11eb8891f3ae910eb3b2e4a48e2d7d670d2d.tar.bz2 |
Fix null-pointer dereference in delete_dead_or_redundant_call [PR102451]
2021-09-23 Feng Xue <fxue@os.amperecomputing.com>
gcc/
PR tree-optimization/102451
* tree-ssa-dse.c (delete_dead_or_redundant_call): Record bb of stmt
before removal.
Diffstat (limited to 'gcc/tree-ssa-dse.c')
-rw-r--r-- | gcc/tree-ssa-dse.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/tree-ssa-dse.c b/gcc/tree-ssa-dse.c index 98daa8a..27287fe 100644 --- a/gcc/tree-ssa-dse.c +++ b/gcc/tree-ssa-dse.c @@ -978,6 +978,7 @@ delete_dead_or_redundant_call (gimple_stmt_iterator *gsi, const char *type) fprintf (dump_file, "\n"); } + basic_block bb = gimple_bb (stmt); tree lhs = gimple_call_lhs (stmt); if (lhs) { @@ -985,7 +986,7 @@ delete_dead_or_redundant_call (gimple_stmt_iterator *gsi, const char *type) gimple *new_stmt = gimple_build_assign (lhs, ptr); unlink_stmt_vdef (stmt); if (gsi_replace (gsi, new_stmt, true)) - bitmap_set_bit (need_eh_cleanup, gimple_bb (stmt)->index); + bitmap_set_bit (need_eh_cleanup, bb->index); } else { @@ -994,7 +995,7 @@ delete_dead_or_redundant_call (gimple_stmt_iterator *gsi, const char *type) /* Remove the dead store. */ if (gsi_remove (gsi, true)) - bitmap_set_bit (need_eh_cleanup, gimple_bb (stmt)->index); + bitmap_set_bit (need_eh_cleanup, bb->index); release_defs (stmt); } } |