summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-niter.c
diff options
context:
space:
mode:
authoruros <uros@138bc75d-0d04-0410-961f-82ee72b054a4>2010-11-29 17:08:16 +0000
committeruros <uros@138bc75d-0d04-0410-961f-82ee72b054a4>2010-11-29 17:08:16 +0000
commitb6440e3988c72233c07315c5ae9a6ba7ffc12fe8 (patch)
tree2a6452fc40b80c08fdbdc1ef264f86f955950998 /gcc/tree-ssa-loop-niter.c
parent6453a826cdc81087525aef5e3be4ff190cc82b85 (diff)
downloadgcc-b6440e3988c72233c07315c5ae9a6ba7ffc12fe8.tar.gz
2010-11-29 Zdenek Dvorak <rakdver@kam.uniff.cz>
PR tree-optimization/46675 * tree-ssa-loop-niter.c (split_to_var_and_offset): Avoid overflow in offset calculation. testsuite/ChangeLog: 2010-11-29 Richard Guenther <rguenther@suse.de> Zdenek Dvorak <rakdver@kam.uniff.cz> PR tree-optimization/46675 * gcc.dg/pr46675.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@167256 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-loop-niter.c')
-rw-r--r--gcc/tree-ssa-loop-niter.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c
index 94d150d8246..466cdae80b7 100644
--- a/gcc/tree-ssa-loop-niter.c
+++ b/gcc/tree-ssa-loop-niter.c
@@ -95,10 +95,10 @@ split_to_var_and_offset (tree expr, tree *var, mpz_t offset)
*var = op0;
/* Always sign extend the offset. */
off = tree_to_double_int (op1);
- if (negate)
- off = double_int_neg (off);
off = double_int_sext (off, TYPE_PRECISION (type));
mpz_set_double_int (offset, off, false);
+ if (negate)
+ mpz_neg (offset, offset);
break;
case INTEGER_CST: