1// RUN: %clang_cl_asan %Od %s %Fe%t
2// RUN: %run %t 2>&1 | FileCheck %s
3// RUN: %env_asan_opts=windows_hook_rtl_allocators=true %run %t 2>&1 | FileCheck %s
4// UNSUPPORTED: asan-64-bits
5#include <assert.h>
6#include <stdio.h>
7#include <windows.h>
8
9extern "C" int
10__sanitizer_get_ownership(const volatile void *p);
11
12int main() {
13 char *buffer;
14 buffer = (char *)HeapAlloc(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS, 32);
15 buffer[0] = 'a';
16 assert(!__sanitizer_get_ownership(buffer));
17 HeapFree(GetProcessHeap(), 0, buffer);
18 puts(s: "Okay");
19 // CHECK: Okay
20}
21

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