Open gcoakes opened 2 years ago
I realized it wasn't terrible obvious... The miscompilation is the second call $readString
in the foo function. It should be call $__createElement
and have an import for that function.
The .functype
in the module level assembly has the wrong symbol in my original code. Correcting it, causes a segfault. Maybe related to #13129.
Either way, it seems to be a miscompilation that it changed the unknown symbol __createElement
into a reference to the readString
function.
This seems like an LLVM assembler bug? A reduction should probably be filed upstream.
Zig Version
b316c25cc6f5b1703d7912da16c5c987f4406451
Steps to Reproduce
zig build-lib main.zig -OReleaseSmall -dynamic -target wasm32-freestanding -mcpu=generic+reference_types
:Expected Behavior
Created by modifying the actual behavior to resemble the expected behavior:
Actual Behavior
Generated via wabt's
wasm2wat --no-check main.wasm
: