Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / msan / interception_sigaction_test.cpp
blob282771923960e38ccd2825de38b53290fd4e61dc
1 // RUN: %clangxx_msan -O0 -g %s -o %t
2 // RUN: MSAN_OPTIONS=handle_segv=2 %t 2>&1 | FileCheck %s
3 #include <stdlib.h>
4 #include <stdio.h>
5 #include <unistd.h>
6 #include <signal.h>
7 #include <string.h>
9 extern "C" int __interceptor_sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
10 extern "C" int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact) {
11 write(2, "sigaction call\n", sizeof("sigaction call\n") - 1);
12 return __interceptor_sigaction(signum, act, oldact);
15 int main() {
16 struct sigaction oldact;
17 sigaction(SIGSEGV, nullptr, &oldact);
19 if (oldact.sa_handler || oldact.sa_sigaction) {
20 fprintf(stderr, "oldact filled\n");
22 return 0;
23 // CHECK: sigaction call
24 // CHECK: oldact filled