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
Bad codegen with struct alignment and offsetof
#2346
Labels
Comments
We create the LLVM type wrong for We almost output things correctly, I seems. struct UInt {
align(2):
uint a;
}
struct Bug {
ubyte one;
UInt two;
} We output %agrsize.UInt = type { i32 }
%agrsize.Bug = type { i8, [1 x i8], %agrsize.UInt } (note that we already add the padding) %agrsize.UInt = type { i32 }
%agrsize.Bug = type <{ i8, [1 x i8], %agrsize.UInt }> (angled brackets to indicate packed type, and that we ourselves take care of the padding) |
I have a fix I think, PR is coming up shortly. |
kinke
added a commit
to kinke/ldc
that referenced
this issue
Sep 24, 2017
kinke
added a commit
to kinke/ldc
that referenced
this issue
Sep 24, 2017
I probably introduced this regression lately. Back then, I didn't account for container aggregates, which require that the LL struct is packed if the overall D aggregate alignment is lower than a field's natural alignment.
kinke
added a commit
to kinke/ldc
that referenced
this issue
Sep 27, 2017
I probably introduced this regression lately. Back then, I didn't account for container aggregates, which require that the LL struct is packed if the overall D aggregate alignment is lower than a field's natural alignment.
dnadlinger
pushed a commit
that referenced
this issue
Sep 28, 2017
I probably introduced this regression lately. Back then, I didn't account for container aggregates, which require that the LL struct is packed if the overall D aggregate alignment is lower than a field's natural alignment.
Fixed by #2347 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Although the exact alignment requirements are unclearThe exact alignment requirements are clear since 2.075 (see forum post: http://forum.dlang.org/post/vzvxkabifknrzffycjao@forum.dlang.org), the following code should not crash but does.
DMD runs the code fine.
The text was updated successfully, but these errors were encountered: