[LVI] Add trunc to i1 handling. (#124480)
[llvm-project.git] / compiler-rt / test / asan / TestCases / Posix / bcmp_test.cpp
blob09994bb8495f24588577f9394ecd6fd4c724077a
1 // RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
2 // RUN: %clangxx_asan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
3 // RUN: %clangxx_asan -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s
4 // RUN: %clangxx_asan -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s
6 // REQUIRES: compiler-rt-optimized, (linux && !android) || openbsd || freebsd || netbsd
7 // XFAIL: darwin
9 #include <string.h>
10 int main(int argc, char **argv) {
11 char a1[] = {static_cast<char>(argc), 2, 3, 4};
12 char a2[] = {1, static_cast<char>(2 * argc), 3, 4};
13 int res = bcmp(a1, a2, 4 + argc); // BOOM
14 // CHECK: AddressSanitizer: stack-buffer-overflow
15 // CHECK: {{#[0-9]+ .*bcmp}}
16 // CHECK: {{#[0-9]+ .*main}}
17 return res;