Closed fitzgen closed 7 months ago
If in doubt, try the reference interpreter? ;)
I just did, and it agrees with Firefox and wasmparser. Your analysis sounds correct as well.
Thanks for the reply, and thanks for checking with the reference interpreter, I should reach for it more often.
Will close this issue and open one in Binaryen.
Context: I'm in the process of adding GC support to
wasm-smith
and hammering out the bugs inwasmparser
's GC validation.Firefox claims it is not valid with "type mismatch: expression has type (ref any) but expected eqref" on the
br_on_non_null
instruction. FWIW,wasmparser
claims the same, but I don't trust it that much yet.Binaryen, on the other hand, claims that this is valid.
I've annotated the disassembly with the types on the stack up until the
br_on_non_null
instruction.I think the disagreement comes down to the interpretation of the
br_on_cast
just before. If I understand correctly, it should be typed[externref eqref] -> [externref (ref any)]
becausediff(anyref, arrayref) = (ref any)
. It seems like binaryen might be incorrectly leaving theeqref
instead of computing the diff? (And also I must be doing the same thing inwasm-smith
) But I'd appreciate confirmation / a second pair of eyes on this. Thanks!cc @tlively @eqrion