1 // Test for blacklist functionality of initialization-order checker. 2 3 // RUN: %clangxx_asan -O0 %s %p/Helpers/initialization-blacklist-extra.cc\ 4 // RUN: %p/Helpers/initialization-blacklist-extra2.cc \ 5 // RUN: -fsanitize-blacklist=%p/Helpers/initialization-blacklist.txt -o %t 6 // RUN: %env_asan_opts=check_initialization_order=true %run %t 2>&1 7 // RUN: %clangxx_asan -O1 %s %p/Helpers/initialization-blacklist-extra.cc\ 8 // RUN: %p/Helpers/initialization-blacklist-extra2.cc \ 9 // RUN: -fsanitize-blacklist=%p/Helpers/initialization-blacklist.txt -o %t 10 // RUN: %env_asan_opts=check_initialization_order=true %run %t 2>&1 11 // RUN: %clangxx_asan -O2 %s %p/Helpers/initialization-blacklist-extra.cc\ 12 // RUN: %p/Helpers/initialization-blacklist-extra2.cc \ 13 // RUN: -fsanitize-blacklist=%p/Helpers/initialization-blacklist.txt -o %t 14 // RUN: %env_asan_opts=check_initialization_order=true %run %t 2>&1 15 16 // Function is defined in another TU. 17 int readBadGlobal(); 18 int x = readBadGlobal(); // init-order bug. 19 20 // Function is defined in another TU. 21 int accessBadObject(); 22 int y = accessBadObject(); // init-order bug. 23 24 int readBadSrcGlobal(); 25 int z = readBadSrcGlobal(); // init-order bug. 26 27 int main(int argc, char **argv) { 28 return argc + x + y + z - 1; 29 } 30