https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98331
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Created attachment 50073 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50073&action=edit gcc11-pr98331.patch Untested fix. If there are debug insns in between a flow control insn and barrier after it and that barrier is later followed by some normal insn other than label (i.e. dead insn), without -g we'd split after the barrier, which puts the barrier in between bbs. But with -g, the code would incorrectly split before the first debug insn following the control flow, which results in a barrier inside of a bb rather than in between and also different behavior from -g0. If there are debug insns after the barrier, we should obviously split before the first of those debug insns (i.e. after the barrier) like we'd do with -g0.