-
-
Notifications
You must be signed in to change notification settings - Fork 264
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
align() not respected for local variable declarations #1154
Comments
|
Seems to work for struct fields only: struct Struct { align(16) int[2] a; }=> struct is padded to a size of 16 bytes, and gets properly aligned on stack: %align.Struct = type { [2 x i32], [8 x i8] }
%s = alloca %align.Struct, align 16 ; [#uses = 1, size/byte = 16]Struct itself: align(16) struct Struct { int[2] a; }=> struct is padded to 16 bytes too, but alignment = 4: %s = alloca %align.Struct, align 4 ; [#uses = 1, size/byte = 16]A local variable Edit: Edit 2: |
|
I'll work on the nested context issue tomorrow. I'll probably come up with an |
|
The issue wrt. the |
|
The original test case is fixed by #1159. What still needs to be fixed is the alignment of local variables. |
|
@kinke: Your testcase at https://github.com/ldc-developers/ldc/blob/61dd702b4909f08f4386862707b5b05bc894bfef/tests/ir/align.d already seems to check for at least some cases of local variables, though? |
|
That's true, but that's only because of the type's explicit/implicit alignment. Explicit alignments for locals, i.e., something like |
|
Ah, I see, thanks. |
|
http://goo.gl/ikkwvc |
|
@Temtaime: Could you please open separate enhancement requests for missed optimization opportunities? This bug report is about alignment not respected for variables, which is incorrect code, as opposed to just suboptimal code. |
|
Okay, let's close this, as all of this + some more is checked by https://github.com/ldc-developers/ldc/blob/master/tests/ir/align.d now. Exception: aligned captured variables in nested context structs, which is fixed but not tested yet. |
This application
asserts because variable
some_bufis onlyalign(8), notalign(16).The text was updated successfully, but these errors were encountered: