https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124206

--- Comment #8 from Filip Kastl <pheeck at gcc dot gnu.org> ---
(In reply to Andreas Schwab from comment #7)
> Perhaps the compiler should request a bigger stack when using the
> bootstrap-asan build config.

That sounds good to me.  So perhaps we could do

```
diff --git a/config/bootstrap-asan.mk b/config/bootstrap-asan.mk
index e73d4c2cfb8..19901325257 100644
--- a/config/bootstrap-asan.mk
+++ b/config/bootstrap-asan.mk
@@ -3,8 +3,8 @@
 # Suppress LeakSanitizer in bootstrap.
 export ASAN_OPTIONS=detect_leaks=0:use_odr_indicator=1

-STAGE2_CFLAGS += -fsanitize=address
-STAGE3_CFLAGS += -fsanitize=address
+STAGE2_CFLAGS += -fsanitize=address -D ASAN_INSTRUMENTED_GCC_P
+STAGE3_CFLAGS += -fsanitize=address -D ASAN_INSTRUMENTED_GCC_P
 POSTSTAGE1_LDFLAGS += -fsanitize=address -static-libasan \
                      -B$$r/prev-$(TARGET_SUBDIR)/libsanitizer/ \
                      -B$$r/prev-$(TARGET_SUBDIR)/libsanitizer/asan/ \
diff --git a/gcc/toplev.cc b/gcc/toplev.cc
index 682459220a2..d53b87379dc 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.  */
+#if ASAN_INSTRUMENTED_GCC_P
+  stack_limit_increase (128 * 1024 * 1024);
+#else
   stack_limit_increase (64 * 1024 * 1024);
+#endif

   /* Stash a copy of the original argv before expansion
      for use by SARIF output.  */
```

Reply via email to