aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-manip.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-ssa-loop-manip.c')
-rw-r--r--gcc/tree-ssa-loop-manip.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c
index 3354fde..35bf978 100644
--- a/gcc/tree-ssa-loop-manip.c
+++ b/gcc/tree-ssa-loop-manip.c
@@ -670,13 +670,17 @@ determine_exit_conditions (struct loop *loop, struct tree_niter_desc *desc,
tree base = desc->control.base;
tree step = desc->control.step;
tree bound = desc->bound;
- tree type = TREE_TYPE (base);
+ tree type = TREE_TYPE (step);
tree bigstep, delta;
tree min = lower_bound_in_type (type, type);
tree max = upper_bound_in_type (type, type);
enum tree_code cmp = desc->cmp;
tree cond = boolean_true_node, assum;
+ /* For pointers, do the arithmetics in the type of step (sizetype). */
+ base = fold_convert (type, base);
+ bound = fold_convert (type, bound);
+
*enter_cond = boolean_false_node;
*exit_base = NULL_TREE;
*exit_step = NULL_TREE;