1 // Test line numbers in signal handlers
2 // Fails with debug checks: https://bugs.llvm.org/show_bug.cgi?id=46860
3 // XFAIL: !compiler-rt-optimized && tsan
5 // RUN: %clangxx %s -o %t -O0
6 // RUN: %env_tool_opts=handle_segv=1:print_stacktrace=1 not %run %t 1 2>&1 | FileCheck --check-prefixes=CHECK1,CHECK %s
7 // RUN: %env_tool_opts=handle_segv=1:print_stacktrace=1 not %run %t 2 2>&1 | FileCheck --check-prefixes=CHECK2,CHECK %s
12 // CHECK: [[SAN:.*Sanitizer]]:DEADLYSIGNAL
13 // CHECK: ERROR: [[SAN]]: SEGV on unknown address {{0x[^ ]*}} (pc
14 int main(int argc
, char **argv
) {
15 int n
= atoi(argv
[1]);
18 *((volatile int *)0x0) = __LINE__
;
19 // CHECK1: #{{[0-9]+ .*}}main {{.*}}signal_line.cpp:[[@LINE-1]]:[[TAB:[0-9]+]]
20 // CHECK1: SUMMARY: [[SAN]]: SEGV {{.*}}signal_line.cpp:[[@LINE-2]]:[[TAB]] in main
23 // Allow for strict-alignment targets that require natural alignment.
24 *((volatile int *)0x8) = __LINE__
;
25 // CHECK2: #{{[0-9]+ .*}}main {{.*}}signal_line.cpp:[[@LINE-1]]:[[TAB:[0-9]+]]
26 // CHECK2: SUMMARY: [[SAN]]: SEGV {{.*}}signal_line.cpp:[[@LINE-2]]:[[TAB]] in main