You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Parse Exception with Block Type But WABT Successfully Parses It #5951
The issue is probably the same as in #5950 - Binaryen does not support multivalue input params to control flow structures (here, block (param i32)). Unfortunately it seems we don't have an error on this atm.
The issue is probably the same as in #5950 - Binaryen does not support multivalue input params to control flow structures (here, block (param i32)). Unfortunately it seems we don't have an error on this atm.
Thanks for your kind response, kripken. Sorry to bother but I have two more questions that I'm not sure:
Does Binaryen not support table.init, elem.drop, table.copy, table.fill yet? Because I witnessed similar parse errors when dealing with these instructions.
The following wat file works just fine with WABT's wat2wasm and wasm2wat, however, when I convert it into wasm binary form using wat2wasm and later use wasm-dis to parse it, error occurs:
$ cat test.wat
(module
(type(;0;) (func))
(func(;0;) (type0))
(func(;1;) (type0))
(table(;0;)10funcref)
(elem(;53;)declarefunc)
(elem(;54;)declarefuncref (ref.func0) (ref.func0) (ref.nullfunc) (ref.func1))
(elem(;55;)declarefunc)
(elem(;56;)declarefunc0011)
(elem(;57;)declarefunc)
(elem(;58;)declarefuncref (ref.func0) (ref.func0) (ref.nullfunc) (ref.func1))
(elem(;59;)declarefunc)
(elem(;60;)declarefunc0011)
)
$ wat2wasm test.wat -o test.wasm
$ wasm-dis test.wasm --debug
<==
getInt8: 208 (at 40)
getInt8: 112 (at 41)
getU32LEB: 14416 ==>
== processExpressions
zz recurse into 1 at 42
getInt8: 11 (at 42)
readExpression seeing 11
zz recurse from 1 at 43
== processExpressions finished
[parse exception: expected to read a single expression (at 0:43)]
Fatal: error parsing wasm. here is what we read up to the error:
(module
(table$010funcref)
)
It seems there is something wrong with second declarative element and parsing has a error near ref.null func, why?
Does Binaryen not support table.init, elem.drop, table.copy, table.fill yet? Because I witnessed similar parse errors when dealing with these instructions.
@tlively just implemented table.fill: #5949 Those others might not be implemented yet, but it sounds like you need them?
I'm not sure what's going on with that elem issue, but perhaps that's a recent change to the binary format? cc @tlively
Does Binaryen not support table.init, elem.drop, table.copy, table.fill yet? Because I witnessed similar parse errors when dealing with these instructions.
@tlively just implemented table.fill: #5949 Those others might not be implemented yet, but it sounds like you need them?
I'm not sure what's going on with that elem issue, but perhaps that's a recent change to the binary format? cc @tlively
Thanks again, kripken. Actually the above examples are extracted from WebAssembly's Core Specification TestSuites and I just want to use them as the seed corpus for fuzzing. So it's not a big deal if Binaryen currently doesn't support some of the instructions since I can remove related modules. :)
Could be that we don't yet implement table initializers: #5628
Hey tlively, thanks for your response, I'm wondering why it's related to table initializers since the parse error doesn't give me much information, is it convenient for you to explain it again?
Hmm, I guess you're right that the error isn't related to table initializers since that example doesn't have any table initializers, but it seems that we're similarly missing support for something to do with element segments. Clearly our support is very patchy in this area.
I hope that soon we will be able to run the full upstream spec test suite in Binaryen, which will help uncover this kind of bug.
Hmm, I guess you're right that the error isn't related to table initializers since that example doesn't have any table initializers, but it seems that we're similarly missing support for something to do with element segments. Clearly our support is very patchy in this area.
I hope that soon we will be able to run the full upstream spec test suite in Binaryen, which will help uncover this kind of bug.
Thanks for your kind reply and hope Binaryen would get better in the future :)
We now support parsing block parameters, so the original issue here is solved. The only bulk table instruction we still don't support is elem.drop, but I filed a dedicated issue to track that here: #7209.
Activity
redianthus commentedon Sep 18, 2023
FYI this is accepted by the reference interpreter and by Owi.
kripken commentedon Sep 18, 2023
The issue is probably the same as in #5950 - Binaryen does not support multivalue input params to control flow structures (here,
block (param i32)). Unfortunately it seems we don't have an error on this atm.mobsceneZ commentedon Sep 19, 2023
Thanks for your kind response, kripken. Sorry to bother but I have two more questions that I'm not sure:
wat2wasmandwasm2wat, however, when I convert it into wasm binary form usingwat2wasmand later usewasm-disto parse it, error occurs:It seems there is something wrong with second declarative element and parsing has a error near
ref.null func, why?kripken commentedon Sep 19, 2023
@tlively just implemented
table.fill: #5949 Those others might not be implemented yet, but it sounds like you need them?I'm not sure what's going on with that
elemissue, but perhaps that's a recent change to the binary format? cc @tlivelytlively commentedon Sep 19, 2023
Could be that we don't yet implement table initializers: #5628
mobsceneZ commentedon Sep 20, 2023
Thanks again, kripken. Actually the above examples are extracted from WebAssembly's Core Specification TestSuites and I just want to use them as the seed corpus for fuzzing. So it's not a big deal if Binaryen currently doesn't support some of the instructions since I can remove related modules. :)
Hey tlively, thanks for your response, I'm wondering why it's related to table initializers since the parse error doesn't give me much information, is it convenient for you to explain it again?
tlively commentedon Sep 20, 2023
Hmm, I guess you're right that the error isn't related to table initializers since that example doesn't have any table initializers, but it seems that we're similarly missing support for something to do with element segments. Clearly our support is very patchy in this area.
I hope that soon we will be able to run the full upstream spec test suite in Binaryen, which will help uncover this kind of bug.
mobsceneZ commentedon Sep 20, 2023
Thanks for your kind reply and hope Binaryen would get better in the future :)
kripken commentedon Nov 2, 2023
Table.copy is added in #6078
Implement table.copy (#6078)
Implement table.copy (WebAssembly#6078)
kripken commentedon Aug 8, 2024
table.initis added in #6827tlively commentedon Jan 11, 2025
We now support parsing block parameters, so the original issue here is solved. The only bulk table instruction we still don't support is
elem.drop, but I filed a dedicated issue to track that here: #7209.