2012-11-12 22:03:00 +08:00
|
|
|
// Test for blacklist functionality of initialization-order checker.
|
|
|
|
|
2013-06-07 17:38:55 +08:00
|
|
|
// RUN: %clangxx_asan -O0 %s %p/Helpers/initialization-blacklist-extra.cc\
|
2013-04-11 21:21:41 +08:00
|
|
|
// RUN: %p/Helpers/initialization-blacklist-extra2.cc \
|
2012-12-08 06:21:21 +08:00
|
|
|
// RUN: -fsanitize-blacklist=%p/Helpers/initialization-blacklist.txt \
|
2013-03-14 19:49:40 +08:00
|
|
|
// RUN: -fsanitize=init-order -o %t
|
2014-05-01 05:34:17 +08:00
|
|
|
// RUN: ASAN_OPTIONS=check_initialization_order=true %run %t 2>&1
|
2013-06-07 17:38:55 +08:00
|
|
|
// RUN: %clangxx_asan -O1 %s %p/Helpers/initialization-blacklist-extra.cc\
|
2013-04-11 21:21:41 +08:00
|
|
|
// RUN: %p/Helpers/initialization-blacklist-extra2.cc \
|
2012-12-08 06:21:21 +08:00
|
|
|
// RUN: -fsanitize-blacklist=%p/Helpers/initialization-blacklist.txt \
|
2013-03-14 19:49:40 +08:00
|
|
|
// RUN: -fsanitize=init-order -o %t
|
2014-05-01 05:34:17 +08:00
|
|
|
// RUN: ASAN_OPTIONS=check_initialization_order=true %run %t 2>&1
|
2013-06-07 17:38:55 +08:00
|
|
|
// RUN: %clangxx_asan -O2 %s %p/Helpers/initialization-blacklist-extra.cc\
|
2013-04-11 21:21:41 +08:00
|
|
|
// RUN: %p/Helpers/initialization-blacklist-extra2.cc \
|
2012-12-08 06:21:21 +08:00
|
|
|
// RUN: -fsanitize-blacklist=%p/Helpers/initialization-blacklist.txt \
|
2013-03-14 19:49:40 +08:00
|
|
|
// RUN: -fsanitize=init-order -o %t
|
2014-05-01 05:34:17 +08:00
|
|
|
// RUN: ASAN_OPTIONS=check_initialization_order=true %run %t 2>&1
|
2012-11-12 22:03:00 +08:00
|
|
|
|
|
|
|
// Function is defined in another TU.
|
|
|
|
int readBadGlobal();
|
|
|
|
int x = readBadGlobal(); // init-order bug.
|
|
|
|
|
|
|
|
// Function is defined in another TU.
|
|
|
|
int accessBadObject();
|
|
|
|
int y = accessBadObject(); // init-order bug.
|
|
|
|
|
2013-04-11 21:21:41 +08:00
|
|
|
int readBadSrcGlobal();
|
|
|
|
int z = readBadSrcGlobal(); // init-order bug.
|
|
|
|
|
2012-11-12 22:03:00 +08:00
|
|
|
int main(int argc, char **argv) {
|
2013-04-11 21:21:41 +08:00
|
|
|
return argc + x + y + z - 1;
|
2012-11-12 22:03:00 +08:00
|
|
|
}
|