On 10/14/26 12:09 AM, Yongqiang Tian wrote:
skip_consecutive_labels walks across labels and notes until it reaches an
INSN_P. A DEBUG_INSN satisfies INSN_P, so a debug marker between two
labels can hide the later label. This makes branch redirection depend on
whether debug information is present and causes an -fcompare-debug
failure.
This issue was already tracked as PR127796. Jeff Law also suggested
auditing this site while reviewing the PR127808 patch. This patch uses
NONDEBUG_INSN_P as the stopping condition and adds a focused SPARC
regression test derived from gcc.c-torture/compile/pr110705-1.c.
Tested at GCC revision ca33fb40100211b9ed8c2e686b46cb9025791930:
* The new test fails without the patch with an -fcompare-debug length
mismatch and passes with the patch.
* A complete sparc-elf sparc.exp comparison has no regressions; the only
difference is the new test changing from absent to PASS.
* Native x86_64-pc-linux-gnu bootstrap and full regression testing
completed for the baseline and the exact patch. Both produced 530002
PASS, 9 FAIL, 1 XPASS, 4292 XFAIL, and 7556 UNSUPPORTED results, with
identical unexpected-result sets.
* contrib/check_GNU_style.sh and git diff --check pass.
Assisted-by: OpenAI Codex 5.6 Sol, co-reviewed by Claude and Yongqiang Tian.
PR rtl-optimization/127796
gcc/ChangeLog:
* reorg.cc (skip_consecutive_labels): Ignore debug instructions
when scanning consecutive labels.
gcc/testsuite/ChangeLog:
* gcc.target/sparc/reorg-skip-labels-debug.c: New test.
Signed-off-by: Yongqiang Tian <[email protected]>
I've pushed this to the trunk. Thanks again for the fixes!
jeff