[compiler-rt] Fix improper alignment of static buffer for placement-new of BufferQueue (PR #152408)
Slava Gurevich via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 8 09:28:11 PDT 2025
https://github.com/noclowns updated https://github.com/llvm/llvm-project/pull/152408
>From 3b9a0884ba75098789e057cd6f4f29e84b6eca2c Mon Sep 17 00:00:00 2001
From: Slava Gurevich <108763208+noclowns at users.noreply.github.com>
Date: Wed, 6 Aug 2025 16:24:11 -0700
Subject: [PATCH] Fix improper alignment of static buffer for placement-new of
BufferQueue
No behavioral change, but eliminates potential UB in strict-alignment systems.
The previous commit (llvm#94171) bulk-updated alignment usage to C++23 spec, but missed this occurrence.
---
compiler-rt/lib/xray/xray_fdr_logging.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/compiler-rt/lib/xray/xray_fdr_logging.cpp b/compiler-rt/lib/xray/xray_fdr_logging.cpp
index 7def3565d56ab..977a0b9b87f4e 100644
--- a/compiler-rt/lib/xray/xray_fdr_logging.cpp
+++ b/compiler-rt/lib/xray/xray_fdr_logging.cpp
@@ -73,7 +73,7 @@ static_assert(std::is_trivially_destructible<ThreadLocalData>::value,
static pthread_key_t Key;
// Global BufferQueue.
-static std::byte BufferQueueStorage[sizeof(BufferQueue)];
+alignas(BufferQueue) static std::byte BufferQueueStorage[sizeof(BufferQueue)];
static BufferQueue *BQ = nullptr;
// Global thresholds for function durations.
More information about the llvm-commits
mailing list