xref: /llvm-project/compiler-rt/test/tsan/printf-1.c (revision 394f1d4159d217113ef6e58ae9fec555838d8fed)
1e6a6183eSAlexey Samsonov // RUN: %clang_tsan -O2 %s -o %t
2*394f1d41SAlexey Samsonov // RUN: %env_tsan_opts=check_printf=1 %run %t 2>&1 | FileCheck %s
3*394f1d41SAlexey Samsonov // RUN: %env_tsan_opts=check_printf=0 %run %t 2>&1 | FileCheck %s
4b8aae540SGreg Fitzgerald // RUN: %run %t 2>&1 | FileCheck %s
5e6a6183eSAlexey Samsonov 
6e6a6183eSAlexey Samsonov #include <stdio.h>
main()7e6a6183eSAlexey Samsonov int main() {
8e6a6183eSAlexey Samsonov   volatile char c = '0';
9e6a6183eSAlexey Samsonov   volatile int x = 12;
10e6a6183eSAlexey Samsonov   volatile float f = 1.239;
11e6a6183eSAlexey Samsonov   volatile char s[] = "34";
12e6a6183eSAlexey Samsonov   printf("%c %d %.3f %s\n", c, x, f, s);
13e6a6183eSAlexey Samsonov   return 0;
14e6a6183eSAlexey Samsonov   // Check that printf works fine under Tsan.
15e6a6183eSAlexey Samsonov   // CHECK: 0 12 1.239 34
16e6a6183eSAlexey Samsonov }
17