Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Lost stack values when entering a loop

オープン
#678 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
wasm
領域
compilers

調査の方向性

埋め込まれた fac-ssa WebAssembly モジュールとアサーションから始め、次に pykwasm/kdist/wasm-semantics/wasm.md の549-552行目を、仕様にあるリンク先のループエントリールールと併せて確認します。呼び出しを再現し、ループが $pick1 に必要な2つのスタック値を保持していること、および階乗のアサーションが通ることを検証します。

索引モデルが issue の本文から書いたものです。

説明

(module
  ;; Iterative factorial without locals.
  (func $pick0 (param i64) (result i64 i64)
    (local.get 0) (local.get 0)
  )
  (func $pick1 (param i64 i64) (result i64 i64 i64)
    (local.get 0) (local.get 1) (local.get 0)
  )
  (func (export "fac-ssa") (param i64) (result i64)
    (i64.const 1) (local.get 0)
    (loop $l (param i64 i64) (result i64)
      (call $pick1) (call $pick1) (i64.mul)
      (call $pick1) (i64.const 1) (i64.sub)
      (call $pick0) (i64.const 0) (i64.gt_u)
      (br_if $l)
      (drop) (return)
    )
  )
)

(assert_return (invoke "fac-ssa" (i64.const 25)) (i64.const 7034535277573963776))

After fac-ssa gets invoked and the loop instruction is reached, the two values that have been pushed onto the stack disappear when we enter the loop, so then the subsequent call to $pick1 doesn't have any parameters to use.

The spec

Our rule:

https://github.com/runtimeverification/wasm-semantics/blob/ad238ca2f73ea866b54b31308326ac2a56e64159/pykwasm/src/pykwasm/kdist/wasm-semantics/wasm.md?plain=1#L549-L552

It looks like the spec states that the stack values are prepended to the instructions when entering the block, but we aren't doing that here.

主要言語
WebAssembly
スター
106
フォーク
24
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

runtimeverification/wasm-semantics のほかの issue

runtimeverification/wasm-semantics の issue をすべて見る

似ている issue

Compilers の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。