aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2016-03-24 10:52:11 -0700
committerJeff Law <law@gcc.gnu.org>2016-03-24 11:52:11 -0600
commit8f085166f8aa480bd623ae49d17ec06915b74495 (patch)
tree330ca937fe5680cb7ffa15a318722e714a334e6d /gcc/fold-const.c
parent011e5ec31c3a6124bd039a0e3f9c3e43d576f383 (diff)
downloadgcc-8f085166f8aa480bd623ae49d17ec06915b74495.zip
gcc-8f085166f8aa480bd623ae49d17ec06915b74495.tar.gz
gcc-8f085166f8aa480bd623ae49d17ec06915b74495.tar.bz2
re PR middle-end/69845 (Expression getting incorrectly optimized after being rewritten by compiler)
2016-03-24 Richard Henderson <rth@redhat.com> 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. From-SVN: r234462
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 9d861c6..44fe2a2 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -6116,11 +6116,9 @@ extract_muldiv_1 (tree t, tree c, enum tree_code code, tree wide_type,
{
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;
}