diff --git a/CMakeLists.txt b/CMakeLists.txt index 146e507930706d8d779ce6a3977b39d7f9d9b78c..af1f64bd83e317f91670a19b3a95113639f59193 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -608,8 +608,8 @@ if(MSVC) set(ZIG2_LINK_FLAGS "/STACK:16777216 /FORCE:MULTIPLE") else() set(ZIG_WASM2C_COMPILE_FLAGS "-std=c99 -O2") - set(ZIG1_COMPILE_FLAGS "-std=c99 -Os") - set(ZIG2_COMPILE_FLAGS "-std=c99 -O0 -fno-sanitize=undefined -fno-stack-protector") + set(ZIG1_COMPILE_FLAGS "-std=c99 -Os -fno-strict-aliasing") + set(ZIG2_COMPILE_FLAGS "-std=c99 -O0 -fno-sanitize=undefined -fno-stack-protector -fno-strict-aliasing") # Must match the condition in build.zig. if(ZIG_HOST_TARGET_ARCH MATCHES "^(arm|thumb)(eb)?$" OR ZIG_HOST_TARGET_ARCH MATCHES "^powerpc(64)?(le)?$") set(ZIG1_COMPILE_FLAGS "${ZIG1_COMPILE_FLAGS} -ffunction-sections -fdata-sections") diff --git a/bootstrap.c b/bootstrap.c index 329a1af10e5d9c4c61d5dc851587c1d80c0e0aa5..ad4ccec54a67fd3b94f880d0669be25303afd14f 100644 --- a/bootstrap.c +++ b/bootstrap.c @@ -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, };