WebAssembly / WebAssembly/binaryen

Reference types crash wasm-opt‘s asyncify pass

Open
#3,739 24 comments 2 reactions 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

(module
  (type (;0;) (func))
  (type (;1;) (func (result externref)))
  (import "gl" "createProgram" (func $src/asc/gl/createProgram (type 1)))
  (func $src/asc/lemonsoda/init (type 0)
    call $src/asc/gl/createProgram
    drop
  )
  (export "init" (func $src/asc/lemonsoda/init))
)
$ wat2wasm --enable-reference-types test.wat -o test.wasm
$ wasm-opt --asyncify --enable-reference-types test.wasm -o test2.wasm
invalid type
UNREACHABLE executed at /tmp/binaryen-20210320-71286-1g5tfwr/binaryen-version_100/src/wasm/wasm-type.cpp:488!
[1]    56081 abort      wasm-opt --asyncify --enable-reference-types test.wasm -o test2.wasm

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

Reproduce the crash with wat2wasm using --enable-reference-types, then run wasm-opt with --asyncify on the generated test.wasm. Start by investigating the asyncify pass and the wasm-type.cpp failure shown in the report. Done means wasm-opt no longer aborts on this module and produces valid output.

Written by the indexing model from the issue text.

Assessment

Tech stack
wasm
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.