[compiler-rt] [compiler-rt] Add MinGW GCC support for Windows sanitizer runtimes (PR #209902)

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 9 15:47:05 PDT 2026


================
@@ -332,15 +335,27 @@ ShadowExceptionHandler(PEXCEPTION_POINTERS exception_pointers) {
 #endif
 
 void InitializePlatformExceptionHandlers() {
-#if SANITIZER_WINDOWS64
+#  if SANITIZER_WINDOWS64
   // On Win64, we map memory on demand with access violation handler.
   // Install our exception handler.
   CHECK(AddVectoredExceptionHandler(TRUE, &ShadowExceptionHandler));
 #endif
 }
 
 bool IsSystemHeapAddress(uptr addr) {
-  return ::HeapValidate(GetProcessHeap(), 0, (void *)addr) != FALSE;
+  HANDLE process_heap = GetProcessHeap();
+  if (::HeapValidate(process_heap, 0, (void*)addr))
+    return true;
+
+#  if defined(__GNUC__) && !defined(__clang__)
+  HANDLE crt_heap = (HANDLE)_get_heap_handle();
+  if (crt_heap == process_heap)
----------------
vitalybuka wrote:

why do we need this?

https://github.com/llvm/llvm-project/pull/209902


More information about the llvm-commits mailing list