[Bug tree-optimization/97396] [11 Regression] ICE: Segmentation fault (in bounds_of_var_in_loop)

aldyh at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Oct 13 07:15:38 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97396

Aldy Hernandez <aldyh at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amacleod at redhat dot com

--- Comment #2 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
In bounds_of_var_in_loop, evolution_part_in_loop_num is returning NULL:

   step = evolution_part_in_loop_num (chrec, loop->num);

and we ICE while trying to calculate the range for STEP.

This is for:

(gdb) dd stmt
qx.0_3 = PHI <qx.0_1(3)>
(gdb) dd var
qx.0_3

I'm not familiar with the SCEV code.  It looks like NULL is a perfectly valid
response from evolution_part_in_loop_num.  Should we just bail if NULL?

diff --git a/gcc/vr-values.c b/gcc/vr-values.c
index da0b249278b..16f6c629f29 100644
--- a/gcc/vr-values.c
+++ b/gcc/vr-values.c
@@ -1827,6 +1827,8 @@ bounds_of_var_in_loop (tree *min, tree *max, range_query
*query,

   init = initial_condition_in_loop_num (chrec, loop->num);
   step = evolution_part_in_loop_num (chrec, loop->num);
+  if (step == NULL_TREE)
+    return false;

   /* If INIT is an SSA with a singleton range, set INIT to said
      singleton, otherwise leave INIT alone.  */


More information about the Gcc-bugs mailing list