runtimeverification / runtimeverification/wasm-semantics

Valstack Bug

Open
#140 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I have a test case:

(module
  (func (export "unmatch") (result i32) (i64.const 700))
)

(invoke "unmatch")
#assertTopStackExactly < i32 > 123 "dummy test 1"
#assertTopStack < i32 > 456 "dummy test 1"

#clearConfig

The return type of function "unmatch" is not matched with the top of stack, so instead of returning a value, it will keep a #take ( i32 .ValTypes , < i64 > 700 : .ValStack ) ++ .ValStack on the <valstack>.

The interesting thing is that when using Java backend if the <valstack> is at the state above, any stack assertion will pass no matter what value you assert, therefore all assertions becomes useless.

Also, the output of the program above with Ocaml backend is also abnormal. All it outputs is:

#take ( i32  .ValTypes , < i64 > 700 : .ValStack )

, but I think it should output the whole configuration.

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 test case in the issue and trace the Java backend's stack assertion behavior when the valstack contains the shown #take state. Compare that result with the OCaml backend output; done means invalid assertions do not all pass and the OCaml backend prints the complete configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
wasm
Domain
compilers, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.