- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 266
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
Assume alignment when loading from pointer #3562
Comments
Related: https://forum.dlang.org/thread/xntxnthytvnxdmhkerrj@forum.dlang.org would greatly appreciate your input! |
My interpretation is that a pointer of type T does not always have to be aligned. But when you dereference the pointer (e.g. read or write), then it has to be aligned. |
Is there a transition path though? |
Yes, this is already UB. In practice, the code will just crash on, say, some ARM architectures that do not support unaligned access in general. |
related: #4236 |
As far as I know, unaligned memory access is UB in D. We don't yet make use of this in all cases.
creates the IR:
Note that
align 4
instead ofalign 64
. (Thealign 4
is actually deduced by LLVM (loading ani32
), and not emitted by LDC.)I think we can be aggressive here and emit
align 64
.Clang does that too.
The text was updated successfully, but these errors were encountered: