# codegen: fix access to byte-aligned nested packed struct elems · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/8c367ef99aae05ddba800a6c01cb07677e2f512c)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 8c367ef99aae05ddba800a6c01cb07677e2f512c

Requested commit: 8c367ef99aae05ddba800a6c01cb07677e2f512c

Commit: 8c367ef99aae05ddba800a6c01cb07677e2f512c

Tree: a9fecf3efe8e4ed6285f4de7d11ad02edb86e3d1

Author: Xavier Bouchoux

Committer: Xavier Bouchoux

## Message

```
codegen: fix access to byte-aligned nested packed struct elems

When acessing a packed struct member via a byte aligned ptr (from the optimisation in Sema.structFieldPtrByIndex())
the codegen must apply the parent ptr packed_offset in addition to the field offset itself.

resolves https://github.com/ziglang/zig/issues/16609

```

## Parents

- [46abf2045476a32b6f4dd939679c0fbc7a639133](https://git.cafe/gitcafe/zig/commit/46abf2045476a32b6f4dd939679c0fbc7a639133?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/8c367ef99aae05ddba800a6c01cb07677e2f512c?format=markdown)
