xref: /llvm-project/compiler-rt/test/asan/TestCases/global-address.cpp (revision f8e944121e4a90a24f5fc45fbe7208c7b56962eb)
1 // RUN: %clangxx_asan -o %t %s
2 // RUN: not %run %t 2>&1 | FileCheck %s
3 #include <sanitizer/allocator_interface.h>
4 
5 int g_i = 42;
main()6 int main() {
7   // CHECK: AddressSanitizer: attempting to call __sanitizer_get_allocated_size() for pointer which is not owned
8   // CHECK-NOT: AddressSanitizer:DEADLYSIGNAL
9   // CHECK: SUMMARY: AddressSanitizer: bad-__sanitizer_get_allocated_size
10   // CHECK-NOT: AddressSanitizer:DEADLYSIGNAL
11   return (int)__sanitizer_get_allocated_size(&g_i);
12 }
13