Mercurial > hg > CbC > CbC_llvm
view compiler-rt/test/tsan/atomic_free.cpp @ 266:00f31e85ec16 default tip
Added tag current for changeset 31d058e83c98
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 14 Oct 2023 10:13:55 +0900 |
parents | 1d019706d866 |
children |
line wrap: on
line source
// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t 2>&1 | FileCheck %s // Also check that atomics instrumentation can be configured by either driver or // legacy flags: // RUN: %clangxx_tsan -O1 %s -o %t -fno-sanitize-thread-atomics && not %deflake %run %t 2>&1 \ // RUN: | FileCheck --allow-empty --check-prefix=CHECK-NO-ATOMICS %s // RUN: %clangxx_tsan -O1 %s -o %t -mllvm -tsan-instrument-atomics=0 && not %deflake %run %t 2>&1 \ // RUN: | FileCheck --allow-empty --check-prefix=CHECK-NO-ATOMICS %s <%t #include "test.h" void *Thread(void *a) { __atomic_fetch_add((int*)a, 1, __ATOMIC_SEQ_CST); barrier_wait(&barrier); return 0; } int main() { barrier_init(&barrier, 2); int *a = new int(0); pthread_t t; pthread_create(&t, 0, Thread, a); barrier_wait(&barrier); delete a; pthread_join(t, 0); } // CHECK: WARNING: ThreadSanitizer: data race // CHECK-NO-ATOMICS-NOT: WARNING: ThreadSanitizer: data race