Closed as duplicate of#141048
Closed as duplicate of#141048
Description
Code
I made a minimal reproduction here:
https://github.com/printfn/repro/tree/rust-wasm-bulk-memory
I expected to see this happen:
It should build with wasm-pack build
Instead, this happened:
I got an error in wasm-opt
: unexpected false: Bulk memory operations require bulk memory [--enable-bulk-memory], on
It looks like this happened because of the LLVM 20 update (#135763).
Full build output
[INFO]: 🎯 Checking for the Wasm target...
[INFO]: 🌀 Compiling to Wasm...
Compiling proc-macro2 v1.0.95
Compiling unicode-ident v1.0.18
Compiling wasm-bindgen-shared v0.2.100
Compiling log v0.4.27
Compiling bumpalo v3.17.0
Compiling rustversion v1.0.20
Compiling wasm-bindgen v0.2.100
Compiling cfg-if v1.0.0
Compiling once_cell v1.21.3
Compiling quote v1.0.40
Compiling syn v2.0.101
Compiling wasm-bindgen-backend v0.2.100
Compiling wasm-bindgen-macro-support v0.2.100
Compiling wasm-bindgen-macro v0.2.100
Compiling repro v0.1.0 (/home/user/Code/repro)
Finished `release` profile [optimized] target(s) in 2.32s
[INFO]: ⬇️ Installing wasm-bindgen...
[INFO]: Optimizing wasm binaries with `wasm-opt`...
[wasm-validator error in function 2] unexpected false: Bulk memory operations require bulk memory [--enable-bulk-memory], on
(memory.copy
(local.get $1)
(local.get $0)
(local.get $3)
)
[wasm-validator error in function 2] unexpected false: Bulk memory operations require bulk memory [--enable-bulk-memory], on
(memory.copy
(local.get $2)
(local.get $0)
(local.get $3)
)
[wasm-validator error in function 10] unexpected false: Bulk memory operations require bulk memory [--enable-bulk-memory], on
(memory.copy
(i32.add
(i32.load offset=4
(local.get $0)
)
(local.get $3)
)
(i32.add
(local.get $2)
(i32.const 12)
)
(local.get $1)
)
[wasm-validator error in function 27] unexpected false: Bulk memory operations require bulk memory [--enable-bulk-memory], on
(memory.copy
(i32.add
(i32.load offset=4
(local.get $0)
)
(local.get $3)
)
(local.get $1)
(local.get $2)
)
Fatal: error validating input
Error: failed to execute `wasm-opt`: exited with exit status: 1
full command: "/home/user/.cache/.wasm-pack/wasm-opt-1ceaaea8b7b5f7e0/bin/wasm-opt" "/home/user/Code/repro/pkg/repro_bg.wasm" "-o" "/home/user/Code/repro/pkg/repro_bg.wasm-opt.wasm" "-Oz"
To disable `wasm-opt`, add `wasm-opt = false` to your package metadata in your `Cargo.toml`.
Caused by: failed to execute `wasm-opt`: exited with exit status: 1
full command: "/home/user/.cache/.wasm-pack/wasm-opt-1ceaaea8b7b5f7e0/bin/wasm-opt" "/home/user/Code/repro/pkg/repro_bg.wasm" "-o" "/home/user/Code/repro/pkg/repro_bg.wasm-opt.wasm" "-Oz"
To disable `wasm-opt`, add `wasm-opt = false` to your package metadata in your `Cargo.toml`.
Version it worked on
It most recently worked on: 1.86.0
Version with regression
rustc --version --verbose
:
rustc 1.87.0 (17067e9ac 2025-05-09)
binary: rustc
commit-hash: 17067e9ac6d7ecb70e50f92c1944e545188d2359
commit-date: 2025-05-09
host: x86_64-unknown-linux-gnu
release: 1.87.0
LLVM version: 20.1.1
searched nightlies: from nightly-2025-02-15 to nightly-2025-03-29
regressed nightly: nightly-2025-02-18
searched commit range: 5bc6231...ce36a96
regressed commit: ce36a96
bisected with cargo-bisect-rustc v0.6.9
Host triple: x86_64-unknown-linux-gnu
Reproduce with:
cargo bisect-rustc --start=1.86.0 --end=1.87.0 --prompt --target=wasm32-unknown-unknown --script=./script.sh