1 // RUN: %clangxx_asan -O0 %s -o %t
2 // RUN: not %run %t 2>&1 | FileCheck %s
3 // RUN: not %run %t heap 2>&1 | FileCheck %s
4 // RUN: %env_asan_opts=poison_partial=0 %run %t
5 // RUN: %env_asan_opts=poison_partial=0 %run %t heap
6 #include <string.h>
7 char g[21];
8 char *x;
9
main(int argc,char ** argv)10 int main(int argc, char **argv) {
11 if (argc >= 2)
12 x = new char[21];
13 else
14 x = &g[0];
15 memset(x, 0, 21);
16 int *y = (int*)x;
17 return y[5];
18 }
19 // CHECK: 0 bytes to the right
20