1 // Check that init-order checking is properly disabled if pthread_create is 2 // called. 3 4 // RUN: %clangxx_asan %s %p/Helpers/init-order-pthread-create-extra.cc -o %t 5 // RUN: ASAN_OPTIONS=check_initialization_order=true:strict_init_order=true %t 6 7 #include <stdio.h> 8 #include <pthread.h> 9 10 void *run(void *arg) { 11 return arg; 12 } 13 14 void *foo(void *input) { 15 pthread_t t; 16 pthread_create(&t, 0, run, input); 17 void *res; 18 pthread_join(t, &res); 19 return res; 20 } 21 22 void *bar(void *input) { 23 return input; 24 } 25 26 void *glob = foo((void*)0x1234); 27 extern void *glob2; 28 29 int main() { 30 printf("%p %p\n", glob, glob2); 31 return 0; 32 } 33