diff options
Diffstat (limited to 'test/asan/TestCases/init-order-pthread-create.cc')
| -rw-r--r-- | test/asan/TestCases/init-order-pthread-create.cc | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/asan/TestCases/init-order-pthread-create.cc b/test/asan/TestCases/init-order-pthread-create.cc new file mode 100644 index 000000000000..eeff308a4cd5 --- /dev/null +++ b/test/asan/TestCases/init-order-pthread-create.cc @@ -0,0 +1,32 @@ +// Check that init-order checking is properly disabled if pthread_create is +// called. + +// RUN: %clangxx_asan %s %p/Helpers/init-order-pthread-create-extra.cc -pthread -o %t +// RUN: env ASAN_OPTIONS=strict_init_order=true %run %t + +#include <stdio.h> +#include <pthread.h> + +void *run(void *arg) { + return arg; +} + +void *foo(void *input) { + pthread_t t; + pthread_create(&t, 0, run, input); + void *res; + pthread_join(t, &res); + return res; +} + +void *bar(void *input) { + return input; +} + +void *glob = foo((void*)0x1234); +extern void *glob2; + +int main() { + printf("%p %p\n", glob, glob2); + return 0; +} |
