Followup from #31403.
// GCC versions 10.0--15.1 have a miscompilation where some bytes of a union may get clobbered
// depending on the union layout and the order in which types are defined. This miscompilation
// affects the output of the C backend, and thus can affect the bootstrap process. Specifically,
// we observe that using the self-hosted x86_64 backend in 'zig2' will cause all function calls
// to be relocated incorrectly, causing immediate crashes on any binary produced by it.
//
// The only reliable workaround for this bug is to disable the optimization pass containing it,
// so here we check for a CLI flag requesting that workaround.
//
// The upstream bug is fixed in GCC version 15.2 onwards (and was also backported to the 13 and
// 14 branches). Once this bug is no longer widespread, we can remove this CLI flag.
//
// Upstream bug report: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119085
bool workaround_gcc_sra_miscomp = false;
for (int i = 1; i < argc; ++i) {
if (!strcmp(argv[i], "--workaround-gcc-sra-miscomp")) {
workaround_gcc_sra_miscomp = true;
}
}
Instead of this, just check for the compiler and version range using the preprocessor, eliminating one footgun when building zig from source.
Followup from https://codeberg.org/ziglang/zig/pulls/31403.
```
// GCC versions 10.0--15.1 have a miscompilation where some bytes of a union may get clobbered
// depending on the union layout and the order in which types are defined. This miscompilation
// affects the output of the C backend, and thus can affect the bootstrap process. Specifically,
// we observe that using the self-hosted x86_64 backend in 'zig2' will cause all function calls
// to be relocated incorrectly, causing immediate crashes on any binary produced by it.
//
// The only reliable workaround for this bug is to disable the optimization pass containing it,
// so here we check for a CLI flag requesting that workaround.
//
// The upstream bug is fixed in GCC version 15.2 onwards (and was also backported to the 13 and
// 14 branches). Once this bug is no longer widespread, we can remove this CLI flag.
//
// Upstream bug report: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119085
bool workaround_gcc_sra_miscomp = false;
for (int i = 1; i < argc; ++i) {
if (!strcmp(argv[i], "--workaround-gcc-sra-miscomp")) {
workaround_gcc_sra_miscomp = true;
}
}
```
Instead of this, just check for the compiler and version range using the preprocessor, eliminating one footgun when building zig from source.