https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83293
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org --- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Created attachment 42799 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42799&action=edit gcc8-pr83293.patch Untested fix. The gsi is unused afterwards, but we don't have a GSI_DONT_CARE and GSI_SAME_STMT is invalid if the bb was empty and we gsi_insert_after with GSI_SAME_STMT. Another possibility would be to change if (!gsi_end_p (gsi) && stmt_ends_bb_p (gsi_stmt (gsi))) to if (gsi_end_p (gsi) || stmt_ends_bb_p (gsi_stmt (gsi)))