Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / asan / TestCases / alloca_instruments_all_paddings.cpp
blob912c8b0abaabd00dd7c64bcdeb55dda9a64e7435
1 // RUN: %clangxx_asan -O0 -mllvm -asan-instrument-dynamic-allocas %s -o %t
2 // RUN: %clangxx_asan -O3 -mllvm -asan-instrument-dynamic-allocas %s -o %t
3 // RUN: %run %t 2>&1
4 //
6 #include "sanitizer/asan_interface.h"
7 #include <assert.h>
8 #include <stdint.h>
10 __attribute__((noinline)) void foo(int index, int len) {
11 volatile char str[len] __attribute__((aligned(32)));
12 assert(!(reinterpret_cast<uintptr_t>(str) & 31L));
13 char *q = (char *)__asan_region_is_poisoned((char *)str, 64);
14 assert(q && ((q - str) == index));
17 int main(int argc, char **argv) {
18 for (int i = 1; i < 33; ++i)
19 foo(i, i);
21 for (int i = 1; i < 33; ++i)
22 foo(i, i);
24 return 0;