1 | // RUN: %clangxx_asan -O0 %s %p/Helpers/underflow.cpp -o %t && not %run %t 2>&1 | FileCheck %s |
2 | // RUN: %clangxx_asan -O1 %s %p/Helpers/underflow.cpp -o %t && not %run %t 2>&1 | FileCheck %s |
3 | // RUN: %clangxx_asan -O2 %s %p/Helpers/underflow.cpp -o %t && not %run %t 2>&1 | FileCheck %s |
4 | // RUN: %clangxx_asan -O3 %s %p/Helpers/underflow.cpp -o %t && not %run %t 2>&1 | FileCheck %s |
5 | |
6 | int XXX[2] = {2, 3}; |
7 | extern int YYY[]; |
8 | #include <string.h> |
9 | int main(int argc, char **argv) { |
10 | memset(s: XXX, c: 0, n: 2*sizeof(int)); |
11 | // CHECK: {{READ of size 4 at 0x.* thread T0}} |
12 | // CHECK: {{ #0 0x.* in main .*global-underflow.cpp:}}[[@LINE+3]] |
13 | // CHECK: {{0x.* is located 4 bytes before global variable}} |
14 | // CHECK: {{.*YYY.* of size 12}} |
15 | int res = YYY[-1]; |
16 | return res; |
17 | } |
18 | |