Home | History | Annotate | Download | only in msan
      1 // RUN: %clangxx_msan -O0 %s -o %t && %run %t
      2 
      3 // Check that when TLS block is reused between threads, its shadow is cleaned.
      4 
      5 #include <pthread.h>
      6 #include <stdio.h>
      7 
      8 int __thread x;
      9 
     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;
     17 }
     18 
     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);
     24   }
     25   return 0;
     26 }
     27