runtimeverification / runtimeverification/wasm-semantics

Handle `global.get` in element segments

Open
#660 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
WebAssembly
Stars
106
Forks
24
PR merge metrics
No merged PRs in 30d

Description

https://github.com/WebAssembly/spec/commit/c2b3446682f79de5c0c676960b8380c1b9c924ae introduces a change to the conformance tests, which makes the interpreter fail on this function evaluation:

#t2aElemExpr < ctx (... localIds: .Map , globalIds: .Map , funcIds: #freshId ( 0 ) |-> 0 , typeIds: $out-i32 |-> 0 , tableIds: .Map , elemIds: .Map , memoryIds: .Map ) > ( ( item global.get 0  .EmptyStmts ) )

The source that causes this:

(module $module4
  (func (result i32)
    i32.const 42
  )
  (global (export "f") funcref (ref.func 0))
)

(register "module4" $module4)

(module
  (import "module4" "f" (global funcref))
  (type $out-i32 (func (result i32)))
  (table 10 funcref)
  (elem (offset (i32.const 0)) funcref (global.get 0))
  (func (export "call_imported_elem") (type $out-i32)
    (call_indirect (type $out-i32) (i32.const 0))
  )
)

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 with the conformance-test change in WebAssembly/spec commit c2b3446682f79de5c0c676960b8380c1b9c924ae and reproduce the failing #t2aElemExpr evaluation in the interpreter. Trace handling of the shown element segment containing global.get 0 and compare it with the supplied module; done means this case evaluates successfully without the reported failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
wasm
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.