Description
Hi developers, I try to leverage wasm-smith to generate random Wasm modules with the specified imports and exports. However, when passing the following Wasm module to the --available-imports
option, wasm-smith (commit 4355604) panicked:
thread 'main' panicked at crates/wasm-smith/src/core.rs:1309:37:
could not parse type section: BinaryReaderError { inner: BinaryReaderErrorInner { message: "gc proposal not supported", kind: Custom, offset: 11, needed_hint: None } }
note: run withRUST_BACKTRACE=1
environment variable to display a backtrace
(module
(rec
(type (sub final (array (mut i32))))
(type (sub final (func (param i32) (result i32))))
)
(import "a" "f1" (func (type 1)))
(import "a" "m1" (memory (;0;) 43153 57698))
)
The provided module itself is valid, thus I manually checked out the panicked location. As it turns out, the into_iter_err_on_gc_types()
public function of the wasmparser crate assumes each recursive group contains exactly one function type, which IMO makes no sense for wasm-smith since GC proposal is now standardized:
wasm-tools/crates/wasmparser/src/readers/core/types.rs
Lines 1952 to 1973 in 4355604
I think maybe we should update the related code logic for wasm-smith crate to better support the GC proposal? If you think this is appropriate but don't have time to implement these changes yet, I can submit a PR.