]> git.proxmox.com Git - rustc.git/blob - src/compiler-rt/test/asan/TestCases/alloca_safe_access.cc
Imported Upstream version 1.6.0+dfsg1
[rustc.git] / src / compiler-rt / test / asan / TestCases / alloca_safe_access.cc
1 // RUN: %clangxx_asan -O0 -mllvm -asan-instrument-allocas %s -o %t
2 // RUN: %run %t 2>&1
3 //
4
5 #include <assert.h>
6
7 __attribute__((noinline)) void foo(int index, int len) {
8 volatile char str[len] __attribute__((aligned(32)));
9 assert(!(reinterpret_cast<long>(str) & 31L));
10 str[index] = '1';
11 }
12
13 int main(int argc, char **argv) {
14 foo(4, 5);
15 foo(39, 40);
16 return 0;
17 }