# bootstrap: work around GCC bug · gitcafe/zig

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

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

Visibility: public

Requested revision: b5ad3051f8115ed12366c47dc5d1216b8858a941

Requested commit: b5ad3051f8115ed12366c47dc5d1216b8858a941

Commit: b5ad3051f8115ed12366c47dc5d1216b8858a941

Tree: 0eb60b8cb4c0f70f686dbd5ab21f2840e1ebb739

Author: Matthew Lugg

Committer: Matthew Lugg

## Message

```
bootstrap: work around GCC bug

GCC bug 119085, which affects versions 13.0--15.1, is being triggered by
the C backend, resulting in a (small but critical) miscompilation in
zig2. Unfortunately, we can't really work around that bug without a
command-line flag, because the bug is sensitive to things like the order
in which `struct` types are defined.

Therefore, I have added an option to `bootstrap.c` which causes it to
pass the appropriate flag to `gcc` to disable the optimization pass in
question. This flag can likely be removed in future, once the affected
GCC versions become less common.

At least one of our x86_64-linux CI machines is using an affected GCC
version, so I also updated the relevant CI script to pass this flag when
testing no-LLVM bootstrap.

CMakeLists also has a workaround, but no user intervention is required
there: the GCC version range is automatically detected by CMakeLists.

```

## Parents

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

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