https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103220
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Simple fix: diff --git a/gcc/match.pd b/gcc/match.pd index 24a84e3b504..37c5be9e5f4 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -1607,7 +1607,8 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (bitop (convert@2 @0) (convert?@3 @1)) (if (((TREE_CODE (@1) == INTEGER_CST && INTEGRAL_TYPE_P (TREE_TYPE (@0)) - && int_fits_type_p (@1, TREE_TYPE (@0))) + && (int_fits_type_p (@1, TREE_TYPE (@0)) + || tree_nop_conversion_p (TREE_TYPE (@0), type))) || types_match (@0, @1)) /* ??? This transform conflicts with fold-const.c doing Convert (T)(x & c) into (T)x & (T)c, if c is an integer