1 // RUN: %clangxx_asan -fuse-ld=lld -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s 2 3 #include <string.h> main(int argc,char ** argv)4int main(int argc, char **argv) { 5 static char XXX[10]; 6 static char YYY[10]; 7 static char ZZZ[10]; 8 memset(XXX, 0, 10); 9 memset(YYY, 0, 10); 10 memset(ZZZ, 0, 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 to the right of global variable}} 15 // CHECK: {{.*YYY.* of size 10}} 16 res += XXX[argc] + ZZZ[argc]; 17 return res; 18 } 19