Skip to content

nightly-2025-02-18 wasm-opt cannot process resulting binary #137315

Closed
@Ddystopia

Description

@Ddystopia

I bisected by hand and at nightly-2025-02-18 wasm-opt started giving errors like this:

...
[wasm-validator error in function 2590] unexpected false: Bulk memory operations require bulk memory [--enable-bulk-memory], on
(memory.copy
 (local.get $0)
 (i32.add
  (local.get $4)
  (i32.const 8)
 )
 (i32.const 40)
)
[wasm-validator error in function 2621] unexpected false: Bulk memory operations require bulk memory [--enable-bulk-memory], on
(memory.copy
 (i32.add
  (local.get $2)
  (i32.shl
   (local.get $8)
   (i32.const 2)
  )
 )
 (i32.add
  (local.get $2)
  (i32.shl
   (local.get $0)
   (i32.const 2)
  )
 )
 (local.get $5)
)
...

It asks for --enable-bulk-memory, if give it to it, other errors reveal (this is the whole output):

> wasm-opt -Oz project.wasm -o new.wasm --enable-bulk-memory
[wasm-validator error in function 520] unexpected false: all used features should be allowed, on
(i32.trunc_sat_f32_s
 (f32.mul
  (local.get $13)
  (f32.const 20)
 )
)
[wasm-validator error in function 520] unexpected false: all used features should be allowed, on
(i32.trunc_sat_f32_u
 (local.tee $13
  (f32.add
   (local.get $13)
   (f32.const 60)
  )
 )
)
[wasm-validator error in function 1103] unexpected false: all used features should be allowed, on
(i32.trunc_sat_f64_u
 (local.tee $4
  (call $fimport$187
   (i32.load
    (i32.load
     (local.get $1)
    )
   )
   (i32.load offset=12
    (local.get $2)
   )
  )
 )
)
[wasm-validator error in function 1120] unexpected false: all used features should be allowed, on
(i64.trunc_sat_f64_s
 (local.get $4)
)
[wasm-validator error in function 1908] unexpected false: all used features should be allowed, on
(i64.trunc_sat_f64_u
 (local.get $9)
)
Fatal: error validating input

For wasm-opt I tried versions form 116 to 120, all failed.

I am compiling web application with dioxus, it uses wasm-bindgen.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-discussionCategory: Discussion or questions that doesn't represent real issues.O-wasmTarget: WASM (WebAssembly), http://webassembly.org/T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions