2025-03-28 12:51:13 -07:00
|
|
|
// Check that UAR mode can handle very deep recursion.
|
2024-08-26 12:02:16 -07:00
|
|
|
// REQUIRES: shell
|
2017-04-05 20:26:33 +00:00
|
|
|
// RUN: %clangxx_asan -O2 %s -o %t
|
|
|
|
// RUN: ulimit -s 4096
|
|
|
|
// RUN: %env_asan_opts=detect_stack_use_after_return=1 %run %t 2>&1 | FileCheck %s
|
2015-02-10 01:55:02 +00:00
|
|
|
|
2013-10-17 13:18:21 +00:00
|
|
|
// Also check that use_sigaltstack+verbosity doesn't crash.
|
2015-08-25 18:27:53 +00:00
|
|
|
// RUN: %env_asan_opts=verbosity=1:use_sigaltstack=1:detect_stack_use_after_return=1 %run %t | FileCheck %s
|
2017-09-17 20:00:43 +00:00
|
|
|
|
|
|
|
// UNSUPPORTED: ios
|
|
|
|
|
2013-09-04 10:59:32 +00:00
|
|
|
#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) {
|
2014-09-17 07:31:37 +00:00
|
|
|
RecursiveFunc(15000, 0);
|
2013-09-04 10:59:32 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2014-09-17 07:31:37 +00:00
|
|
|
// CHECK: [15000] ptr:
|
|
|
|
// CHECK: [07000] ptr:
|
|
|
|
// CHECK: [00000] ptr:
|