https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119599
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Summary|[15 Regression] ICE: in |[15 Regression] ICE: in |single_succ_edge, at |single_succ_edge, at |basic-block.h:332 with |basic-block.h:332 with |__noreturn__ function that |__noreturn__ function that |returns since r15-5336 |returns Priority|P1 |P3 Assignee|unassigned at gcc dot gnu.org |pinskia at gcc dot gnu.org --- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> --- So what is happening is einline inlines bar into foo and we get: <bb 6> : if (tmp_called.5_9 == 0) goto <bb 7>; [INV] else goto <bb 8>; [INV] <bb 7> : // predicted unlikely by cold label predictor. return_addr.7_11 = __builtin_return_address (0); __cyg_profile_func_exit (bar, return_addr.7_11); <bb 8> : <bb 9> : Where bb9 has no succ edge because bb9 was where originally the noreturn call was. I guess we could just treat an empty bb which has no succ edge as being unreachable which fixup_cfg does anyways. So this patch: ``` diff --git a/gcc/ipa-fnsummary.cc b/gcc/ipa-fnsummary.cc index 4c062fe8a0e..5edb19ac386 100644 --- a/gcc/ipa-fnsummary.cc +++ b/gcc/ipa-fnsummary.cc @@ -2707,6 +2707,12 @@ builtin_unreachable_bb_p (basic_block bb, vec<unsigned char> &cache) } if (!empty_bb) break; + /* Treat an empty block with no successors as unreachable. */ + else if (EDGE_COUNT (bb->succs) == 0) + { + ret = true; + goto done; + } else bb = single_succ_edge (bb)->dest; if (cache[bb->index]) ```