https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84960
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Slightly better one without the weird __builtin_prefetch. /* PR tree-optimization/84960 */ /* { dg-do compile } */ /* { dg-options "-O2 -fwrapv" } */ void foo (int a, float b, void *c) { lab: if ((b - (a %= 0) < 1) * -1) ; else { long f = a; __builtin_unreachable (); c = &&lab; } goto *c; } Seems ssa_redirect_edges attempts to redirect ENTRY -> 2 edge to some other basic block and the bb 2, which contains a forced label is then removed as unreachable and removing unreachable blocks implies: if (label_stmt && (FORCED_LABEL (gimple_label_label (label_stmt)) || DECL_NONLOCAL (gimple_label_label (label_stmt)))) { basic_block new_bb; gimple_stmt_iterator new_gsi; /* A non-reachable non-local label may still be referenced. But it no longer needs to carry the extra semantics of non-locality. */ if (DECL_NONLOCAL (gimple_label_label (label_stmt))) { DECL_NONLOCAL (gimple_label_label (label_stmt)) = 0; FORCED_LABEL (gimple_label_label (label_stmt)) = 1; } new_bb = bb->prev_bb; new_gsi = gsi_start_bb (new_bb); gsi_remove (&i, false); gsi_insert_before (&new_gsi, stmt, GSI_NEW_STMT); } but here bb->prev_bb is ENTRY_BLOCK, into which we obviously can't insert anything.