https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83293
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Jakub Jelinek from comment #2) > Created attachment 42799 [details] > 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))) Looks good.