[OptTable] Fix typo VALUE => VALUES (NFCI) (#121523)
[llvm-project.git] / compiler-rt / test / asan / TestCases / zero_page_pc.cpp
bloba7d00ce9b69886432fee5e041cb589b697ed1ab7
1 // Check that ASan correctly detects SEGV on the zero page.
2 // RUN: %clangxx_asan %s -o %t && not %run %t 2>&1 | FileCheck %s
4 #if __has_feature(ptrauth_calls)
5 # include <ptrauth.h>
6 #endif
8 typedef void void_f();
9 int main() {
10 void_f *func = (void_f *)0x4;
11 #if __has_feature(ptrauth_calls)
12 func = ptrauth_sign_unauthenticated(
13 func, ptrauth_key_function_pointer, 0);
14 #endif
15 func();
16 // x86 reports the SEGV with both address=4 and pc=4.
17 // On PowerPC64 ELFv1, the pointer is taken to be a function-descriptor
18 // pointer out of which three 64-bit quantities are read. This will SEGV, but
19 // the compiler is free to choose the order. As a result, the address is
20 // either 0x4, 0xc or 0x14. The pc is still in main() because it has not
21 // actually made the call when the faulting access occurs.
22 // CHECK: {{AddressSanitizer: (SEGV|access-violation).*(address|pc) 0x0*[45c]}}
23 return 0;