http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53550
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-06-01 12:29:11 UTC --- I'd think --- tree-ssa-loop-niter.c.jj 2012-05-30 14:38:55.000000000 +0200 +++ tree-ssa-loop-niter.c 2012-06-01 14:27:43.202456745 +0200 @@ -1276,13 +1276,14 @@ number_of_iterations_cond (struct loop * practice, but it is simple enough to manage. */ if (!integer_zerop (iv0->step) && !integer_zerop (iv1->step)) { + tree step_type = POINTER_TYPE_P (type) ? sizetype : type; if (code != NE_EXPR) return false; - iv0->step = fold_binary_to_constant (MINUS_EXPR, type, + iv0->step = fold_binary_to_constant (MINUS_EXPR, step_type, iv0->step, iv1->step); iv0->no_overflow = false; - iv1->step = build_int_cst (type, 0); + iv1->step = build_int_cst (step_type, 0); iv1->no_overflow = true; } would match what tree-chrec.c is doing.