summaryrefslogtreecommitdiff
path: root/test/asan/TestCases/global-address.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/asan/TestCases/global-address.cpp')
-rw-r--r--test/asan/TestCases/global-address.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/asan/TestCases/global-address.cpp b/test/asan/TestCases/global-address.cpp
new file mode 100644
index 0000000000000..0e56ca10c39c2
--- /dev/null
+++ b/test/asan/TestCases/global-address.cpp
@@ -0,0 +1,12 @@
+// RUN: %clangxx_asan -o %t %s
+// RUN: not %run %t 2>&1 | FileCheck %s
+#include <sanitizer/allocator_interface.h>
+
+int g_i = 42;
+int main() {
+ // CHECK: AddressSanitizer: attempting to call __sanitizer_get_allocated_size() for pointer which is not owned
+ // CHECK-NOT: ASAN:DEADLYSIGNAL
+ // CHECK: SUMMARY: AddressSanitizer: bad-__sanitizer_get_allocated_size
+ // CHECK-NOT: ASAN:DEADLYSIGNAL
+ return (int)__sanitizer_get_allocated_size(&g_i);
+}