https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116185
Bug ID: 116185 Summary: [15 Regression] Comparison failure on sh4 due to debug symbols Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: law at gcc dot gnu.org Target Milestone: --- Created attachment 58800 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58800&action=edit Testcase This patch causes a bootstrap comparison failure on sh4-linux-gnu: commit 9f9faebb8ebfc0103461641cc49ba0b21877b2b1 (HEAD) Author: Richard Sandiford <richard.sandif...@arm.com> Date: Tue Jul 16 15:31:17 2024 +0100 rtl-ssa: Enforce earlyclobbers on hard-coded clobbers [PR115891] The asm in the testcase has a memory operand and also clobbers ax. The clobber means that ax cannot be used to hold inputs, which extends to the address of the memory. [ ... ] The failure shows up as several instructions being interchanged in the final output depending -g of ira-emit.c. So I first narrowed that down to a "reasonable" testcase, eyeballing the assembly code changes, then narrowed it again using -fcompare-debug with a cross compiler. Then verified that the compare-debug failure goes away when the patch above is reverted. So while there is some chance the reduction process has morphed the bug, it seems unlikely as it still fails with the above patch and passes without the above patch. Compile with -O2 -fno-exceptions -fno-rtti -fcompare-debug -c with an sh4-linux-gnu cross compiler. You'll also need a cross-assembler for the compare-debug step, but you don't need a linker or any libraries.