1// RUN: %clangxx_asan -O0 -mllvm -asan-instrument-dynamic-allocas %s -o %t
2// RUN: %run %t 2>&1
3//
4
5#include <assert.h>
6#include <stdint.h>
7
8__attribute__((noinline)) void foo(int index, int len) {
9 volatile char str[len] __attribute__((aligned(32)));
10 assert(!(reinterpret_cast<uintptr_t>(str) & 31L));
11 str[index] = '1';
12}
13
14int main(int argc, char **argv) {
15 foo(index: 4, len: 5);
16 foo(index: 39, len: 40);
17 return 0;
18}
19

source code of compiler-rt/test/asan/TestCases/alloca_safe_access.cpp