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 <string.h> main(int argc,char ** argv)7*673dc3d4SNico Weberint main(int argc, char **argv) { 8*673dc3d4SNico Weber char x[10]; 9*673dc3d4SNico Weber memset(x, 0, 10); 10*673dc3d4SNico Weber int res = x[argc * 10]; // BOOOM 11*673dc3d4SNico Weber // CHECK: {{READ of size 1 at 0x.* thread T0}} 12*673dc3d4SNico Weber // CHECK: {{ #0 0x.* in main .*stack-buffer-overflow.cpp:}}[[@LINE-2]] 13*673dc3d4SNico Weber // CHECK: {{Address 0x.* is located in stack of thread T0 at offset}} 14*673dc3d4SNico Weber // CHECK-NEXT: in{{.*}}main{{.*}}stack-buffer-overflow.cpp 15*673dc3d4SNico Weber return res; 16*673dc3d4SNico Weber } 17