1// RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
2
3#include <stdio.h>
4#include <stdlib.h>
5
6static void atexit5() {
7 fprintf(stderr, "5");
8}
9
10static void atexit4() {
11 fprintf(stderr, "4");
12}
13
14static void atexit3() {
15 fprintf(stderr, "3");
16}
17
18static void atexit2() {
19 fprintf(stderr, "2");
20}
21
22static void atexit1() {
23 fprintf(stderr, "1");
24}
25
26static void atexit0() {
27 fprintf(stderr, "\n");
28}
29
30int main() {
31 atexit(atexit0);
32 atexit(atexit1);
33 atexit(atexit2);
34 atexit(atexit3);
35 atexit(atexit4);
36 atexit(atexit5);
37}
38
39// CHECK-NOT: FATAL: ThreadSanitizer
40// CHECK-NOT: WARNING: ThreadSanitizer
41// CHECK: 54321
42