]> git.proxmox.com Git - rustc.git/blame - src/compiler-rt/test/tsan/interface_atomic_test.c
New upstream version 1.12.0+dfsg1
[rustc.git] / src / compiler-rt / test / tsan / interface_atomic_test.c
CommitLineData
1a4d82fc 1// Test that we can include header with TSan atomic interface.
5bcae85e 2// RUN: %clang_tsan %s -o %t && %run %t 2>&1 | FileCheck %s
1a4d82fc
JJ
3#include <sanitizer/tsan_interface_atomic.h>
4#include <stdio.h>
5
6int main() {
7 __tsan_atomic32 a;
8 __tsan_atomic32_store(&a, 100, __tsan_memory_order_release);
9 int res = __tsan_atomic32_load(&a, __tsan_memory_order_acquire);
10 if (res == 100) {
11 // CHECK: PASS
5bcae85e 12 fprintf(stderr, "PASS\n");
1a4d82fc
JJ
13 return 0;
14 }
15 return 1;
16}