[compiler-rt] 0f59b8d - Fix improper alignment of static buffer for placement-new of BufferQueue (#152408)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 8 09:36:25 PDT 2025
Author: Slava Gurevich
Date: 2025-08-08T09:36:22-07:00
New Revision: 0f59b8d4e3f8081c69b46f4693536e118fc0e9e6
URL: https://github.com/llvm/llvm-project/commit/0f59b8d4e3f8081c69b46f4693536e118fc0e9e6
DIFF: https://github.com/llvm/llvm-project/commit/0f59b8d4e3f8081c69b46f4693536e118fc0e9e6.diff
LOG: Fix improper alignment of static buffer for placement-new of BufferQueue (#152408)
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.
Added:
Modified:
compiler-rt/lib/xray/xray_fdr_logging.cpp
Removed:
################################################################################
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