summaryrefslogtreecommitdiff
path: root/test/tsan/race_on_barrier.c
diff options
context:
space:
mode:
authorKuba Brecka <kuba.brecka@gmail.com>2015-11-19 10:35:35 +0000
committerKuba Brecka <kuba.brecka@gmail.com>2015-11-19 10:35:35 +0000
commit8ae38c3cbfeaf3019cea745e91e2e4b92208cd0e (patch)
tree6fc255cc8696a867cca7bd9432d9e91a6d705778 /test/tsan/race_on_barrier.c
parentb7b36e1c6578e57477dace9a0333efcfa8cd59f9 (diff)
[tsan] Handle dispatch_once on OS X
Reimplement dispatch_once in an interceptor to solve these issues that may produce false positives with TSan on OS X: 1) there is a racy load inside an inlined part of dispatch_once, 2) the fast path in dispatch_once doesn't perform an acquire load, so we don't properly synchronize the initialization and subsequent uses of whatever is initialized, 3) dispatch_once is already used in a lot of already-compiled code, so TSan doesn't see the inlined fast-path. This patch uses a trick to avoid ever taking the fast path (by never storing ~0 into the predicate), which means the interceptor will always be called even from already-compiled code. Within the interceptor, our own atomic reads and writes are not written into shadow cells, so the race in the inlined part is not reported (because the accesses are only loads). Differential Revision: http://reviews.llvm.org/D14811 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@253552 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/tsan/race_on_barrier.c')
0 files changed, 0 insertions, 0 deletions