mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-10-28 10:45:48 +08:00
bootstrap: disable strict aliasing
The C backend has always gleefully violated C's strict aliasing rules, and I just got bitten by it for the first time when bootstrapping on macOS. This probably hasn't been helping with some of the weird bootstrap-related CI failures we've seen. So, update `bootstrap.c` and `CMakeLists.txt` to tell GCC/Clang to disable type-based alias analysis. No change is needed to the MSVC flags because MSVC does not, and never has, implemented TBAA.
This commit is contained in:
2 files changed
+4
-3
No files matched your search
+2
-1
@@ -136,7 +136,7 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
{
|
||||
const char *child_argv[] = {
|
||||
cc, "-o", "zig1", "zig1.c", "stage1/wasi.c", "-std=c99", "-Os", "-lm", NULL,
|
||||
cc, "-o", "zig1", "zig1.c", "stage1/wasi.c", "-std=c99", "-Os", "-fno-strict-aliasing", "-lm", NULL,
|
||||
};
|
||||
print_and_run(child_argv);
|
||||
}
|
||||
@@ -213,6 +213,7 @@ int main(int argc, char **argv) {
|
||||
#if defined(__GNUC__)
|
||||
"-pthread",
|
||||
#endif
|
||||
"-fno-strict-aliasing",
|
||||
workaround_gcc_sra_miscomp ? "-fno-tree-sra" : NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user