Closed
Description
Testing the new fuzzer's emitted binaries in wasm VMs, I see something odd. This module
(module
(memory $0 1 1)
(export "func_0" (func $func_0))
(func $func_0 (result f32)
(block $label$2 f32
(i32.trunc_u/f64
(unreachable)
)
)
)
)
won't load in sm or v8,
v8: CompileError: WebAssembly.Module(): Compiling WASM function #0: failed:: type error in merge[0] (expected f32, got i32) @+5
sm: CompileError: at offset 70: type mismatch: expression has type i32 but expected f32
It does work in wabt,
$ ./wasmdump -d a.wasm
a.wasm: file format wasm 0x00000d
Code Disassembly:
00003c func[0]:
000042: 02 7d | block f32
000044: 00 | unreachable
000045: ab | i32.trunc_u/f64
000046: 0b | end
(I manually changed the version to 0xd since that's what wabt required), and it works in binaryen. Who is wrong here?
It seems like it should be valid, the unreachable sets us into the mode where it's ok to pop anything, so the i32.trunc is ok and the block popping an f32 should be ok? Is this a case of undefined behavior in wasm type checking?
Metadata
Metadata
Assignees
Labels
No labels