public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix compile-time hog in MPX boundary checking (PR target/84988).
@ 2018-03-20 19:37 Martin Liška
  2018-03-20 19:40 ` Jeff Law
  0 siblings, 1 reply; 9+ messages in thread
From: Martin Liška @ 2018-03-20 19:37 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 529 bytes --]

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  <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.
---
  gcc/tree-chkp.c | 8 +++++++-
  1 file changed, 7 insertions(+), 1 deletion(-)



[-- Attachment #2: 0001-Fix-compile-time-hog-in-MPX-boundary-checking-PR-tar.patch --]
[-- Type: text/x-patch, Size: 803 bytes --]

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);
     }
 }


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-03-28 11:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-20 19:37 [PATCH] Fix compile-time hog in MPX boundary checking (PR target/84988) Martin Liška
2018-03-20 19:40 ` Jeff Law
2018-03-20 21:53   ` Richard Sandiford
2018-03-21  9:40     ` Richard Biener
2018-03-21  9:47       ` Martin Liška
2018-03-21 12:45         ` Martin Liška
2018-03-21 13:26           ` Jakub Jelinek
2018-03-28  6:51             ` Martin Liška
2018-03-28 11:53               ` Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).