https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113705

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
--- gcc/tree-ssa-math-opts.cc.jj        2024-02-01 09:14:16.623549514 +0100
+++ gcc/tree-ssa-math-opts.cc   2024-02-01 17:48:59.151771177 +0100
@@ -2572,7 +2572,8 @@ is_widening_mult_rhs_p (tree type, tree
              if (is_gimple_assign (stmt)
                  && gimple_assign_rhs_code (stmt) == BIT_AND_EXPR
                  && TREE_CODE (gimple_assign_rhs2 (stmt)) == INTEGER_CST
-                 && wi::to_wide (gimple_assign_rhs2 (stmt))
+                 && wide_int::from (wi::to_wide (gimple_assign_rhs2 (stmt)),
+                                    prec, TYPE_SIGN (TREE_TYPE (rhs)))
                     == wi::mask (hprec, false, prec))
                *new_rhs_out = gimple_assign_rhs1 (stmt);
              else
fixes the ICE.

Reply via email to