1 | // Test for ignorelist functionality of initialization-order checker. |
2 | |
3 | // RUN: %clangxx_asan -O0 %s %p/Helpers/initialization-ignorelist-extra.cpp\ |
4 | // RUN: %p/Helpers/initialization-ignorelist-extra2.cpp \ |
5 | // RUN: -fsanitize-ignorelist=%p/Helpers/initialization-ignorelist.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-ignorelist-extra.cpp\ |
8 | // RUN: %p/Helpers/initialization-ignorelist-extra2.cpp \ |
9 | // RUN: -fsanitize-ignorelist=%p/Helpers/initialization-ignorelist.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-ignorelist-extra.cpp\ |
12 | // RUN: %p/Helpers/initialization-ignorelist-extra2.cpp \ |
13 | // RUN: -fsanitize-ignorelist=%p/Helpers/initialization-ignorelist.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 | |