]> git.ipfire.org Git - thirdparty/gcc.git/commit
Create and apply bitmasks for truncating casts.
authorAndrew MacLeod <amacleod@redhat.com>
Tue, 21 Oct 2025 20:05:22 +0000 (16:05 -0400)
committerAndrew MacLeod <amacleod@redhat.com>
Fri, 24 Oct 2025 16:04:20 +0000 (12:04 -0400)
commit3d102b7a40bd179c93eccc31b74f95c69f81f45e
tree291b4404d2f04d826b217204b65737a1a4e70abb
parenta09c04dbcfd9b41f574461e344394bee05b1f196
Create and apply bitmasks for truncating casts.

When folding a cast, we were not applying the bitmask if we reached
a VARYING result.
We were also not creating a bitmask to represent the lower bits of a
truncating cast in op1_range.  So GORI was losing bits.

PR tree-optimization/118254
PR tree-optimization/114331
gcc/
* range-op.cc (operator_cast::fold_range): When VARYING is
reached, update the bitmask if we reach VARYING.
(operator_cast::op1_range): For truncating casts, create a
bitmask bit in LHS.

gcc/testsuite/
* gcc.dg/pr114331.c: New.
* gcc.dg/pr118254.c: New.
gcc/range-op.cc
gcc/testsuite/gcc.dg/pr114331.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/pr118254.c [new file with mode: 0644]