Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / sanitizer_common / TestCases / Posix / fpe.cpp
blob0bbe906567993636228f36174148d0719c02f750
1 // Test the handle_sigfpe option.
2 // RUN: %clangxx %s -o %t
3 // RUN: not %run %t 2>&1 | FileCheck --check-prefix=CHECK1 %s
4 // RUN: %env_tool_opts=handle_sigfpe=0 not --crash %run %t 2>&1 | FileCheck --check-prefix=CHECK0 %s
5 // RUN: %env_tool_opts=handle_sigfpe=1 not %run %t 2>&1 | FileCheck --check-prefix=CHECK1 %s
7 // FIXME: seems to fail on ARM
8 // REQUIRES: x86_64-target-arch
9 #include <assert.h>
10 #include <stdio.h>
11 #include <sanitizer/asan_interface.h>
13 void death() {
14 fprintf(stderr, "DEATH CALLBACK\n");
17 int main(int argc, char **argv) {
18 __sanitizer_set_death_callback(death);
19 volatile int one = 1;
20 volatile int zero = 0;
21 volatile int sink;
22 sink = one / zero;
25 // CHECK0-NOT: Sanitizer:DEADLYSIGNAL
26 // CHECK1: ERROR: {{.*}}Sanitizer: FPE
27 // CHECK1: {{#[0-9]+.* main .*fpe\.cpp}}:[[@LINE-5]]
28 // CHECK1: DEATH CALLBACK
29 // CHECK0-NOT: {{.*}}Sanitizer: FPE