wasm miscompilation without LLVM: can modify const value #22617
Labels
arch-wasm
32-bit and 64-bit WebAssembly
backend-self-hosted
bug
Observed behavior contradicts documented or intended behavior
miscompilation
The compiler reports success but produces semantically incorrect code.
Milestone
Zig Version
0.14.0-dev.2647+5322459a0
Steps to Reproduce and Observed Behavior
Create an array of
Foo
(a struct with a singleusize
field), take the first element as aconst
value, and then modify the array. Theconst
element has changed!main.zig:
build.zig:
zig build run -Dllmv=false
outputs, on my machine, "0 1"(note that the
run
is provided only for convenience and requiresnode
installed; feel free to run the .wasm in any other way.)Expected Behavior
The output should be "0 0", and in fact that's what we see when running
zig build run -Dllmv=true
.I've also tried on
0.14.0-dev.2851+b074fb7dd
but I can't get it working there; it fails onWebAssembly.instantiate()
The text was updated successfully, but these errors were encountered: