brintos

brintos / llvm-project-archived public Read only

0
0
Text · 606 B · 296d3fd Raw
20 lines · cpp
1// RUN: %clangxx_asan -O0 %s -o %t && %run %t 2>&1 | FileCheck %s2 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(heap);11  // CHECK: {{.*}} is located 0 bytes inside of 400-byte region12  // CHECK: allocated by thread T{{.*}} here13  __asan_describe_address(&stack);14  // CHECK: Address {{.*}} is located in stack of thread T{{.*}} at offset {{.*}}15  __asan_describe_address(&global);16  // CHECK: {{.*}} is located 0 bytes inside of global variable '{{.*}}global{{.*}}'17  delete[] heap;18  return 0;19}20