]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/asan/TestCases/global-address.cpp
Vendor import of compiler-rt trunk r351319 (just before the release_80
[FreeBSD/FreeBSD.git] / test / asan / TestCases / global-address.cpp
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;
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 }