aboutsummaryrefslogtreecommitdiff
path: root/test/asan/TestCases/Posix/deep_call_stack.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test/asan/TestCases/Posix/deep_call_stack.cc')
-rw-r--r--test/asan/TestCases/Posix/deep_call_stack.cc25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/asan/TestCases/Posix/deep_call_stack.cc b/test/asan/TestCases/Posix/deep_call_stack.cc
new file mode 100644
index 000000000000..18ba563dbd21
--- /dev/null
+++ b/test/asan/TestCases/Posix/deep_call_stack.cc
@@ -0,0 +1,25 @@
+// Check that UAR mode can handle very deep recusrion.
+// RUN: %clangxx_asan -O2 %s -o %t && \
+// RUN: (ulimit -s 4096; %env_asan_opts=detect_stack_use_after_return=1 %run %t) 2>&1 | FileCheck %s
+
+// Also check that use_sigaltstack+verbosity doesn't crash.
+// RUN: %env_asan_opts=verbosity=1:use_sigaltstack=1:detect_stack_use_after_return=1 %run %t | FileCheck %s
+#include <stdio.h>
+
+__attribute__((noinline))
+void RecursiveFunc(int depth, int *ptr) {
+ if ((depth % 1000) == 0)
+ printf("[%05d] ptr: %p\n", depth, ptr);
+ if (depth == 0)
+ return;
+ int local;
+ RecursiveFunc(depth - 1, &local);
+}
+
+int main(int argc, char **argv) {
+ RecursiveFunc(15000, 0);
+ return 0;
+}
+// CHECK: [15000] ptr:
+// CHECK: [07000] ptr:
+// CHECK: [00000] ptr: