Home | History | Annotate | Download | only in output_tests
      1 #include <pthread.h>
      2 #include <stdlib.h>
      3 #include <stdio.h>
      4 
      5 struct P {
      6   int x;
      7   int y;
      8 };
      9 
     10 void *Thread(void *x) {
     11   static P p = {rand(), rand()};
     12   if (p.x > RAND_MAX || p.y > RAND_MAX)
     13     exit(1);
     14   return 0;
     15 }
     16 
     17 int main() {
     18   pthread_t t[2];
     19   pthread_create(&t[0], 0, Thread, 0);
     20   pthread_create(&t[1], 0, Thread, 0);
     21   pthread_join(t[0], 0);
     22   pthread_join(t[1], 0);
     23 }
     24 
     25 // CHECK-NOT: WARNING: ThreadSanitizer: data race
     26