[clang] Fully disable `preserve_none` under ASan (PR #190001)

Chandler Carruth via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 1 10:08:10 PDT 2026


https://github.com/chandlerc created https://github.com/llvm/llvm-project/pull/190001

This crashes Clang 19, 21, and 22 on x86-64 that I've tested and I don't have a ready-to-test build of any other versions but it seems much safer to just disable for now.

>From 08cc43ac9233a02a779a450a221d2bc64b624cc4 Mon Sep 17 00:00:00 2001
From: Chandler Carruth <chandlerc at gmail.com>
Date: Wed, 1 Apr 2026 17:06:17 +0000
Subject: [PATCH] Fully disable `preserve_none` under ASan

This crashes Clang 19, 21, and 22 on x86-64 that I've tested and I don't
have a ready-to-test build of any other versions but it seems much safer
to just disable for now.
---
 clang/lib/AST/ByteCode/Interp.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/clang/lib/AST/ByteCode/Interp.h b/clang/lib/AST/ByteCode/Interp.h
index 2af697cfed389..2e7045b39c3db 100644
--- a/clang/lib/AST/ByteCode/Interp.h
+++ b/clang/lib/AST/ByteCode/Interp.h
@@ -36,12 +36,12 @@
 #include "llvm/ADT/ScopeExit.h"
 #include <type_traits>
 
-// preserve_none is supported on aarch64, but causes problems when asan is
-// enabled. See https://github.com/llvm/llvm-project/issues/177519.
-// preserve_none also causes problems on clang <= 19 if asan is enabled.
+// preserve_none causes problems when asan is enabled on both AArch64 and other
+// platforms. Disable it until all the bugs are fixed here.
+//
+// See https://github.com/llvm/llvm-project/issues/177519 for AArch64.
 #if !defined(__aarch64__) && !defined(__i386__) &&                             \
-    !(defined(__clang_major__) && __clang_major__ <= 19 &&                     \
-      __has_feature(address_sanitizer)) &&                                     \
+    !__has_feature(address_sanitizer) &&                                       \
     __has_cpp_attribute(clang::preserve_none)
 #define PRESERVE_NONE [[clang::preserve_none]]
 #else



More information about the cfe-commits mailing list