Merge from trunk
[official-gcc.git] / gcc / testsuite / c-c++-common / tsan / tls_race.c
blob423867e382d1305ae46a7fb9d681fa30422e9724
1 /* { dg-shouldfail "tsan" } */
3 #include <pthread.h>
4 #include <stddef.h>
6 void *Thread(void *a) {
7 *(int*)a = 43;
8 return 0;
11 int main() {
12 static __thread int Var = 42;
13 pthread_t t;
14 pthread_create(&t, 0, Thread, &Var);
15 Var = 43;
16 pthread_join(t, 0);
19 /* { dg-output "WARNING: ThreadSanitizer: data race.*(\n|\r\n|\r).*" } */
20 /* { dg-output " Location is TLS of main thread.(\n|\r\n|\r).*" } */