+2017-06-28 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/81227
+ * fold-const.c (negate_expr_p): Use TYPE_UNSIGNED, not
+ TYPE_OVERFLOW_WRAPS.
+ * match.pd (negate_expr_p): Likewise.
+ * tree-ssa-reassoc.c (optimize_range_tests_diff): Use
+ fold_build2, not fold_binary.
+
2017-06-28 Wilco Dijkstra <wdijkstr@arm.com>
* config/aarch64/aarch64 (aarch64_expand_mov_immediate):
switch (TREE_CODE (t))
{
case INTEGER_CST:
- if (INTEGRAL_TYPE_P (type) && TYPE_OVERFLOW_WRAPS (type))
+ if (INTEGRAL_TYPE_P (type) && TYPE_UNSIGNED (type))
return true;
/* Check that -CST will not overflow type. */
(match negate_expr_p
INTEGER_CST
(if ((INTEGRAL_TYPE_P (type)
- && TYPE_OVERFLOW_WRAPS (type))
+ && TYPE_UNSIGNED (type))
|| (!TYPE_OVERFLOW_SANITIZED (type)
&& may_negate_without_overflow_p (t)))))
(match negate_expr_p
+2017-06-28 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/81227
+ * gcc.dg/pr81227.c: New testcase.
+
2017-06-28 Michael Meissner <meissner@linux.vnet.ibm.com>
PR target/81193
--- /dev/null
+/* Copy of gcc.c-torture/compile/pr80443.c */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fwrapv" } */
+
+struct S { int a : 1; } b, c;
+signed char d, e, f;
+
+void
+foo ()
+{
+ while (f)
+ {
+ signed char g = b.a;
+ if (g)
+ b.a = ~(1 + (d || c.a));
+ if (b.a < g && b.a)
+ g = 0;
+ if (b.a > c.a)
+ b.a = g;
+ c.a = e;
+ }
+}
tem2 = fold_convert (type, tem2);
lowi = fold_convert (type, lowi);
mask = fold_build1 (BIT_NOT_EXPR, type, tem1);
- tem1 = fold_binary (MINUS_EXPR, type,
+ tem1 = fold_build2 (MINUS_EXPR, type,
fold_convert (type, rangei->exp), lowi);
tem1 = fold_build2 (BIT_AND_EXPR, type, tem1, mask);
lowj = build_int_cst (type, 0);