-
Notifications
You must be signed in to change notification settings - Fork 728
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
alignment of integer field holding bitfield values is not correct #111
Comments
Thanks for filling this, I have it in the radar, though I doubt it's so as easy as generating For example, Probably the easiest way to do this properly is to look at llvm's source. |
I'm looking into this right now since bindgenup in stylo is blocked on this now we check for field offsets. |
bors-servo
pushed a commit
that referenced
this issue
Feb 16, 2017
Rework how bitfields are handled. This fixes #111, and unblocks stylo. The problem with this as of right now is that it drops the accessors (though before that this code was buggy so I'm not sure it's a loss). I can probably try to re-implement those (though it'd be more complex). WDYT @fitzgen? Also, note that I changed the max_align_nonce because it was incorrect (we shouldn't generate padding, because `long double` was `128` bits).
bors-servo
pushed a commit
that referenced
this issue
Feb 16, 2017
Rework how bitfields are handled. This fixes #111, and unblocks stylo. The problem with this as of right now is that it drops the accessors (though before that this code was buggy so I'm not sure it's a loss). I can probably try to re-implement those (though it'd be more complex). WDYT @fitzgen? Also, note that I changed the max_align_nonce because it was incorrect (we shouldn't generate padding, because `long double` was `128` bits).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The use of a single integer-typed field to represent contiguous bitfield members results in layout that doesn't match the layout generated by the corresponding C++ struct. For example with:
I get an output of
3
when compiled with clang, but rust-bindgen generates:which places
y
at offset 4.Packing and alignment of bitfields is probably implementation dependent, but we should generate the same layout that clang does. It might just be a matter of generating a sequence of
u8
s to hold the contiguous bitfields.cc @emilio
The text was updated successfully, but these errors were encountered: