Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / asan / TestCases / Linux / global-overflow-bfd.cpp
blobbf82a517df37e9b7a2a4a68fa2f21e2781ba0f5a
1 // Test that gc-sections-friendly instrumentation of globals does not introduce
2 // false negatives with the BFD linker.
3 // RUN: %clangxx_asan -fuse-ld=bfd -Wl,-gc-sections -ffunction-sections -fdata-sections -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
5 #include <string.h>
6 int main(int argc, char **argv) {
7 static char XXX[10];
8 static char YYY[10];
9 static char ZZZ[10];
10 memset(XXX, 0, 10);
11 memset(YYY, 0, 10);
12 memset(ZZZ, 0, 10);
13 int res = YYY[argc * 10]; // BOOOM
14 // CHECK: {{READ of size 1 at}}
15 // CHECK: {{located 0 bytes after global variable}}
16 res += XXX[argc] + ZZZ[argc];
17 return res;