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.
This commit is contained in:
parent
6a4e993454
commit
504b02c70a
2 changed files with 22 additions and 1 deletions
|
@ -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);
|
||||
|
||||
|
|
20
gcc/testsuite/gfortran.dg/g77/pr105203.f
Normal file
20
gcc/testsuite/gfortran.dg/g77/pr105203.f
Normal file
|
@ -0,0 +1,20 @@
|
|||
C Test case for PR debug/105203
|
||||
C Origin: kmccarty@princeton.edu
|
||||
C
|
||||
C { dg-do compile }
|
||||
C { dg-options "-O2 -fcompare-debug -ftracer -w" }
|
||||
C { dg-additional-options "-fPIC" { target fpic } }
|
||||
SUBROUTINE FOO (B)
|
||||
|
||||
10 CALL BAR (A)
|
||||
ASSIGN 20 TO M
|
||||
IF (100.LT.A) GOTO 10
|
||||
GOTO 40
|
||||
C
|
||||
20 IF (B.LT.ABS(A)) GOTO 10
|
||||
ASSIGN 30 TO M
|
||||
GOTO 40
|
||||
C
|
||||
30 ASSIGN 10 TO M
|
||||
40 GOTO M,(10,20,30)
|
||||
END
|
Loading…
Add table
Reference in a new issue