WebAssembly / WebAssembly/binaryen

Asyncify does not support unwinding from functions returning non-nullable values

Open
#6,990 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
WebAssembly
Stars
8.6k
Forks
885
Avg merge
1d 19h
Merged PRs (30d)
69

Description

Hi,

While testing some wasm-opt options for Wasocaml, I found the following assertion failure:

$ wasm-opt -O3 --enable-gc --enable-tail-call --enable-reference-types --enable-multivalue --enable-exception-handling a.out.wasm -o a.out.optimised.wasm --asyncify    
wasm-opt: ~/dev/cpp/binaryen/src/ir/literal-utils.h:35: wasm::Expression* wasm::LiteralUtils::makeZero(wasm::Type, wasm::Module&): Assertion `canMakeZero(type)' failed.
zsh: IOT instruction  wasm-opt -O3 --enable-gc --enable-tail-call --enable-reference-types    -o

I'm on a recent version:

$ wasm-opt version 119 (version_119-55-g7e1413902)

It works without --asyncify.

The binary file is attached, I don't have the text version sorry. I uploaded it as a .jpeg otherwise GitHub won't let me do it: bug_asynficy.

Thanks!

Contributor guide

Open the contributing guide

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.

Research direction

Start by reproducing the reported wasm-opt command with the attached binary and --asyncify enabled. Read src/ir/literal-utils.h at the failing makeZero assertion, then trace the asyncify path that handles functions returning non-nullable values. Done means the input no longer triggers the assertion while retaining the reported optimization behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, wasm
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.