]> git.proxmox.com Git - rustc.git/blob - src/libcompiler_builtins/compiler-rt/test/sanitizer_common/TestCases/Linux/ill.cc
New upstream version 1.28.0+dfsg1
[rustc.git] / src / libcompiler_builtins / compiler-rt / test / sanitizer_common / TestCases / Linux / ill.cc
1 // Test the handle_sigill option.
2
3 // clang-format off
4 // RUN: %clangxx %s -o %t -O1
5 // RUN: not --crash %run %t 2>&1 | FileCheck --check-prefix=CHECK0 %s
6 // RUN: %env_tool_opts=handle_sigill=0 not --crash %run %t 2>&1 | FileCheck --check-prefix=CHECK0 %s
7 // RUN: %env_tool_opts=handle_sigill=1 not %run %t 2>&1 | FileCheck --check-prefix=CHECK1 %s
8 // clang-format on
9
10 // FIXME: seems to fail on ARM
11 // REQUIRES: x86_64-target-arch
12 #include <assert.h>
13 #include <stdio.h>
14 #include <sanitizer/asan_interface.h>
15
16 void death() {
17 fprintf(stderr, "DEATH CALLBACK\n");
18 }
19
20 int main(int argc, char **argv) {
21 __sanitizer_set_death_callback(death);
22 __builtin_trap();
23 }
24
25 // CHECK0-NOT: Sanitizer:DEADLYSIGNAL
26 // CHECK1: ERROR: {{.*}}Sanitizer: ILL
27 // CHECK1: {{#[0-9]+.* main .*ill\.cc:[0-9]+}}
28 // CHECK1: DEATH CALLBACK
29 // CHECK0-NOT: Sanitizer