public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-8211] emit-rtl: Fix -fcompare-debug bug with label references in debug insns [PR105203] Date: Thu, 21 Apr 2022 07:44:35 +0000 (GMT) [thread overview] Message-ID: <20220421074435.0FD7C385781A@sourceware.org> (raw) https://gcc.gnu.org/g:504b02c70abcc31e0e9b56e69f82f85b5261bca9 commit r12-8211-g504b02c70abcc31e0e9b56e69f82f85b5261bca9 Author: Jakub Jelinek <jakub@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 <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. Diff: --- gcc/emit-rtl.cc | 3 ++- gcc/testsuite/gfortran.dg/g77/pr105203.f | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/gcc/emit-rtl.cc b/gcc/emit-rtl.cc index f4404d7abe3..1e02ae254d0 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); diff --git a/gcc/testsuite/gfortran.dg/g77/pr105203.f b/gcc/testsuite/gfortran.dg/g77/pr105203.f new file mode 100644 index 00000000000..3b47210fb40 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/g77/pr105203.f @@ -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
reply other threads:[~2022-04-21 7:44 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220421074435.0FD7C385781A@sourceware.org \ --to=jakub@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).