diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2015-01-07 19:55:37 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2015-01-07 19:55:37 +0000 |
commit | ca9211ecdede9bdedb812b2243a4abdb8dacd1b9 (patch) | |
tree | 9b19e801150082c33e9152275829a6ce90614b55 /test/tsan/interface_atomic_test.c | |
parent | 8ef50bf3d1c287b5013c3168de77a462dfce3495 (diff) |
Diffstat (limited to 'test/tsan/interface_atomic_test.c')
-rw-r--r-- | test/tsan/interface_atomic_test.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/tsan/interface_atomic_test.c b/test/tsan/interface_atomic_test.c new file mode 100644 index 0000000000000..18d860ea02e2b --- /dev/null +++ b/test/tsan/interface_atomic_test.c @@ -0,0 +1,16 @@ +// Test that we can include header with TSan atomic interface. +// RUN: %clang_tsan %s -o %t && %run %t | FileCheck %s +#include <sanitizer/tsan_interface_atomic.h> +#include <stdio.h> + +int main() { + __tsan_atomic32 a; + __tsan_atomic32_store(&a, 100, __tsan_memory_order_release); + int res = __tsan_atomic32_load(&a, __tsan_memory_order_acquire); + if (res == 100) { + // CHECK: PASS + printf("PASS\n"); + return 0; + } + return 1; +} |