https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105203
--- Comment #12 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-11 branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:141b66c4becfa2f2c09b4a6cc0411d995ea5153a commit r11-9897-g141b66c4becfa2f2c09b4a6cc0411d995ea5153a Author: Jakub Jelinek <ja...@redhat.com> Date: Thu Apr 21 09:43:30 2022 +0200 emit-rtl: Fix -fcompare-debug bug with label references in debug insns [PR105203] When we compute LABEL_NUSES from scratch, mark_all_labels doesn't call mark_jump_label on DEBUG_INSNs: if (NONDEBUG_INSN_P (insn)) mark_jump_label (PATTERN (insn), insn, 0); and so doesn't increment LABEL_NUSES from references in DEBUG_INSNs. But, when we call emit_copy_of_insn_after e.g. when duplicating some DEBUG_INSNs, we call it even on those, which then results in LABEL_NUSES differences and -fcompare-debug failures. The following patch makes sure we don't call it on DEBUG_INSNs. 2022-04-21 Jakub Jelinek <ja...@redhat.com> PR debug/105203 * emit-rtl.c (emit_copy_of_insn_after): Don't call mark_jump_label on DEBUG_INSNs. * gfortran.dg/g77/pr105203.f: New test. (cherry picked from commit 504b02c70abcc31e0e9b56e69f82f85b5261bca9)