[Bug target/120550] [15 Regression] RISC-V: Miscompile at -O3 since r16-372-g064cac730f8

2025-07-02 Thread law at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120550

Jeffrey A. Law  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #9 from Jeffrey A. Law  ---
Patches cherry-picked to the gcc 15 release branch.  Closing.

[Bug target/120550] [15 Regression] RISC-V: Miscompile at -O3 since r16-372-g064cac730f8

2025-07-02 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120550

--- Comment #8 from GCC Commits  ---
The releases/gcc-15 branch has been updated by Jeff Law :

https://gcc.gnu.org/g:8b3e6dbe51362204d2c3544892720c7cea30b08c

commit r15-9903-g8b3e6dbe51362204d2c3544892720c7cea30b08c
Author: Jeff Law 
Date:   Sun Jun 22 12:06:08 2025 -0600

[committed][PR rtl-optimization/120550] Drop REG_EQUAL note after ext-dce
transformation

This bug was found by Edwin's fuzzing efforts on RISC-V, though it likely
affects other targets.

In simplest terms when ext-dce converts an extension into a (possibly
simplified) subreg copy it may make an attached REG_EQUAL note invalid.

In the case Edwin found the note was an extension, but I don't think that
would
necessarily always be the case.  The note could have other forms which
potentially need invalidation.  So the safest thing to do is just remove
any
attached REG_EQUAL or REG_EQUIV note.

Note adjusting Edwin's testcase in the obvious way to avoid having to
interpret
printf output for pass/fail status makes the bug go latent.  That's why no
testcase is included with this patch.

Bootstrapped and regression tested on x86_64.  Obviously also verified it
fixes
the testcase Edwin filed.

This is a good candidate for cherry-picking to the gcc-15 release branch
after
simmering on the trunk a bit.

PR rtl-optimization/120550
gcc/
* ext-dce.cc (ext_dce_try_optimize_insn): Drop REG_EQUAL/REG_EQUIV
notes on modified insns.

(cherry picked from commit 34e1e5e33ec3eb475c0c8278800b6fc246a86763)

[Bug target/120550] [15 Regression] RISC-V: Miscompile at -O3 since r16-372-g064cac730f8

2025-06-22 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120550

--- Comment #7 from GCC Commits  ---
The master branch has been updated by Jeff Law :

https://gcc.gnu.org/g:34e1e5e33ec3eb475c0c8278800b6fc246a86763

commit r16-1613-g34e1e5e33ec3eb475c0c8278800b6fc246a86763
Author: Jeff Law 
Date:   Sun Jun 22 12:06:08 2025 -0600

[committed][PR rtl-optimization/120550] Drop REG_EQUAL note after ext-dce
transformation

This bug was found by Edwin's fuzzing efforts on RISC-V, though it likely
affects other targets.

In simplest terms when ext-dce converts an extension into a (possibly
simplified) subreg copy it may make an attached REG_EQUAL note invalid.

In the case Edwin found the note was an extension, but I don't think that
would
necessarily always be the case.  The note could have other forms which
potentially need invalidation.  So the safest thing to do is just remove
any
attached REG_EQUAL or REG_EQUIV note.

Note adjusting Edwin's testcase in the obvious way to avoid having to
interpret
printf output for pass/fail status makes the bug go latent.  That's why no
testcase is included with this patch.

Bootstrapped and regression tested on x86_64.  Obviously also verified it
fixes
the testcase Edwin filed.

This is a good candidate for cherry-picking to the gcc-15 release branch
after
simmering on the trunk a bit.

PR rtl-optimization/120550
gcc/
* ext-dce.cc (ext_dce_try_optimize_insn): Drop REG_EQUAL/REG_EQUIV
notes on modified insns.