Commit d31db22f by Sebastian Pop Committed by Sebastian Pop

re PR tree-optimization/26859 (ICE Segmentation Fault)

	PR tree-optimization/26859
	* tree-ssa-loop-niter.c (infer_loop_bounds_from_undefined): Avoid
	division by zero.
	(convert_step): Remove TREE_OVERFLOW and TREE_CONSTANT_OVERFLOW flags
	for the step after fold_convert.

From-SVN: r112502
parent 67f07489
2006-03-29 Sebastian Pop <pop@cri.ensmp.fr>
PR tree-optimization/26859
* tree-ssa-loop-niter.c (infer_loop_bounds_from_undefined): Avoid
division by zero.
(convert_step): Remove TREE_OVERFLOW and TREE_CONSTANT_OVERFLOW flags
for the step after fold_convert.
2006-03-29 Paul Brook <paul@codesourcery.com> 2006-03-29 Paul Brook <paul@codesourcery.com>
* reload1.c (choose_reload_regs): Check for all RTX_AUTOINC operators. * reload1.c (choose_reload_regs): Check for all RTX_AUTOINC operators.
......
...@@ -1582,9 +1582,13 @@ infer_loop_bounds_from_undefined (struct loop *loop) ...@@ -1582,9 +1582,13 @@ infer_loop_bounds_from_undefined (struct loop *loop)
diff = fold_build2 (MINUS_EXPR, utype, diff = fold_build2 (MINUS_EXPR, utype,
TYPE_MAX_VALUE (type), init); TYPE_MAX_VALUE (type), init);
estimation = fold_build2 (CEIL_DIV_EXPR, utype, diff, if (!integer_zerop (step))
step); {
record_estimate (loop, estimation, boolean_true_node, stmt); estimation = fold_build2 (CEIL_DIV_EXPR, utype, diff,
step);
record_estimate (loop, estimation, boolean_true_node,
stmt);
}
} }
break; break;
...@@ -2090,7 +2094,7 @@ tree ...@@ -2090,7 +2094,7 @@ tree
convert_step (struct loop *loop, tree new_type, tree base, tree step, convert_step (struct loop *loop, tree new_type, tree base, tree step,
tree at_stmt) tree at_stmt)
{ {
tree base_type; tree res, base_type;
if (chrec_contains_undetermined (base) if (chrec_contains_undetermined (base)
|| chrec_contains_undetermined (step)) || chrec_contains_undetermined (step))
...@@ -2100,12 +2104,22 @@ convert_step (struct loop *loop, tree new_type, tree base, tree step, ...@@ -2100,12 +2104,22 @@ convert_step (struct loop *loop, tree new_type, tree base, tree step,
/* When not using wrapping arithmetic, signed types don't wrap. */ /* When not using wrapping arithmetic, signed types don't wrap. */
if (!flag_wrapv && !TYPE_UNSIGNED (base_type)) if (!flag_wrapv && !TYPE_UNSIGNED (base_type))
return fold_convert (new_type, step); goto do_convert_step;
if (TYPE_PRECISION (new_type) > TYPE_PRECISION (base_type)) if (TYPE_PRECISION (new_type) > TYPE_PRECISION (base_type))
return convert_step_widening (loop, new_type, base, step, at_stmt); return convert_step_widening (loop, new_type, base, step, at_stmt);
return fold_convert (new_type, step); do_convert_step:
res = fold_convert (new_type, step);
if (TREE_CODE (res) == INTEGER_CST)
{
TREE_OVERFLOW (res) = 0;
TREE_CONSTANT_OVERFLOW (res) = 0;
}
return res;
} }
/* Frees the information on upper bounds on numbers of iterations of LOOP. */ /* Frees the information on upper bounds on numbers of iterations of LOOP. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment