[gcc/devel/ranger] Fix fast-math-pr55281.c ICE

Aldy Hernandez aldyh@gcc.gnu.org
Wed Jun 17 18:30:35 GMT 2020


https://gcc.gnu.org/g:c63ae7f0b8bb86b25255d26425887b75489ab162

commit c63ae7f0b8bb86b25255d26425887b75489ab162
Author: Andrew Stubbs <ams@codesourcery.com>
Date:   Thu Jan 30 14:06:12 2020 +0000

    Fix fast-math-pr55281.c ICE
    
    2020-01-31  Andrew Stubbs  <ams@codesourcery.com>
    
            gcc/
            * tree-ssa-loop-ivopts.c (get_iv): Use sizetype for zero-step.
            (find_inv_vars_cb): Likewise.

Diff:
---
 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  <ams@codesourcery.com>
+
+	* tree-ssa-loop-ivopts.c (get_iv): Use sizetype for zero-step.
+	(find_inv_vars_cb): Likewise.
+
 2020-01-31  David Malcolm  <dmalcolm@redhat.com>
 
 	* 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);
 	}
     }


More information about the Gcc-cvs mailing list