-
Notifications
You must be signed in to change notification settings - Fork 378
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
Fix alignment of fields for atomic accesses #761
Conversation
could alignas be used as well to make this more robust and explicit? |
I think the same thing as Unless there's a usage of Thanks! |
This seems to be true, but also, I now realise that these would actually work so long as instances included in containing structs are also declared as aligned. This would make the static asserts here redundant and document the intention explicitly. This sounds better. |
Now using |
Let's merge this and give it a try for 1 release. |
This reportedly breaks build with Clang on PowerPC (but not with GCC on PowerPC):
While I do not understand what causes Clang to require 8 byte alignment for these packed classes, it's probably not against the standard. Is there a reason not to use e.g.
here? |
Ah, there's a semantic difference between I wonder why clang for AArch64 didn't complain. |
Funny thing, 10 minutes before your answer I get a bug report of this failing also on FreeBSD / Aarch64 - could you provide me the compiler version and build flags of a successful build? Regarding correctness, I think that Microsoft seems to have a similar translation technology BTW, but I've never seen it in the wild. |
Ok, did an experiment with So I leave that be at the moment. |
Fix for issue #749.
Atomic accesses on AArch64 require atomically accessed fields to be naturally aligned. The packed structure layouts used on macOS to ensure than x86 and ARM processes can share memory breaks this constraint in some instances.
This change