1*673dc3d4SNico Weber // RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
2*673dc3d4SNico Weber // RUN: %clangxx_asan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
3*673dc3d4SNico Weber // RUN: %clangxx_asan -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s
4*673dc3d4SNico Weber // RUN: %clangxx_asan -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s
5*673dc3d4SNico Weber 
6*673dc3d4SNico Weber #include <stdlib.h>
main(int argc,char ** argv)7*673dc3d4SNico Weber int main(int argc, char **argv) {
8*673dc3d4SNico Weber   volatile int *x = (int*)malloc(2*sizeof(int) + 2);
9*673dc3d4SNico Weber   int res = x[2];  // BOOOM
10*673dc3d4SNico Weber   // CHECK: {{READ of size 4 at 0x.* thread T0}}
11*673dc3d4SNico Weber   // CHECK: [[ADDR:0x[01-9a-fa-f]+]] is located 0 bytes to the right of {{.*}}-byte region [{{.*}},{{.*}}[[ADDR]])
12*673dc3d4SNico Weber   return res;
13*673dc3d4SNico Weber }
14