Files
clang-p2996/compiler-rt/test/asan/TestCases/describe_address.cpp
Mitch Phillips 7b23552779 Fix-forward ASan on Windows.
D127911 deleted llvm.asan.globals. This had a side effect that we no
longer generated the `name` field for the `__asan_global` descriptor
from clang's decscription of the name, but the demangled name from the
LLVM IR. On Linux, this is the same as the clang-provided name. On
Windows, this includes the type, as the name in the IR is the mangled
name.

Attempt #1 to fix-forward the Windows bots by making the tests glob both
sides of the global name, thereby allowing types in the descriptor name.
2022-06-27 15:53:30 -07:00

20 lines
606 B
C++

// RUN: %clangxx_asan -O0 %s -o %t && %run %t 2>&1 | FileCheck %s
#include <sanitizer/asan_interface.h>
int global;
int main(int argc, char *argv[]) {
int stack;
int *heap = new int[100];
__asan_describe_address(heap);
// CHECK: {{.*}} is located 0 bytes inside of 400-byte region
// CHECK: allocated by thread T{{.*}} here
__asan_describe_address(&stack);
// CHECK: Address {{.*}} is located in stack of thread T{{.*}} at offset {{.*}}
__asan_describe_address(&global);
// CHECK: {{.*}} is located 0 bytes inside of global variable '{{.*}}global{{.*}}'
delete[] heap;
return 0;
}