wasm linker lowers undefined and 0 incorrectly with respect to the bss section #14834
Labels
arch-wasm
32-bit and 64-bit WebAssembly
bug
Observed behavior contradicts documented or intended behavior
linking
miscompilation
The compiler reports success but produces semantically incorrect code.
Milestone
Zig Version
0.11.0-dev.1898+36d47dd19
Steps to Reproduce and Observed Behavior
This test case is incorrect: https://github.com/ziglang/zig/blob/36d47dd1991f0ccd7a9673075624f09500cc415e/test/link/wasm/bss/build.zig
The global variable has value
undefined
:zig/test/link/wasm/bss/lib.zig
Line 1 in 36d47dd
So it should not go into the bss section in debug mode.
Furthermore, when I change the value to
0
it should definitely go into bss, however in this case the test fails.Expected Behavior
Zig is technically allowed to lower
undefined
in any way it wants to, however the linker test can test the actual behavior of the linker. It should do the following forundefined
:For zero values, it must lower to bss.
cc @Luukdegram and @kubkon
The text was updated successfully, but these errors were encountered: