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

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 419117dca3f..ef0d15a289d 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -512,7 +512,7 @@ negate_expr_p (tree t)
       if (TREE_CODE (TREE_OPERAND (t, 1)) == INTEGER_CST)
        {
          tree op1 = TREE_OPERAND (t, 1);
-         if (wi::to_wide (op1) == TYPE_PRECISION (type) - 1)
+         if (wi::to_wide (op1) == element_precision (type) - 1)
            return true;
        }
       break;
@@ -705,7 +705,7 @@ fold_negate_expr_1 (location_t loc, tree t)
       if (TREE_CODE (TREE_OPERAND (t, 1)) == INTEGER_CST)
        {
          tree op1 = TREE_OPERAND (t, 1);
-         if (wi::to_wide (op1) == TYPE_PRECISION (type) - 1)
+         if (wi::to_wide (op1) == element_precision (type) - 1)
            {
              tree ntype = TYPE_UNSIGNED (type)
                           ? signed_type_for (type)

fixes that, retaining the negate, but it's still broken somewhere.

Reply via email to