http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56950
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> --- That still doesn't look safe -fcompare-debug wise. I mean, if BB ends in a DEBUG_INSN (or more), it could be preceeded by note, label, or some other insns. So shouldn't that be instead rtx insn2 = DEBUG_INSN_P (insn) ? prev_nondebug_insn (insn2) : insn; (I'd hope there shouldn't be DEBUG_INSN only bb's, because then with -g0 insn ought to be NULL and NEXT_INSN (insn) should crash), and use this in the !NOTE_P and !LABEL_P tests? When NEXT_INSN (insn) is used, it should keep using the BB_END insn, even if it is a DEBUG_INSN, we are looking at what comes afterwards.