Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / msan / alloca.cpp
blob3472361e4b018fb510478a8c5861134a1e48b2ae
1 // RUN: %clangxx_msan -O0 -g %s -o %t && %run %t
2 // RUN: %clangxx_msan -O3 -g %s -o %t && %run %t
4 #include <assert.h>
5 #include <stdlib.h>
6 #include <string.h>
7 #include <stdio.h>
8 #include <sanitizer/msan_interface.h>
10 int main(void) {
11 char *p = (char *)alloca(16);
12 assert(0 == __msan_test_shadow(p, 16));
13 assert(0 == __msan_test_shadow(p + 15, 1));
15 memset(p, 0, 16);
16 assert(-1 == __msan_test_shadow(p, 16));
18 volatile int x = 0;
19 char * volatile q = (char *)alloca(42 * x);
20 assert(-1 == __msan_test_shadow(p, 16));
22 int r[x];
23 int *volatile r2 = r;
24 assert(-1 == __msan_test_shadow(p, 16));