brintos

brintos / llvm-project-archived public Read only

0
0
Text · 674 B · 6733160 Raw
22 lines · cpp
1// Test that gc-sections-friendly instrumentation of globals does not introduce2// 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 %s4 5// Android does not use bfd.6// UNSUPPORTED: android7 8#include <string.h>9int main(int argc, char **argv) {10  static char XXX[10];11  static char YYY[10];12  static char ZZZ[10];13  memset(XXX, 0, 10);14  memset(YYY, 0, 10);15  memset(ZZZ, 0, 10);16  int res = YYY[argc * 10];  // BOOOM17  // CHECK: {{READ of size 1 at}}18  // CHECK: {{located 0 bytes after global variable}}19  res += XXX[argc] + ZZZ[argc];20  return res;21}22