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