Alexey Samsonov | 4fc8098 | 2013-12-11 08:18:50 +0000 | [diff] [blame] | 1 | // Test that we can include header with TSan atomic interface. |
Renato Golin | 1f42286 | 2016-04-15 12:34:00 +0000 | [diff] [blame] | 2 | // RUN: %clang_tsan %s -o %t && %run %t 2>&1 | FileCheck %s |
Alexey Samsonov | 4fc8098 | 2013-12-11 08:18:50 +0000 | [diff] [blame] | 3 | #include <sanitizer/tsan_interface_atomic.h> |
| 4 | #include <stdio.h> |
| 5 | |
| 6 | int 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 |
Renato Golin | 1f42286 | 2016-04-15 12:34:00 +0000 | [diff] [blame] | 12 | fprintf(stderr, "PASS\n"); |
Alexey Samsonov | 4fc8098 | 2013-12-11 08:18:50 +0000 | [diff] [blame] | 13 | return 0; |
| 14 | } |
| 15 | return 1; |
| 16 | } |