Home | History | Annotate | Download | only in TestCases
      1 // Check that UAR mode can handle very deep recusrion.
      2 // RUN: export ASAN_OPTIONS=detect_stack_use_after_return=1
      3 // RUN: %clangxx_asan -O2 %s -o %t && \
      4 // RUN:   (ulimit -s 4096; %run %t) 2>&1 | FileCheck %s
      5 
      6 // Also check that use_sigaltstack+verbosity doesn't crash.
      7 // RUN: env ASAN_OPTIONS=verbosity=1:use_sigaltstack=1 %run %t  | FileCheck %s
      8 #include <stdio.h>
      9 
     10 __attribute__((noinline))
     11 void RecursiveFunc(int depth, int *ptr) {
     12   if ((depth % 1000) == 0)
     13     printf("[%05d] ptr: %p\n", depth, ptr);
     14   if (depth == 0)
     15     return;
     16   int local;
     17   RecursiveFunc(depth - 1, &local);
     18 }
     19 
     20 int main(int argc, char **argv) {
     21   RecursiveFunc(15000, 0);
     22   return 0;
     23 }
     24 // CHECK: [15000] ptr:
     25 // CHECK: [07000] ptr:
     26 // CHECK: [00000] ptr:
     27