1*7c3d14c8STreehugger Robot // RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s 2*7c3d14c8STreehugger Robot // RUN: %clangxx_asan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s 3*7c3d14c8STreehugger Robot // RUN: %clangxx_asan -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s 4*7c3d14c8STreehugger Robot // RUN: %clangxx_asan -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s 5*7c3d14c8STreehugger Robot 6*7c3d14c8STreehugger Robot #include <string.h> main(int argc,char ** argv)7*7c3d14c8STreehugger Robotint main(int argc, char **argv) { 8*7c3d14c8STreehugger Robot char x[10]; 9*7c3d14c8STreehugger Robot memset(x, 0, 10); 10*7c3d14c8STreehugger Robot int res = x[argc * 10]; // BOOOM 11*7c3d14c8STreehugger Robot // CHECK: {{READ of size 1 at 0x.* thread T0}} 12*7c3d14c8STreehugger Robot // CHECK: {{ #0 0x.* in main .*stack-buffer-overflow.cc:}}[[@LINE-2]] 13*7c3d14c8STreehugger Robot // CHECK: {{Address 0x.* is located in stack of thread T0 at offset}} 14*7c3d14c8STreehugger Robot // CHECK-NEXT: in{{.*}}main{{.*}}stack-buffer-overflow.cc 15*7c3d14c8STreehugger Robot return res; 16*7c3d14c8STreehugger Robot } 17