https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102451
Bug ID: 102451 Summary: Suspicious null-pointer dereference in delete_dead_or_redundant_call Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: fxue at os dot amperecomputing.com Target Milestone: --- In the code snippet: if (lhs) { .... if (gsi_replace (gsi, new_stmt, true)) bitmap_set_bit (need_eh_cleanup, gimple_bb (stmt)->index); } else { .... if (gsi_remove (gsi, true)) bitmap_set_bit (need_eh_cleanup, gimple_bb (stmt)->index); } It is known that "gsi" points to "stmt", and gsi_replace/gsi_remove will clear basic block of "stmt". Then bitmap_set_bit will dereference "index" from null bb.