Repository navigation
don't inhibit random field reordering on repr(packed(1)) - #125360
Merged
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
inhibit_struct_field_reordering_optbeing false means we exclude this type from random field shuffling. However,packed(1)types can still be shuffled! The logic was added in #48528 since it's pointless to reorder fields in packed(1) types (there's no padding that could be saved) -- but that shouldn't inhibit-Zrandomize-layout(which did not exist at the time).We could add an optimization elsewhere to not bother sorting the fields for
repr(packed)types, but I don't think that's worth the effort.This does change the behavior in that we may now reorder fields of
packed(1)structs (e.g. if there are niches, we'll try to move them to the start/end, according toNicheBias). We were always allowed to do that but so far we didn't. Quoting the reference: