13 lines · cpp
1// RUN: %clangxx_asan -o %t %s2// RUN: not %run %t 2>&1 | FileCheck %s3#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 owned8 // CHECK-NOT: AddressSanitizer:DEADLYSIGNAL9 // CHECK: SUMMARY: AddressSanitizer: bad-__sanitizer_get_allocated_size10 // CHECK-NOT: AddressSanitizer:DEADLYSIGNAL11 return (int)__sanitizer_get_allocated_size(&g_i);12}13