[clang] [clang][bytecode] Disable preservenone attribute on clang19+asan (PR #189377)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 30 06:19:20 PDT 2026


https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/189377

This better not break anything else.

>From ca01df8954932014f9439b4435030ecb4d2d8c6c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbaeder at redhat.com>
Date: Mon, 30 Mar 2026 14:21:50 +0200
Subject: [PATCH] [clang][bytecode] Disable preservenone attribute on
 clang19+asan

---
 clang/lib/AST/ByteCode/Interp.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/clang/lib/AST/ByteCode/Interp.h b/clang/lib/AST/ByteCode/Interp.h
index 3578ef9da820b..2af697cfed389 100644
--- a/clang/lib/AST/ByteCode/Interp.h
+++ b/clang/lib/AST/ByteCode/Interp.h
@@ -38,7 +38,10 @@
 
 // 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.
 #if !defined(__aarch64__) && !defined(__i386__) &&                             \
+    !(defined(__clang_major__) && __clang_major__ <= 19 &&                     \
+      __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