Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / tsan / signal_exit.cpp
blob0c4444d2c4094b3e93cc80418d008e930927a491
1 // RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
2 #include "test.h"
3 #include <signal.h>
4 #include <sys/types.h>
6 static void handler(int, siginfo_t *, void *) {
7 write(2, "SIGNAL\n", 7);
8 // CHECK: SIGNAL
9 _exit(0);
10 // CHECK-NOT: ThreadSanitizer: signal-unsafe call
13 int main() {
14 struct sigaction act = {};
15 act.sa_sigaction = &handler;
16 act.sa_flags = SA_SIGINFO;
17 sigaction(SIGPROF, &act, 0);
18 raise(SIGPROF);
19 fprintf(stderr, "DONE\n");
20 // CHECK-NOT: DONE
21 return 0;