1// RUN: %clangxx_asan -o %t %s
2// RUN: not %run %t 2>&1 | FileCheck %s
3#include <sanitizer/allocator_interface.h>
4
5int g_i = 42;
6int 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(p: &g_i);
12}
13

source code of compiler-rt/test/asan/TestCases/global-address.cpp