https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66215
--- Comment #13 from Jakub Jelinek <jakub at gcc dot gnu.org> --- The only function without active insns I'm aware of is: void foo (void) { __builtin_unreachable (); } which only contains notes and a BARRIER, nothing else (at least on s390x). It would be desirable to handle even that, otherwise a hotpatcher would overwrite random bytes from some other function. One option would be to avoid using next_active_insn: for (insn = get_insns (); insn; insn = NEXT_INSN (insn)) if (active_insn_p (insn) || BARRIER_P (insn)) break; Adding the nops after a BARRIER is generally undesirable I'd say.