summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/asan/lit_tests/TestCases/deep_call_stack.cc
diff options
context:
space:
mode:
Diffstat (limited to 'compiler-rt/lib/asan/lit_tests/TestCases/deep_call_stack.cc')
-rw-r--r--compiler-rt/lib/asan/lit_tests/TestCases/deep_call_stack.cc23
1 files changed, 23 insertions, 0 deletions
diff --git a/compiler-rt/lib/asan/lit_tests/TestCases/deep_call_stack.cc b/compiler-rt/lib/asan/lit_tests/TestCases/deep_call_stack.cc
new file mode 100644
index 00000000000..840ea38725d
--- /dev/null
+++ b/compiler-rt/lib/asan/lit_tests/TestCases/deep_call_stack.cc
@@ -0,0 +1,23 @@
+// Check that UAR mode can handle very deep recusrion.
+//
+// RUN: %clangxx_asan -fsanitize=use-after-return -O2 %s -o %t && \
+// RUN: %t 2>&1 | 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(40000, 0);
+ return 0;
+}
+// CHECK: [40000] ptr:
+// CHECK: [20000] ptr:
+// CHECK: [00000] ptr
OpenPOWER on IntegriCloud