Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 1 | // Check that UAR mode can handle very deep recusrion. |
Pirama Arumuga Nainar | cdce50b | 2015-07-01 12:26:56 -0700 | [diff] [blame] | 2 | // RUN: export ASAN_OPTIONS=$ASAN_OPTIONS:detect_stack_use_after_return=1 |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 3 | // RUN: %clangxx_asan -O2 %s -o %t && \ |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 4 | // RUN: (ulimit -s 4096; %run %t) 2>&1 | FileCheck %s |
Stephen Hines | 86277eb | 2015-03-23 12:06:32 -0700 | [diff] [blame] | 5 | |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 6 | // Also check that use_sigaltstack+verbosity doesn't crash. |
Pirama Arumuga Nainar | cdce50b | 2015-07-01 12:26:56 -0700 | [diff] [blame] | 7 | // RUN: env ASAN_OPTIONS=$ASAN_OPTIONS:verbosity=1:use_sigaltstack=1 %run %t | FileCheck %s |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 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) { |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 21 | RecursiveFunc(15000, 0); |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 22 | return 0; |
| 23 | } |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 24 | // CHECK: [15000] ptr: |
| 25 | // CHECK: [07000] ptr: |
| 26 | // CHECK: [00000] ptr: |