-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correct alignment of atomic types and (re)add Atomic{I,U}128 #55410
Conversation
LLVM requires that atomic loads and stores be aligned to at least the size of the type.
@@ -147,6 +148,9 @@ unsafe impl Sync for AtomicBool {} | |||
/// This type has the same in-memory representation as a `*mut T`. | |||
#[cfg(target_has_atomic = "ptr")] | |||
#[stable(feature = "rust1", since = "1.0.0")] | |||
#[cfg_attr(target_pointer_width = "16", repr(C, align(2)))] | |||
#[cfg_attr(target_pointer_width = "32", repr(C, align(4)))] | |||
#[cfg_attr(target_pointer_width = "64", repr(C, align(8)))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this not use the ptr_width!
defined below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, not directly.
Thanks for taking this. I think it would be worth explicitly documenting what |
@ollie27 the documentation already says "this type has the same memory representation as the underlying type X". On one hand, it is already documented, on the other hand one could confuse this statement for saying that it also has the same ABI semantics… hmm. |
@bors r+ |
📌 Commit 5e50acf has been approved by |
⌛ Testing commit 5e50acf with merge 87861469c736fa6dd73508ff7f9da69485239354... |
💔 Test failed - status-travis |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
Ah, that's my mistake. I never actually tested this on macOS. It looks like |
@bors r=pnkfelix |
📌 Commit afd8e4c8ad3a05ec13ecb810739bad77c3ba1923 has been approved by |
⌛ Testing commit afd8e4c8ad3a05ec13ecb810739bad77c3ba1923 with merge a827be09bf7ffa62c1a7bda3178726197aff7788... |
💔 Test failed - status-travis |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
@bors r=pnkfelix Missed a location for |
📌 Commit 99f7dc4 has been approved by |
Correct alignment of atomic types and (re)add Atomic{I,U}128 This is a updated #53514 to also make atomic types `repr(C)` as per comment in #53514 (comment). Fixes #39590 Closes #53514 r? @pnkfelix
☀️ Test successful - status-appveyor, status-travis |
This is a updated #53514 to also make atomic types
repr(C)
as per comment in #53514 (comment).Fixes #39590
Closes #53514
r? @pnkfelix