For the following function
(func $return-nop (return (nop))) (https://github.com/WebAssembly/testsuite/blob/master/functions.wast)
There is a conflict between the function type and return arity.
The type of the function is
; type 0
000000f: 40 ; function form
0000010: 00 ; num params
0000011: 00 ; num results
And the function body is the following
; function body 6
00001a0: 00 ; func body size (guess)
00001a1: 00 ; local decl count
00001a2: 00 ; OPCODE_NOP
00001a3: 09 ; OPCODE_RETURN
00001a4: 01 ; return arity
00001a0: 04 ; FIXUP func body size
Since nop is: an empty operator that does not yield a value
then the arity of the return statement should be 0 thus having a valid type.
I found this by running the tests, I am surprised this didn't come up in the CI
For the following function
(func $return-nop (return (nop)))(https://github.com/WebAssembly/testsuite/blob/master/functions.wast)There is a conflict between the function type and return arity.
The type of the function is
And the function body is the following
Since
nopis: an empty operator that does not yield a valuethen the arity of the return statement should be 0 thus having a valid type.
I found this by running the tests, I am surprised this didn't come up in the CI