[Sanitizer] Add rudimentary support for wide-character strings to scanf/printf interc...
[blocksruntime.git] / test / tsan / static_init1.cc
blob4faf5bc54743c1028619cfa154be8ea38c22d3c5
1 // RUN: %clangxx_tsan -O1 %s -o %t && %t 2>&1 | FileCheck %s
2 #include <pthread.h>
3 #include <stdlib.h>
4 #include <stdio.h>
6 struct P {
7 int x;
8 int y;
9 };
11 void *Thread(void *x) {
12 static P p = {rand(), rand()};
13 if (p.x > RAND_MAX || p.y > RAND_MAX)
14 exit(1);
15 return 0;
18 int main() {
19 pthread_t t[2];
20 pthread_create(&t[0], 0, Thread, 0);
21 pthread_create(&t[1], 0, Thread, 0);
22 pthread_join(t[0], 0);
23 pthread_join(t[1], 0);
24 printf("PASS\n");
27 // CHECK-NOT: WARNING: ThreadSanitizer: data race