[ASan/Win] Add a comment about DCL-using-static vs threads
[blocksruntime.git] / test / msan / tls_reuse.cc
blobe024a5a8d13f5ff2cc2353fc8b4217af6ef77eec
1 // RUN: %clangxx_msan -m64 -O0 %s -o %t && %run %t
3 // Check that when TLS block is reused between threads, its shadow is cleaned.
5 #include <pthread.h>
6 #include <stdio.h>
8 int __thread x;
10 void *ThreadFn(void *) {
11 if (!x)
12 printf("zzz\n");
13 int y;
14 int * volatile p = &y;
15 x = *p;
16 return 0;
19 int main(void) {
20 pthread_t t;
21 for (int i = 0; i < 100; ++i) {
22 pthread_create(&t, 0, ThreadFn, 0);
23 pthread_join(t, 0);
25 return 0;