1 // RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
8 void AnnotateIgnoreReadsBegin(const char *f
, int l
);
9 void AnnotateIgnoreReadsEnd(const char *f
, int l
);
10 void AnnotateIgnoreWritesBegin(const char *f
, int l
);
11 void AnnotateIgnoreWritesEnd(const char *f
, int l
);
16 void *Thread(void *a
) {
18 while ((p
= __atomic_load_n(&g
, __ATOMIC_RELAXED
)) == 0)
26 pthread_create(&t
, 0, Thread
, 0);
27 AnnotateIgnoreWritesBegin(__FILE__
, __LINE__
);
29 AnnotateIgnoreWritesEnd(__FILE__
, __LINE__
);
30 __atomic_store_n(&g
, p
, __ATOMIC_RELAXED
);
33 fprintf(stderr
, "OK\n");
37 // CHECK-NOT: WARNING: ThreadSanitizer: data race