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