aboutsummaryrefslogtreecommitdiff
path: root/gcc/emit-rtl.cc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2022-04-21 09:43:30 +0200
committerJakub Jelinek <jakub@redhat.com>2022-04-21 09:43:30 +0200
commit504b02c70abcc31e0e9b56e69f82f85b5261bca9 (patch)
tree2231105e2c415dc2393522bbe10f06c1045f0b22 /gcc/emit-rtl.cc
parent6a4e9934545c112eef5eb7248636baa96cbfd2c0 (diff)
downloadgcc-504b02c70abcc31e0e9b56e69f82f85b5261bca9.zip
gcc-504b02c70abcc31e0e9b56e69f82f85b5261bca9.tar.gz
gcc-504b02c70abcc31e0e9b56e69f82f85b5261bca9.tar.bz2
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 <jakub@redhat.com> PR debug/105203 * emit-rtl.cc (emit_copy_of_insn_after): Don't call mark_jump_label on DEBUG_INSNs. * gfortran.dg/g77/pr105203.f: New test.
Diffstat (limited to 'gcc/emit-rtl.cc')
-rw-r--r--gcc/emit-rtl.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/emit-rtl.cc b/gcc/emit-rtl.cc
index f4404d7..1e02ae2 100644
--- a/gcc/emit-rtl.cc
+++ b/gcc/emit-rtl.cc
@@ -6440,7 +6440,8 @@ emit_copy_of_insn_after (rtx_insn *insn, rtx_insn *after)
}
/* Update LABEL_NUSES. */
- mark_jump_label (PATTERN (new_rtx), new_rtx, 0);
+ if (NONDEBUG_INSN_P (insn))
+ mark_jump_label (PATTERN (new_rtx), new_rtx, 0);
INSN_LOCATION (new_rtx) = INSN_LOCATION (insn);