https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114331
--- Comment #17 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Andrew Macleod <[email protected]>: https://gcc.gnu.org/g:3d102b7a40bd179c93eccc31b74f95c69f81f45e commit r16-4603-g3d102b7a40bd179c93eccc31b74f95c69f81f45e Author: Andrew MacLeod <[email protected]> Date: Tue Oct 21 16:05:22 2025 -0400 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.
