]> git.ipfire.org Git - thirdparty/gcc.git/commit
[PR tree-optimization/123530] Fix ICE in recently added match.pd pattern
authorJeff Law <jeffrey.law@oss.qualcomm.com>
Tue, 13 Jan 2026 14:16:05 +0000 (07:16 -0700)
committerJeff Law <jeffrey.law@oss.qualcomm.com>
Tue, 13 Jan 2026 14:16:05 +0000 (07:16 -0700)
commit77ff7c2bb2240d64b8b03c87adc3d42957d59ae8
tree17c187711fd02a3144b62e8e319c0628e9130180
parente787d5ace5cc315892868f3e5e2a2a16fd31bcc8
[PR tree-optimization/123530] Fix ICE in recently added match.pd pattern

The gimple optimization passes can create negative shift counts and pass them
into the simplification routines as seen by the code in pr123530.  If we then
call tree_to_uhwi on those values we get a nice little ICE.

This guards the tree_to_uhwi calls on tree_fits_uhwi_p and resolves the ICE.  I
just protected them all in this recently added pattern.

Bootstrapped and regression tested on x86 and riscv.  Also tested on the rest
of the embedded targets without any regressions.

Pushing to the trunk.

PR tree-optimization/123530
gcc/
* match.pd (reassociating xor to enable rotations): Verify constants
fit into a uhwi before trying to extract them as a uhwi.

gcc/testsuite/
* gcc.dg/torture/pr123530.c: New test.
gcc/match.pd
gcc/testsuite/gcc.dg/torture/pr123530.c [new file with mode: 0644]