bytecodealliance/cargo-wasi

wasm-opt raising validation errors about bulk memory operations in Rust 1.67

jeffcharles opened this issue · 0 comments

It looks like some Wasm modules produced by Rust 1.67 include memory.copy and memory.fill instructions. Unfortunately when wasm-opt is invoked by cargo wasi build --release, the --enable-bulk-memory flag is not passed to wasm-opt, so we see errors that look like:

[wasm-validator error in function 432] unexpected false: Bulk memory operations require bulk memory [--enable-bulk-memory], on

These errors appear on modules that wasm-opt is able to process without enabling bulk memory operations when compiled with Rust 1.66. Passing the --enable-bulk-memory flag to wasm-opt allows it to process these modules compiled by Rust 1.67 successfully.

If cargo-wasi were to pass that flag when invoking wasm-opt, that should result in these validation errors not surfacing when running cargo wasi build --release when using Rust 1.67.