1*673dc3d4SNico Weber // RUN: %clang_cl_asan /Od -o %t %s
2*673dc3d4SNico Weber // RUN: %env_asan_opts=windows_hook_rtl_allocators=true %run %t 2>&1 | FileCheck %s
3*673dc3d4SNico Weber // RUN: %env_asan_opts=windows_hook_rtl_allocators=false %run %t 2>&1 | FileCheck %s
4*673dc3d4SNico Weber // RUN: %clang_cl /Od -o %t %s
5*673dc3d4SNico Weber // RUN: %run %t 2>&1 | FileCheck %s
6*673dc3d4SNico Weber // UNSUPPORTED: asan-64-bits
7*673dc3d4SNico Weber #include <cassert>
8*673dc3d4SNico Weber #include <stdio.h>
9*673dc3d4SNico Weber #include <windows.h>
10*673dc3d4SNico Weber
main()11*673dc3d4SNico Weber int main() {
12*673dc3d4SNico Weber HANDLE heap = HeapCreate(0, 0, 0);
13*673dc3d4SNico Weber void *ptr = HeapAlloc(heap, 0, 4);
14*673dc3d4SNico Weber assert(ptr);
15*673dc3d4SNico Weber void *ptr2 = HeapReAlloc(heap, 0, ptr, 0);
16*673dc3d4SNico Weber assert(ptr2);
17*673dc3d4SNico Weber HeapFree(heap, 0, ptr2);
18*673dc3d4SNico Weber fprintf(stderr, "passed!\n");
19*673dc3d4SNico Weber }
20*673dc3d4SNico Weber
21*673dc3d4SNico Weber // CHECK-NOT: double-free
22*673dc3d4SNico Weber // CHECK-NOT: AddressSanitizer
23*673dc3d4SNico Weber // CHECK: passed!
24