[compiler-rt] [compiler-rt][asan] Include intrin.h for MinGW GCC (PR #222709)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 10 09:49:59 PDT 2026


https://github.com/oltolm created https://github.com/llvm/llvm-project/pull/222709

asan_globals_win.cpp calls __debugbreak in the runtime thunk configurations. Include MinGW's intrinsic header so the function is declared when this file is compiled with GCC.

>From cc32de4264c4cdca30c9bcc45efaf7908dbccb58 Mon Sep 17 00:00:00 2001
From: Oleg Tolmatcev <oleg.tolmatcev at gmail.com>
Date: Thu, 10 Sep 2026 17:49:43 +0200
Subject: [PATCH] [compiler-rt][asan] Include intrin.h for MinGW GCC

asan_globals_win.cpp calls __debugbreak in the runtime thunk
configurations. Include MinGW's intrinsic header so the function is
declared when this file is compiled with GCC.

Co-authored-by: Hannes Domani <ssbssa at yahoo.de>
---
 compiler-rt/lib/asan/asan_globals_win.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/compiler-rt/lib/asan/asan_globals_win.cpp b/compiler-rt/lib/asan/asan_globals_win.cpp
index aeef42749fa8c..156bfe10d36db 100644
--- a/compiler-rt/lib/asan/asan_globals_win.cpp
+++ b/compiler-rt/lib/asan/asan_globals_win.cpp
@@ -14,6 +14,10 @@
 #if SANITIZER_WINDOWS
 #  include "sanitizer_common/sanitizer_win_defs.h"
 
+#  if defined(__GNUC__) && !defined(__clang__)
+#    include <intrin.h>
+#  endif
+
 namespace __asan {
 
 #  pragma section(".ASAN$GA", read, write)



More information about the llvm-commits mailing list