Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 1 | // Check that UAR mode can handle very deep recusrion. |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 2 | // RUN: %clangxx_asan -O2 %s -o %t && \ |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 3 | // RUN: (ulimit -s 4096; %env_asan_opts=detect_stack_use_after_return=1 %run %t) 2>&1 | FileCheck %s |
Stephen Hines | 86277eb | 2015-03-23 12:06:32 -0700 | [diff] [blame] | 4 | |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 5 | // Also check that use_sigaltstack+verbosity doesn't crash. |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 6 | // RUN: %env_asan_opts=verbosity=1:use_sigaltstack=1:detect_stack_use_after_return=1 %run %t | FileCheck %s |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 7 | #include <stdio.h> |
| 8 | |
| 9 | __attribute__((noinline)) |
| 10 | void RecursiveFunc(int depth, int *ptr) { |
| 11 | if ((depth % 1000) == 0) |
| 12 | printf("[%05d] ptr: %p\n", depth, ptr); |
| 13 | if (depth == 0) |
| 14 | return; |
| 15 | int local; |
| 16 | RecursiveFunc(depth - 1, &local); |
| 17 | } |
| 18 | |
| 19 | int main(int argc, char **argv) { |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 20 | RecursiveFunc(15000, 0); |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 21 | return 0; |
| 22 | } |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 23 | // CHECK: [15000] ptr: |
| 24 | // CHECK: [07000] ptr: |
| 25 | // CHECK: [00000] ptr: |