From c63ae7f0b8bb86b25255d26425887b75489ab162 Mon Sep 17 00:00:00 2001 From: Andrew Stubbs Date: Thu, 30 Jan 2020 14:06:12 +0000 Subject: [PATCH] Fix fast-math-pr55281.c ICE 2020-01-31 Andrew Stubbs gcc/ * tree-ssa-loop-ivopts.c (get_iv): Use sizetype for zero-step. (find_inv_vars_cb): Likewise. --- gcc/ChangeLog | 5 +++++ gcc/tree-ssa-loop-ivopts.c | 11 +++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8b7ad4a9f38..eb5105f0b19 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2020-01-31 Andrew Stubbs + + * tree-ssa-loop-ivopts.c (get_iv): Use sizetype for zero-step. + (find_inv_vars_cb): Likewise. + 2020-01-31 David Malcolm * calls.c (special_function_p): Split out the check for DECL_NAME diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index a21f3077e74..1ce6d8b372b 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -1246,7 +1246,11 @@ get_iv (struct ivopts_data *data, tree var) if (!bb || !flow_bb_inside_loop_p (data->current_loop, bb)) - set_iv (data, var, var, build_int_cst (type, 0), true); + { + if (POINTER_TYPE_P (type)) + type = sizetype; + set_iv (data, var, var, build_int_cst (type, 0), true); + } } return name_info (data, var)->iv; @@ -2990,7 +2994,10 @@ find_inv_vars_cb (tree *expr_p, int *ws ATTRIBUTE_UNUSED, void *data) if (!bb || !flow_bb_inside_loop_p (idata->current_loop, bb)) { - set_iv (idata, op, op, build_int_cst (TREE_TYPE (op), 0), true); + tree steptype = TREE_TYPE (op); + if (POINTER_TYPE_P (steptype)) + steptype = sizetype; + set_iv (idata, op, op, build_int_cst (steptype, 0), true); record_invariant (idata, op, false); } } -- 2.30.2