brintos

brintos / llvm-project-archived public Read only

0
0
Text · 817 B · 8d40080 Raw
40 lines · cpp
1// Check that -asan-use-private-alias silence the false2// positive ODR violation on Darwin with LTO.3 4// REQUIRES: lto5 6// RUN: %clangxx_asan -DPART=0 -c %s -o %t-1.o -flto -mllvm -asan-use-private-alias7// RUN: %clangxx_asan -DPART=1 -c %s -o %t-2.o -flto -mllvm -asan-use-private-alias8// RUN: %clangxx_asan_lto %t-1.o %t-2.o -o %t -flto9// RUN: %run %t 2>&1 | FileCheck %s10 11#include <stdio.h>12#include <stdlib.h>13void putstest();14 15#if PART == 116 17static const char *my_global = "test\n\00abc";18 19int main()20{21  fputs(my_global, stderr);22  putstest();23  fprintf(stderr, "Done.\n");24  return 0;25}26 27#else // PART == 128 29static const char *my_other_global = "test\n\00abc";30 31void putstest()32{33  fputs(my_other_global, stderr);34}35 36#endif // PART == 137 38// CHECK-NOT: ERROR: AddressSanitizer: odr-violation39// CHECK: Done.40