1 // RUN: %clangxx_asan -m64 -O0 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
2 // RUN: %clangxx_asan -m64 -O1 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
3 // RUN: %clangxx_asan -m64 -O2 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
4 // RUN: %clangxx_asan -m64 -O3 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
5 // RUN: %clangxx_asan -m32 -O0 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
6 // RUN: %clangxx_asan -m32 -O1 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
7 // RUN: %clangxx_asan -m32 -O2 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
8 // RUN: %clangxx_asan -m32 -O3 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
9
10 #include <string.h>
main(int argc,char ** argv)11 int main(int argc, char **argv) {
12 char a1[] = {argc, 2, 3, 4};
13 char a2[] = {1, 2*argc, 3, 4};
14 int res = memcmp(a1, a2, 4 + argc); // BOOM
15 // CHECK: AddressSanitizer: stack-buffer-overflow
16 // CHECK: {{#0.*memcmp}}
17 // CHECK: {{#1.*main}}
18 return res;
19 }
20