Skip to content
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

Fix inconsistent base padding #265

Merged
merged 1 commit into from
Oct 21, 2024
Merged

Conversation

DutChen18
Copy link
Member

When inlining fields of a direct base class, extra padding would sometimes be added to ensure fields in the derived class are at the same offset as they are in the base class, even if one is packed and the other isn't.

While this extra padding makes sure that fields end up at the same byte offset, the extra padding fields do shift the index of some fields. The ComputeNonVirtualBaseClassGepPath function in CGClass.cpp did not properly take into account the possibility these fields having a different index when inlined into a derived class.

This is fixed by also adding base classes of the direct base of a derived class into the derived class' NonVirtualBases map.

When inlining fields of a direct base class, extra padding would
sometimes be added to ensure fields in the derived class are at the same
offset as they are in the base class, even if one is packed and the
other isn't.

While this extra padding makes sure that fields end up at the same byte
offset, the extra padding fields do shift the index of some fields. The
`ComputeNonVirtualBaseClassGepPath` function in `CGClass.cpp` did not
properly take into account the possibility these fields having a
different index when inlined into a derived class.

This is fixed by also adding base classes of the direct base of a
derived class into the derived class' `NonVirtualBases` map.
@DutChen18 DutChen18 requested a review from yuri91 October 21, 2024 12:13
@yuri91 yuri91 merged commit 7e48864 into master Oct 21, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants