-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
AIX repr(C) struct layout does not always match C compiler #151910
Copy link
Copy link
Open
Labels
A-reprArea: the `#[repr(stuff)]` attributeArea: the `#[repr(stuff)]` attributeO-aixOS: Big Blue's Advanced Interactive eXecutive..OS: Big Blue's Advanced Interactive eXecutive..T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-reprArea: the `#[repr(stuff)]` attributeArea: the `#[repr(stuff)]` attributeO-aixOS: Big Blue's Advanced Interactive eXecutive..OS: Big Blue's Advanced Interactive eXecutive..T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
The layout rules for the
f64type on AIX are very special, and we do not always correctly implement them. #149880 improved the situation, but to my knowledge some cases are still wrong. @workingjubilee please correct be if I am wrong.Our current best understanding of the rather confusingly-written documentation for this is that
f64generally only has an alignment requirement of 4f64fields will be 8-aligned (and possibly this also affects fields of struct types where the struct containsf64)In particular, we currently compute the wrong layout for this type:
The size should be 16, but it is 12.
Another one (with the comments indicating what the layout should be):
Currently we compute the same offsets but we give the type a size of 20.
This can't be fully fixed on the Rust side without something like rust-lang/rfcs#3845 to resolve the conflict between the platform C layout and using the standard layout algorithm that repr(C) uses everywhere else.