From: Martin Liska Date: Wed, 21 Mar 2018 08:26:05 +0000 (+0100) Subject: Fix compile-time hog in MPX boundary checking (PR target/84988). X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9a4dbf9100ab622212aa8eb78f380fd932dd4582;p=gcc.git Fix compile-time hog in MPX boundary checking (PR target/84988). 2018-03-21 Martin Liska PR target/84988 * tree-chkp.c (CHKP_ARRAY_MAX_CHECK_STEPS): Define a new macro. (chkp_find_bound_slots_1): Limit number of iterations. From-SVN: r258704 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 53224b1895e..62899c0e874 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-03-21 Martin Liska + + PR target/84988 + * tree-chkp.c (CHKP_ARRAY_MAX_CHECK_STEPS): Define a new macro. + (chkp_find_bound_slots_1): Limit number of iterations. + 2018-03-20 David H. Gutteridge PR target/84838 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); } }