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

codegen: fix field offsets in packed structs #17375

Merged
merged 2 commits into from
Oct 3, 2023

Conversation

xxxbxxx
Copy link
Contributor

@xxxbxxx xxxbxxx commented Oct 2, 2023

  • add nested packed struct/union behavior tests
  • use ptr_info.packed_offset rather than trying to duplicate the logic from Sema.structFieldPtrByIndex()
  • use the container_ptr_info.packed_offset to account for non-aligned nested structs.
  • dedup type.packedStructFieldBitOffset() and module.structPackedFieldBitOffset()

resolves #16615 and #16621 (probably, there's no reproducer)
resolves #16748
resolves #14632

it's an other attempt from #16657

@travisstaloch
Copy link
Contributor

seems like this might also address #14632?

 * add nested packed struct/union behavior tests
 * use ptr_info.packed_offset rather than trying to duplicate the logic from Sema.structFieldPtrByIndex()
 * use the container_ptr_info.packed_offset to account for non-aligned nested structs.
 * dedup type.packedStructFieldBitOffset() and module.structPackedFieldBitOffset()
@xxxbxxx
Copy link
Contributor Author

xxxbxxx commented Oct 3, 2023

seems like this might also address #14632?

now it does...

@andrewrk
Copy link
Member

andrewrk commented Oct 3, 2023

Thanks for refreshing the PR, I'll have a look at this tomorrow 👍

@andrewrk
Copy link
Member

andrewrk commented Oct 3, 2023

This code looks great and thank you for for the additional test coverage.

@andrewrk andrewrk merged commit 5c3393d into ziglang:master Oct 3, 2023
@xxxbxxx xxxbxxx deleted the packed-struct branch October 8, 2023 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants