diff options
author | Martin Liska <mliska@suse.cz> | 2018-03-21 09:26:05 +0100 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2018-03-21 08:26:05 +0000 |
commit | 9a4dbf9100ab622212aa8eb78f380fd932dd4582 (patch) | |
tree | bc351f8884dfdde47c1054b71066d29ab71649bd /gcc/tree-chkp.c | |
parent | 1bdbef090299990b1fdef6323bb3daa48acf9349 (diff) | |
download | gcc-9a4dbf9100ab622212aa8eb78f380fd932dd4582.zip gcc-9a4dbf9100ab622212aa8eb78f380fd932dd4582.tar.gz gcc-9a4dbf9100ab622212aa8eb78f380fd932dd4582.tar.bz2 |
Fix compile-time hog in MPX boundary checking (PR target/84988).
2018-03-21 Martin Liska <mliska@suse.cz>
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
Diffstat (limited to 'gcc/tree-chkp.c')
-rw-r--r-- | gcc/tree-chkp.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/tree-chkp.c b/gcc/tree-chkp.c index 40497ce..d10e6c4 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); } } |