https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85588
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> --- A fix is probably as simple as Index: gcc/fold-const.c =================================================================== --- gcc/fold-const.c (revision 259879) +++ gcc/fold-const.c (working copy) @@ -472,7 +472,7 @@ negate_expr_p (tree t) case TRUNC_DIV_EXPR: case ROUND_DIV_EXPR: case EXACT_DIV_EXPR: - if (TYPE_UNSIGNED (type)) + if (TYPE_OVERFLOW_WRAPS (type)) break; if (negate_expr_p (TREE_OPERAND (t, 0))) return true;