]>
git.proxmox.com Git - rustc.git/blob - src/compiler-rt/test/sanitizer_common/TestCases/Posix/sanitizer_set_report_fd_test.cc
1 // Test __sanitizer_set_report_fd:
2 // RUN: %clangxx -O2 %s -o %t
3 // RUN: not %run %t 2>&1 | FileCheck %s
4 // RUN: not %run %t stdout | FileCheck %s
5 // RUN: not %run %t %t-out && FileCheck < %t-out %s
7 // REQUIRES: stable-runtime
8 // FIXME: implement SEGV handler in other sanitizers, not just asan.
13 #include <sanitizer/common_interface_defs.h>
17 #include <sys/types.h>
22 volatile int *null
= 0;
24 int main(int argc
, char **argv
) {
26 if (!strcmp(argv
[1], "stdout")) {
27 __sanitizer_set_report_fd(reinterpret_cast<void*>(1));
29 int fd
= open(argv
[1], O_CREAT
| O_WRONLY
| O_TRUNC
, S_IRWXU
);
31 __sanitizer_set_report_fd(reinterpret_cast<void*>(fd
));
37 // CHECK: ERROR: {{.*}} SEGV on unknown address