Move MSan lit-tests under test/msan
[blocksruntime.git] / lib / asan / lit_tests / TestCases / memcmp_test.cc
blob758311ddc47605a35b66d87f1cb6d220c61c9740
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
6 // REQUIRES: compiler-rt-optimized
8 #include <string.h>
9 int main(int argc, char **argv) {
10 char a1[] = {argc, 2, 3, 4};
11 char a2[] = {1, 2*argc, 3, 4};
12 int res = memcmp(a1, a2, 4 + argc); // BOOM
13 // CHECK: AddressSanitizer: stack-buffer-overflow
14 // CHECK: {{#0.*memcmp}}
15 // CHECK: {{#1.*main}}
16 return res;