DAE2 crashes on call.without.effects with a non ref.func expression

Open Beginner friendly
#9,404 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@stevenfontanella is already working on this.

Since Nov 19, 2026.

  • #9405 by @stevenfontanella — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
cpp, wasm
Domain
compilers

Research direction

Read src/passes/DeadArgumentElimination2.cpp around line 624, where DAE2 assumes the last call.without.effects argument is a ref.func. Reproduce the crash with wasm-opt --dae2 and the WAST module in the issue, then check the relevant DAE2 tests. Done means this non-ref.func argument no longer triggers the assertion and the regression is covered.

Written by the indexing model from the issue text.

Description

DAE2 assumes that the last argument to call.without.effect is a ref.func expression link.

Minimal repro:

wasm-opt --dae2
(module
  (import "binaryen-intrinsics" "call.without.effects" (func $cwe (param funcref) (result i32)))
  (type $target-type (func (result i32)))
  (func $caller (param $ref (ref $target-type))
    (drop (call $cwe (local.get $ref)))
  )
)
wasm-opt: src/wasm.h:832: T* wasm::Expression::cast() [with T = wasm::RefFunc]: Assertion `int(_id) == int(T::SpecificId)' failed.
Dominant language
WebAssembly
Stars
8.7k
Forks
913
Avg merge
2d 14h
Merged PRs (30d)
92

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from WebAssembly/binaryen

All issues in WebAssembly/binaryen

Similar issues

More Compilers issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.