Skip to content

Conversation

noclowns
Copy link
Contributor

@noclowns noclowns commented Aug 6, 2025

No behavioral change, but eliminates potential UB in strict-alignment systems.

The previous commit (#94171) bulk-updated alignment usage to C++23 spec, but missed this occurrence.

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.
@llvmbot
Copy link
Member

llvmbot commented Aug 6, 2025

@llvm/pr-subscribers-xray

Author: Slava Gurevich (noclowns)

Changes

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.


Full diff: https://github.com/llvm/llvm-project/pull/152408.diff

1 Files Affected:

  • (modified) compiler-rt/lib/xray/xray_fdr_logging.cpp (+1-1)
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.

Copy link
Member

@marcauberer marcauberer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@llvm llvm deleted a comment from github-actions bot Aug 8, 2025
@noclowns noclowns merged commit 0f59b8d into llvm:main Aug 8, 2025
9 checks passed
@noclowns noclowns deleted the fix-alignment branch August 8, 2025 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants