+2013-03-20 Marc Glisse <marc.glisse@inria.fr>
+
+ PR tree-optimization/56355
+ * fold-const.c (tree_binary_nonnegative_warnv_p) <MULT_EXPR>:
+ Also handle integers with undefined overflow.
+
2013-03-20 Catherine Moore <clm@codesourcery.com>
Maciej W. Rozycki <macro@codesourcery.com>
Tom de Vries <tom@codesourcery.com>
break;
case MULT_EXPR:
- if (FLOAT_TYPE_P (type))
+ if (FLOAT_TYPE_P (type) || TYPE_OVERFLOW_UNDEFINED (type))
{
- /* x * x for floating point x is always non-negative. */
- if (operand_equal_p (op0, op1, 0))
- return true;
- return (tree_expr_nonnegative_warnv_p (op0,
- strict_overflow_p)
- && tree_expr_nonnegative_warnv_p (op1,
- strict_overflow_p));
+ /* x * x is always non-negative for floating point x
+ or without overflow. */
+ if (operand_equal_p (op0, op1, 0)
+ || (tree_expr_nonnegative_warnv_p (op0, strict_overflow_p)
+ && tree_expr_nonnegative_warnv_p (op1, strict_overflow_p)))
+ {
+ if (TYPE_OVERFLOW_UNDEFINED (type))
+ *strict_overflow_p = true;
+ return true;
+ }
}
/* zero_extend(x) * zero_extend(y) is non-negative if x and y are
+2013-03-20 Marc Glisse <marc.glisse@inria.fr>
+
+ PR tree-optimization/56355
+ * gcc.dg/pr56355-1.c: New file.
+
2013-03-20 Catherine Moore <clm@codesourcery.com>
Richard Sandiford <rdsandiford@googlemail.com>