]>
git.proxmox.com Git - rustc.git/blob - src/compiler-rt/test/asan/TestCases/alloca_loop_unpoisoning.cc
1 // RUN: %clangxx_asan -O0 -mllvm -asan-instrument-allocas %s -o %t
4 // REQUIRES: stable-runtime
6 // This testcase checks that allocas and VLAs inside loop are correctly unpoisoned.
11 #include "sanitizer/asan_interface.h"
13 // MSVC provides _alloca instead of alloca.
14 #if defined(_MSC_VER) && !defined(alloca)
15 # define alloca _alloca
20 __attribute__((noinline
)) void foo(int len
) {
23 char array
[len
]; // NOLINT
24 assert(!(reinterpret_cast<uintptr_t>(array
) & 31L));
26 for (int i
= 0; i
< 32; ++i
) {
27 char array
[i
]; // NOLINT
29 assert(!(reinterpret_cast<uintptr_t>(bot
) & 31L));
33 int main(int argc
, char **argv
) {
35 void *q
= __asan_region_is_poisoned(bot
, (char *)top
- (char *)bot
);