mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-04-26 13:01:34 +03:00
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.
This commit is contained in:
@@ -21,7 +21,8 @@ export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
|
||||
|
||||
# Test building from source without LLVM.
|
||||
cc -o bootstrap bootstrap.c
|
||||
./bootstrap
|
||||
# See comments in bootstrap.c for an explanation of the flag given here.
|
||||
./bootstrap --workaround-gcc-sra-miscomp
|
||||
./zig2 build -Dno-lib
|
||||
./zig-out/bin/zig test test/behavior.zig
|
||||
|
||||
|
||||
Reference in New Issue
Block a user