https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118456
--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Alexandre Oliva <aol...@gcc.gnu.org>: https://gcc.gnu.org/g:22fe3c05d86b52c35850918bfb21e1f597e1b5c7 commit r15-6893-g22fe3c05d86b52c35850918bfb21e1f597e1b5c7 Author: Alexandre Oliva <ol...@adacore.com> Date: Mon Jan 13 14:53:25 2025 -0300 [ifcombine] check and extend constants to compare with bitfields Add logic to check and extend constants compared with bitfields, so that fields are only compared with constants they could actually equal. This involves making sure the signedness doesn't change between loads and conversions before shifts: we'd need to carry a lot more data to deal with all the possibilities. for gcc/ChangeLog PR tree-optimization/118456 * gimple-fold.cc (decode_field_reference): Punt if shifting after changing signedness. (fold_truth_andor_for_ifcombine): Check extension bits in constants before clipping. for gcc/testsuite/ChangeLog PR tree-optimization/118456 * gcc.dg/field-merge-21.c: New. * gcc.dg/field-merge-22.c: New.