1// RUN: %clangxx_asan -O0 %s -o %t && %run %t 2>&1 | FileCheck %s
2
3#include <sanitizer/asan_interface.h>
4
5int global;
6
7int main(int argc, char *argv[]) {
8 int stack;
9 int *heap = new int[100];
10 __asan_describe_address(addr: heap);
11 // CHECK: {{.*}} is located 0 bytes inside of 400-byte region
12 // CHECK: allocated by thread T{{.*}} here
13 __asan_describe_address(addr: &stack);
14 // CHECK: Address {{.*}} is located in stack of thread T{{.*}} at offset {{.*}}
15 __asan_describe_address(addr: &global);
16 // CHECK: {{.*}} is located 0 bytes inside of global variable '{{.*}}global{{.*}}'
17 delete[] heap;
18 return 0;
19}
20

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