PR middle-end/69845
* fold-const.c (extract_muldiv_1): Correct test for multiplication
overflow.
PR middle-end/69845
* gcc.dg/tree-ssa/pr69845-1.c: New test.
* gcc.dg/tree-ssa/pr69845-2.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@234462
138bc75d-0d04-0410-961f-
82ee72b054a4
+2016-03-24 Richard Henderson <rth@redhat.com>
+
+ PR middle-end/69845
+ * fold-const.c (extract_muldiv_1): Correct test for multiplication
+ overflow.
+
2016-03-24 Uros Bizjak <ubizjak@gmail.com>
* config/i386/i386.md (*anddi3_doubleword): Generate AND insn
{
tree tem = const_binop (code, fold_convert (ctype, t),
fold_convert (ctype, c));
- /* If the multiplication overflowed to INT_MIN then we lost sign
- information on it and a subsequent multiplication might
- spuriously overflow. See PR68142. */
- if (TREE_OVERFLOW (tem)
- && wi::eq_p (tem, wi::min_value (TYPE_PRECISION (ctype), SIGNED)))
+ /* If the multiplication overflowed, we lost information on it.
+ See PR68142 and PR69845. */
+ if (TREE_OVERFLOW (tem))
return NULL_TREE;
return tem;
}
+2016-03-24 Richard Henderson <rth@redhat.com>
+
+ PR middle-end/69845
+ * gcc.dg/tree-ssa/pr69845-1.c: New test.
+ * gcc.dg/tree-ssa/pr69845-2.c: New test.
+
2016-03-24 Tom de Vries <tom@codesourcery.com>
* gfortran.dg/goacc/host_data-tree.f95: Add missing initialization.
--- /dev/null
+/* { dg-do compile } */
+/* { dg-require-effective-target int32 } */
+/* { dg-options "-O -fdump-tree-gimple -fdump-tree-optimized" } */
+
+int
+main ()
+{
+ struct S { char s; } v;
+ v.s = 47;
+ int a = (int) v.s;
+ int b = (27005061 + (a + 680455));
+ int c = ((1207142401 * (((8 * b) + 9483541) - 230968044)) + 469069442);
+ if (c != 1676211843)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "b \\\* 8" 1 "gimple" } } */
+/* { dg-final { scan-tree-dump-not "abort" "optimized" } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-require-effective-target int32 } */
+/* { dg-options "-O -fdump-tree-gimple -fdump-tree-optimized" } */
+
+int
+main ()
+{
+ struct S { char s; } v;
+ v.s = 47;
+ unsigned int a = (unsigned int) v.s;
+ unsigned int b = (27005061 + (a + 680455));
+ unsigned int c
+ = ((1207142401u * (((8u * b) + 9483541u) - 230968044u)) + 469069442u);
+ if (c != 1676211843u)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "b \\\* 1067204616" 1 "gimple" } } */
+/* { dg-final { scan-tree-dump-not "abort" "optimized" } } */