mirror of
https://github.com/deepseek-ai/3FS.git
synced 2026-11-05 00:47:47 +00:00
[PR #393] [MERGED] Fix strict aliasing violations in Address #408
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
deepseek-ai/3FS#408
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/deepseek-ai/3FS/pull/393
Author: @qieqieplus
Created: 1/24/2026
Status: ✅ Merged
Merged: 1/24/2026
Merged by: @SF-Zhou
Base:
main← Head:main📝 Commits (1)
8934f9bFix strict aliasing violations in Address📊 Changes
1 file changed (+18 additions, -20 deletions)
View changed files
📝
src/common/utils/Address.h(+18 -20)📄 Description
Replaced reinterpret_cast with std::bit_cast.
The previous implementation used reinterpret_cast to treat the Address struct as a uint64_t or an array of bytes.
Which could effectively work but violate C++ strict aliasing rules.
With C++20, these low-level bitwise reinterpretations could be safely performed via std::bit_cast.
While std::bit_cast is conceptually std::memcpy underhood, but it could be optimzed by compilers in many cases.
The compiler generates identical assembly code for simple cases:
https://godbolt.org/z/d7j5YYKcj
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.