http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38756
--- Comment #3 from Peter A. Bigot <bigotp at acm dot org> 2012-06-21 12:04:34 UTC --- commit af66de00843896ad5d2980952994b31cadbf8421 Author: Peter A. Bigot <pabi...@users.sourceforge.net> Date: Thu Jun 21 06:35:44 2012 -0500 Anticipatory patch for PR middle-end/38756 Do not truncate to size_type when adding the step factor to a pointer. diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index 0693c21..f8372fd 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -6199,6 +6199,11 @@ rewrite_use_nonlinear_expr (struct ivopts_data *data, step = cand->iv->step; ctype = TREE_TYPE (step); utype = TREE_TYPE (cand->var_after); + if (TYPE_PRECISION (ctype) < TYPE_PRECISION (utype)) + { + ctype = generic_type_for (utype); + step = fold_convert (ctype, unshare_expr (step)); + } if (TREE_CODE (step) == NEGATE_EXPR) { incr_code = MINUS_EXPR;