Hi.
This is a work-around to not iterate all members of array that can be huge.
As MPX will be removed in GCC 9.x, I hope it's acceptable. I don't want to come
up with a new param for it.
Survives tests&bootstrap on x86_64-linux-gnu.
Martin
gcc/ChangeLog:
2018-03-20 Martin Liska <[email protected]>
PR target/84988
* tree-chkp.c (CHKP_ARRAY_MAX_CHECK_STEPS): Define a new macro.
(chkp_find_bound_slots_1): Limit number of iterations.
---
gcc/tree-chkp.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/gcc/tree-chkp.c b/gcc/tree-chkp.c
index 40497ce94e7..d10e6c40423 100644
--- a/gcc/tree-chkp.c
+++ b/gcc/tree-chkp.c
@@ -1688,6 +1688,10 @@ chkp_find_bounds_for_elem (tree elem, tree *all_bounds,
}
}
+/* Maximum number of elements to check in an array. */
+
+#define CHKP_ARRAY_MAX_CHECK_STEPS 4096
+
/* Fill HAVE_BOUND output bitmap with information about
bounds requred for object of type TYPE.
@@ -1733,7 +1737,9 @@ chkp_find_bound_slots_1 (const_tree type, bitmap have_bound,
|| integer_minus_onep (maxval))
return;
- for (cur = 0; cur <= TREE_INT_CST_LOW (maxval); cur++)
+ for (cur = 0;
+ cur <= MIN (CHKP_ARRAY_MAX_CHECK_STEPS, TREE_INT_CST_LOW (maxval));
+ cur++)
chkp_find_bound_slots_1 (etype, have_bound, offs + cur * esize);
}
}