1 // Check that -asan-use-private-alias silence the false 2 // positive ODR violation on Darwin with LTO. 3 4 // REQUIRES: lto 5 6 // RUN: %clangxx_asan -DPART=0 -c %s -o %t-1.o -flto -mllvm -asan-use-private-alias 7 // RUN: %clangxx_asan -DPART=1 -c %s -o %t-2.o -flto -mllvm -asan-use-private-alias 8 // RUN: %clangxx_asan %t-1.o %t-2.o -o %t -flto 9 // RUN: %run %t 2>&1 | FileCheck %s 10 11 #include <stdio.h> 12 #include <stdlib.h> 13 void putstest(); 14 15 #if PART == 1 16 17 static const char *my_global = "test\n\00abc"; 18 main()19int main() 20 { 21 fputs(my_global, stderr); 22 putstest(); 23 fprintf(stderr, "Done.\n"); 24 return 0; 25 } 26 27 #else // PART == 1 28 29 static const char *my_other_global = "test\n\00abc"; 30 putstest()31void putstest() 32 { 33 fputs(my_other_global, stderr); 34 } 35 36 #endif // PART == 1 37 38 // CHECK-NOT: ERROR: AddressSanitizer: odr-violation 39 // CHECK: Done. 40