Hi.

I've tested that this indeed does get rid of the stack overflow when compiling
limits-exprparen.c with GCC configured using
--with-build-config=bootstrap-asan.  Not sure how else to test this patch.
I'd do a regtest but with ASAN instrumentation many tests fail just because
ASAN complains about something.  So regtests are a mess with bootstrap-asan.

Ok to push anyway?  Or should I perhaps wait for stage 1 with this?  Or should
I test this in some other way?

Cheers,
Filip Kastl


-- 8< --


64MB stack is not enough for running
gcc/testsuite/gcc.c-torture/compile/limits-exprparen.c with an
ASAN-instrumented GCC.  Ask for more stack if GCC was compiled with ASAN
instrumentation.

        PR sanitizer/124206

gcc/ChangeLog:

        * toplev.cc (toplev::main): Ask for 128MB stack instead of 64MB
        stack when __SANITIZE_ADDRESS__ is defined.

Signed-off-by: Filip Kastl <[email protected]>
---
 gcc/toplev.cc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gcc/toplev.cc b/gcc/toplev.cc
index 682459220a2..b41189cab0a 100644
--- a/gcc/toplev.cc
+++ b/gcc/toplev.cc
@@ -2301,7 +2301,11 @@ toplev::main (int argc, char **argv)
 {
   /* Parsing and gimplification sometimes need quite large stack.
      Increase stack size limits if possible.  */
+#ifdef __SANITIZE_ADDRESS__
   stack_limit_increase (64 * 1024 * 1024);
+#else
+  stack_limit_increase (128 * 1024 * 1024);
+#endif
 
   /* Stash a copy of the original argv before expansion
      for use by SARIF output.  */
-- 
2.51.0

Reply via email to