runtimeverification / wasm-semantics

A Prototype Formal Semantics of WebAssembly in K
Other
74 stars 18 forks source link

Handle `global.get` in element segments #660

Open gtrepta opened 1 week ago

gtrepta commented 1 week ago

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))
  )
)