Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / tsan / atexit2.cpp
blob6f74c5f9f6e510a18ae5e031f525b7185e463466
1 // RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
3 #include <stdio.h>
4 #include <stdlib.h>
6 int n;
7 const int N = 10000;
9 static void atexit1() {
10 n++;
13 static void atexit0() {
14 fprintf(stderr, "run count: %d\n", n);
17 int main() {
18 atexit(atexit0);
19 for (int i = 0; i < N; i++)
20 atexit(atexit1);
23 // CHECK-NOT: FATAL: ThreadSanitizer
24 // CHECK-NOT: WARNING: ThreadSanitizer
25 // CHECK: run count: 10000