Skip to content

wasm-opt fails on 1.87 with "Bulk memory operations require bulk memory" #141080

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
printfn opened this issue May 16, 2025 · 2 comments
Closed

wasm-opt fails on 1.87 with "Bulk memory operations require bulk memory" #141080

printfn opened this issue May 16, 2025 · 2 comments
Labels
O-wasm Target: WASM (WebAssembly), http://webassembly.org/ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@printfn
Copy link
Contributor

printfn commented May 16, 2025

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 
@printfn printfn added C-bug Category: This is a bug. regression-untriaged Untriaged performance or correctness regression. labels May 16, 2025
@rustbot rustbot added I-prioritize Issue: Indicates that prioritization has been requested for this issue. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels May 16, 2025
@workingjubilee
Copy link
Member

We do not own wasm-pack so it is not actually guaranteed to work with our toolchain.

@workingjubilee
Copy link
Member

See https://github.com/WebAssembly/tool-conventions/issues if you wish to discuss with the people who decide when LLVM should update its default features, otherwise this is a duplicate.

@saethlin saethlin added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. O-wasm Target: WASM (WebAssembly), http://webassembly.org/ and removed C-bug Category: This is a bug. I-prioritize Issue: Indicates that prioritization has been requested for this issue. regression-untriaged Untriaged performance or correctness regression. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels May 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-wasm Target: WASM (WebAssembly), http://webassembly.org/ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants