1 // RUN: %clangxx_tsan -O1 %s -o %t && not %t 2>&1 | FileCheck %s 2 #include <pthread.h> 3 #include <stddef.h> 4 #include <unistd.h> 5 6 void *Thread2(void *a) { 7 *(int*)a = 43; 8 return 0; 9 } 10 11 void *Thread(void *a) { 12 int Var = 42; 13 pthread_t t; 14 pthread_create(&t, 0, Thread2, &Var); 15 Var = 42; 16 pthread_join(t, 0); 17 return 0; 18 } 19 20 int main() { 21 pthread_t t; 22 pthread_create(&t, 0, Thread, 0); 23 pthread_join(t, 0); 24 } 25 26 // CHECK: WARNING: ThreadSanitizer: data race 27 // CHECK: Location is stack of thread T1. 28 29