Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / tsan / atexit5.cpp
blobe24f15d597ca1cb060bd1a59a816c5ee50871ed3
1 // RUN: %clangxx_tsan -O1 -fno-inline-functions %s -o %t && %deflake %run %t | FileCheck %s
2 #include "test.h"
3 #include <memory>
5 std::unique_ptr<long> global(new long(42));
7 void *thread(void *x) {
8 *global = 43;
9 barrier_wait(&barrier);
10 return nullptr;
13 int main() {
14 barrier_init(&barrier, 2);
15 pthread_t th;
16 pthread_create(&th, nullptr, thread, nullptr);
17 pthread_detach(th);
18 barrier_wait(&barrier);
19 return 0;
22 // CHECK: WARNING: ThreadSanitizer: data race
23 // CHECK: Write of size 8
24 // The exact spelling and number of std frames is hard to guess.
25 // CHECK: unique_ptr
26 // CHECK: #{{[1-9]}} cxa_at_exit_callback_installed_at
27 // CHECK: #{{[2-9]}} __cxx_global_var_init