]>
git.proxmox.com Git - rustc.git/blob - src/compiler-rt/test/tsan/benign_race.cc
1 // RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
8 void AnnotateBenignRaceSized(const char *f
, int l
,
9 void *mem
, unsigned int size
, const char *desc
);
10 void WTFAnnotateBenignRaceSized(const char *f
, int l
,
11 void *mem
, unsigned int size
,
16 void *Thread(void *x
) {
19 barrier_wait(&barrier
);
24 barrier_init(&barrier
, 2);
25 AnnotateBenignRaceSized(__FILE__
, __LINE__
,
26 &Global
, sizeof(Global
), "Race on Global");
27 WTFAnnotateBenignRaceSized(__FILE__
, __LINE__
,
28 &WTFGlobal
, sizeof(WTFGlobal
),
31 pthread_create(&t
, 0, Thread
, 0);
32 barrier_wait(&barrier
);
39 // CHECK-NOT: WARNING: ThreadSanitizer: data race