https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118890
--- Comment #8 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by kishan parmar <kis...@gcc.gnu.org>: https://gcc.gnu.org/g:9d63110c4334335a920424c301691dae9ecf398f commit r16-3351-g9d63110c4334335a920424c301691dae9ecf398f Author: Kishan Parmar <kis...@linux.ibm.com> Date: Sat Aug 23 00:28:09 2025 +0530 rs6000: Add shift count guards to avoid undefined behavior [PR118890] This patch adds missing guards on shift amounts to prevent UB when the shift count equals or exceeds HOST_BITS_PER_WIDE_INT. In the patch (r16-2666-g647bd0a02789f1), shift counts were only checked for nonzero but not for being within valid bounds. This patch tightens those conditions by enforcing that shift counts are greater than zero and less than HOST_BITS_PER_WIDE_INT. 2025-08-23 Kishan Parmar <kis...@linux.ibm.com> gcc/ PR target/118890 * config/rs6000/rs6000.cc (can_be_rotated_to_negative_lis): Add bounds checks for shift counts to prevent undefined behavior. (rs6000_emit_set_long_const): Likewise.