PR sanitizer/80875
* fold-const.c (fold_binary_loc) <case MULT_EXPR>: Check if OP1
can be negated.
* c-c++-common/ubsan/pr80875.c: New test.
From-SVN: r248485
+2017-05-26 Marek Polacek <polacek@redhat.com>
+
+ PR sanitizer/80875
+ * fold-const.c (fold_binary_loc) <case MULT_EXPR>: Check if OP1
+ can be negated.
+
2017-05-26 Richard Biener <rguenther@suse.de>
PR tree-optimization/80842
if (TREE_CODE (op1) == INTEGER_CST
&& tree_int_cst_sgn (op1) == -1
&& negate_expr_p (op0)
+ && negate_expr_p (op1)
&& (tem = negate_expr (op1)) != op1
&& ! TREE_OVERFLOW (tem))
return fold_build2_loc (loc, MULT_EXPR, type,
+2017-05-26 Marek Polacek <polacek@redhat.com>
+
+ PR sanitizer/80875
+ * c-c++-common/ubsan/pr80875.c: New test.
+
2017-05-26 Tom de Vries <tom@codesourcery.com>
PR testsuite/80557
--- /dev/null
+/* PR sanitizer/80875 */
+/* { dg-do compile } */
+/* { dg-options "-fsanitize=undefined" } */
+
+int
+foo (void)
+{
+ return ~__INT_MAX__ * (0 / 0); /* { dg-warning "division by zero" } */
+}