Meeting proposal: When accessing a field that is at a "very aligned" offset, can the required alignment be higher than the type of the field indicates? #11
Labels
meeting-proposal
Proposal for a discussion topic at a team meeting
Summary
Sometimes when accessing a field, the alignment requirement is lower than the type of the field might indicate: specifically, this happens for fields of
repr(packed)
structs.Can the alignment requirement ever be higher? For instance, in this type
the
x
field will always be at a 4-aligned address when occurring inside a well-alignedS
instance. Therefore, Miri will make(*ptr).x
UB if that load is not 4-aligned. This matches codegen which generates analign 4
load in this example.Is that what we want, or should the alignment requirements of a field access in a struct always be upper-bounded by the alignment of that field?
Reading
https://hackmd.io/rCcTOjQ4SnOb9I2Zt8SqZQ
Comment policy
These issues are meant to be used as an "announcements channel" regarding the proposal, and not as a
place to discuss the technical details. Feel free to subscribe to updates. We'll post comments when
reviewing the proposal in meetings or making a scheduling decision. In the meantime, if you have
questions or ideas, ping the proposers on Zulip (or elsewhere).
The text was updated successfully, but these errors were encountered: