1 // Check that init-order checking is properly disabled if pthread_create is
4 // RUN: %clangxx_asan -c -DCONFIG1 %s -o %t1.o
5 // RUN: %clangxx_asan -c %s -o %t2.o
6 // RUN: %clangxx_asan -pthread %t1.o %t2.o -o %t
7 // RUN: %env_asan_opts=strict_init_order=true %run %t
15 void *bar(void *input
, bool sleep_before_init
) {
16 if (sleep_before_init
)
21 void *glob
= bar((void*)0x1234, false);
24 void *poll(void *arg
) {
25 void **glob
= (void**)arg
;
28 printf("glob is now: %p\n", *glob
);
32 struct GlobalPollerStarter
{
33 GlobalPollerStarter() {
36 pthread_attr_init(&attr
);
37 pthread_attr_setdetachstate(&attr
, PTHREAD_CREATE_DETACHED
);
38 pthread_create(&p
, 0, poll
, &glob
);
39 pthread_attr_destroy(&attr
);
40 printf("glob poller is started");
45 printf("%p %p\n", glob
, glob2
);
51 void *bar(void *input
, bool sleep_before_init
);
52 void *glob2
= bar((void*)0x2345, true);