1 // RUN: %clang -O1 %s -o %t
2 // RUN: %env_tool_opts=handle_sigfpe=2 not %run %t 0 2>&1 | FileCheck %s -DSIGNAME=FPE
3 // RUN: %env_tool_opts=handle_sigill=2 not %run %t 1 2>&1 | FileCheck %s -DSIGNAME=ILL
4 // RUN: %env_tool_opts=handle_abort=2 not %run %t 2 2>&1 | FileCheck %s -DSIGNAME=ABRT
5 // RUN: %env_tool_opts=handle_segv=2 not %run %t 3 2>&1 | FileCheck %s -DSIGNAME=SEGV
6 // RUN: %env_tool_opts=handle_sigbus=2 not %run %t 4 2>&1 | FileCheck %s -DSIGNAME=BUS
7 // RUN: %env_tool_opts=handle_sigtrap=2 not %run %t 5 2>&1 | FileCheck %s -DSIGNAME=TRAP
8
9 #include <signal.h>
10 #include <stdlib.h>
11
main(int argc,char ** argv)12 int main(int argc, char **argv) {
13 if (argc != 2)
14 return 0;
15 int signals[] = {SIGFPE, SIGILL, SIGABRT, SIGSEGV, SIGBUS, SIGTRAP};
16 raise(signals[atoi(argv[1])]);
17 }
18
19 // CHECK: Sanitizer:DEADLYSIGNAL
20 // CHECK: Sanitizer: [[SIGNAME]] on unknown address
21