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 a1[] = {argc, 2, 3, 4};
      9   char a2[] = {1, 2*argc, 3, 4};
     10   int res = memcmp(a1, a2, 4 + argc);  // BOOM
     11   // CHECK: AddressSanitizer: stack-buffer-overflow
     12   // CHECK: {{#0.*memcmp}}
     13   // CHECK: {{#1.*main}}
     14   return res;
     15 }
     16