• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 -pthread -o %t
5 // RUN: env ASAN_OPTIONS=strict_init_order=true %run %t
6 
7 #include <stdio.h>
8 #include <pthread.h>
9 
run(void * arg)10 void *run(void *arg) {
11   return arg;
12 }
13 
foo(void * input)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 
bar(void * input)22 void *bar(void *input) {
23   return input;
24 }
25 
26 void *glob = foo((void*)0x1234);
27 extern void *glob2;
28 
main()29 int main() {
30   printf("%p %p\n", glob, glob2);
31   return 0;
32 }
33