[NFC][AArch64] Explicitly define undefined bits for instructions (#122129)
[llvm-project.git] / compiler-rt / test / sanitizer_common / TestCases / Linux / signal_line.cpp
blobf1afd859c207a120ceb1b343102eb7c9bb0c98ba
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
9 #include <cstdio>
10 #include <string>
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]);
17 if (n == 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
22 if (n == 2)
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