summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--compiler-rt/lib/asan/lit_tests/Linux/heavy_uar_test.cc18
1 files changed, 13 insertions, 5 deletions
diff --git a/compiler-rt/lib/asan/lit_tests/Linux/heavy_uar_test.cc b/compiler-rt/lib/asan/lit_tests/Linux/heavy_uar_test.cc
index 53905a8f66c..c0f4560fb4e 100644
--- a/compiler-rt/lib/asan/lit_tests/Linux/heavy_uar_test.cc
+++ b/compiler-rt/lib/asan/lit_tests/Linux/heavy_uar_test.cc
@@ -22,22 +22,30 @@ char *LeakStack() {
return pretend_to_do_something(x);
}
+template<size_t kFrameSize>
__attribute__((noinline))
void RecuriveFunctionWithStackFrame(int depth) {
if (depth <= 0) return;
- char x[1024];
+ char x[kFrameSize];
x[0] = depth;
pretend_to_do_something(x);
- RecuriveFunctionWithStackFrame(depth - 1);
+ RecuriveFunctionWithStackFrame<kFrameSize>(depth - 1);
}
int main(int argc, char **argv) {
int n_iter = argc >= 2 ? atoi(argv[1]) : 1000;
int depth = argc >= 3 ? atoi(argv[2]) : 500;
- for (int i = 0; i < n_iter; i++)
- RecuriveFunctionWithStackFrame(depth);
+ for (int i = 0; i < n_iter; i++) {
+ RecuriveFunctionWithStackFrame<10>(depth);
+ RecuriveFunctionWithStackFrame<100>(depth);
+ RecuriveFunctionWithStackFrame<500>(depth);
+ RecuriveFunctionWithStackFrame<1024>(depth);
+ RecuriveFunctionWithStackFrame<2000>(depth);
+ RecuriveFunctionWithStackFrame<5000>(depth);
+ RecuriveFunctionWithStackFrame<10000>(depth);
+ }
char *stale_stack = LeakStack();
- RecuriveFunctionWithStackFrame(10);
+ RecuriveFunctionWithStackFrame<1024>(10);
stale_stack[100]++;
// CHECK: ERROR: AddressSanitizer: stack-use-after-return on address
// CHECK: is located in stack of thread T0 at offset 132 in frame
OpenPOWER on IntegriCloud