2013-07-02 00:16:41 +08:00
|
|
|
// Check that init-order checking is properly disabled if pthread_create is
|
|
|
|
// called.
|
|
|
|
|
2014-04-04 20:24:46 +08:00
|
|
|
// RUN: %clangxx_asan %s %p/Helpers/init-order-pthread-create-extra.cc -lpthread -o %t
|
2013-11-06 12:27:09 +08:00
|
|
|
// RUN: ASAN_OPTIONS=strict_init_order=true %t
|
2013-07-02 00:16:41 +08:00
|
|
|
|
|
|
|
#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;
|
|
|
|
}
|