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

--- Comment #11 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed 4.9 assert:

              gcc_assert ((valv & ~val.mask 
                           & ~nonzero_bits & mask).is_zero ());

fixed trunk assert:

@@ -1901,9 +1922,14 @@ evaluate_stmt (gimple stmt)
            }
          else
            {
-             if (wi::bit_and_not (val.value, nonzero_bits) != 0)
-               val.value = wide_int_to_tree (TREE_TYPE (lhs),
-                                             nonzero_bits & val.value);
+             widest_int tem = wi::bit_and_not (wi::to_widest (val.value),
+                                               extend_mask (nonzero_bits));
+             if (tem != 0)
+               {
+                 gcc_assert (tem.and_not (val.mask) == 0);
+                 val.value = wide_int_to_tree (TREE_TYPE (lhs),
+                                               nonzero_bits & val.value);
+               }
              if (nonzero_bits == 0)
                val.mask = 0;
              else


That is, when CCP computes a constant it verifies that nonzero bits info
is consistent with that.

Such assert might not be ready for prime-time as for example in unreachable
code-regions any inconsistency can happen, like in

  if ((i & 1) == 0) { if (i == 3) { .... } }

Reply via email to