# stage1: Fix several bugs in constant generation · gitcafe/zig

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

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

Visibility: public

Requested revision: 8e96922f3118601dd30da23ba7db1440066784ab

Requested commit: 8e96922f3118601dd30da23ba7db1440066784ab

Commit: 8e96922f3118601dd30da23ba7db1440066784ab

Tree: a47f640736e0be09a452e1d90bc64997f7794767

Author: LemonBoy

Committer: Andrew Kelley

## Message

```
stage1: Fix several bugs in constant generation

The codegen would sometimes change the LLVM type for some constants to
an unnamed structure in order to accomodate extra padding. This is fine
as long as the alignment of each field is still respected and it was not
the case for structure types, leading to ill-formed constants being
generated.

Optional types suffer from this to a lower extent as their layout is
quite lucky, the only missing piece was the tail padding.

Closes #4530
Closes #4594
Closes #4295
Closes my will to live

```

## Parents

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

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