Handle field and array-element outputs accepted in statement assembly

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

メンテナーはふだん 1 日以内に返信

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

評価

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

調査の方向性

Start at llvm/src/statement/asm.rs, especially the statement asm output-place lowering near line 259, and trace how semantic checking accepts field and index lvalues. Compare the struct-field and array-element repros with the plain variable control, then inspect existing asm tests for output storage and evaluation order. Done means supported outputs reach IR and store to the selected place with single, source-ordered address evaluation, or unsupported forms receive a source diagnostic.

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

説明

bug help wanted

Problem

Statement-form assembly accepts assignable struct fields and array elements as outputs during semantic checking, but LLVM lowering only handles a variable or a dereferenced variable. Validated programs reach E9001 instead of supported output lowering or a source diagnostic.

Starting point: statement asm output-place lowering.

Reproduction

Audited canonical master e1f8effd195b6339c3979b1e091e63c25f1da983 on Linux amd64 with checkout-built Wave 0.0.1-alpha-dev, matching std, Rust 1.89.0, Cargo jobs=2 and LLVM 21.1.8. The master SHA was rechecked before registration.

Save either example as repro.wave:

struct S { x: i64; }
fun main() {
    var s: S = S { x: 0 };
    asm {
        "mov rax, 7"
        out("rax") s.x
        clobber("nostack")
    };
}

Array variant:

fun main() {
    var a: array<i64, 1> = [0];
    asm {
        "mov rax, 7"
        out("rax") a[0]
        clobber("nostack")
    };
}
target/debug/wavec --std-root "$PWD/std" check repro.wave
target/debug/wavec --std-root "$PWD/std" --error-format=json build repro.wave --emit=ir --out-dir .tmp/asm-output-repro

Semantic checking accepts the output. IR generation exits 1 with E9001 and:

out(...) target must be variable or deref var for now: IndexAccess { ... }
compiler panic location: llvm/src/statement/asm.rs:303:18

The field variant reaches the same restricted output-place path. A plain variable output is the control case. This report establishes semantic-check/IR behavior; it does not claim execution on another architecture.

Scope

Lower the typed addresses of supported field/index output lvalues with correct storage width, source order and single evaluation. Reject any deliberately unsupported output form during semantic checking with a source diagnostic rather than an internal error. Preserve constant/mutability checks, constraints and clobbers.

Related: #512 concerns typed asm input expressions, #397 malformed asm syntax and #409 the general backend diagnostic channel. This issue is specifically the accepted output-address shape.

Completion criteria

  • Both examples build through IR/object generation without E9001, or receive an intentional source diagnostic if a documented output restriction applies.
  • Supported cases store the output in the selected field/element at execution.
  • Side-effecting index/address computations run once in source order.
  • Plain variables, supported pointer outputs, mutability checks and architecture feature gating retain coverage.
主要言語
Rust
スター
56
フォーク
21
平均マージ
22時間 57分
マージ済み PR(30日)
46

環境構築

はじめの一歩

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

wavefnd/Wave のほかの issue

wavefnd/Wave の issue をすべて見る

似ている issue

Rust の issue をもっと見る

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

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