Skip to content

Enum-constructor payload args are not marked consumed: V(x) then W(x) silently reads x's blanked slot #764

Closed

Description

@ehartford

Under the flip, Token.Text(a) moves a (payload owned by the constructed value) but SemaCheck never marks the consumption — neither check_enum_variant (NK_ENUM_VARIANT arm, no mark_moved_if_consumed on payload args, contrast struct-literal fields at ~11654 and collection elements at ~11337) nor check_call's variant_payload_tys branch (~14732). A second use compiles clean and reads the move-blanked slot at runtime: 6-line repro in with-staging/fixpoint-analysis (ctor_move.w — checks 'ok' today); behavior symptom = issue65_fstring_mixed_holes' empty Bad() payload (exit-134 census entry).

HAZARD (learned tonight, do not naively widen): adding mark_moved_if_consumed at both sites compiles the tree clean (seed gate green) but the resulting compiler misbehaves at runtime (CLI arg parsing corrupted) — the marking drives move-reset emission and some compiler-source pattern gets a reset the checker's liveness modeled differently. This is the #695/#696 per-edge move-transfer drift class: the fix must land ALONE in a :move-audit/:drop-audit-bracketed batch, with the reset-placement divergence root-caused first (tools/move_audit.w baseline against the pre-change compiler).

Activity

  1. ehartford commented on Aug 10, 2026

    @ehartford
    ContributorAuthor

    Census attribution: test/behavior/issue65_fstring_mixed_holes.w is this defect at runtime — let tok = Token.Text(label); let err = LocalErr.Bad(label) reuses a payload the first ctor already moved; MirLower blanks label, the checker never marks it, output is err=Bad() (assert at :16). When the checker-side marking lands (isolated :move-audit batch per the protocol above), this test must be respelled to clone/materialize the second use — it will correctly become a use-after-move error.

  2. added a commit that references this issue on Aug 10, 2026
  3. ehartford commented on Aug 11, 2026

    @ehartford
    ContributorAuthor

    Fixed on 747-flip in 419eefd as its own isolated batch per the protocol above. Both sites (check_enum_variant + the static-variant method-call path) now apply the #714 container-store rule with the method_arg_stores_value guards. The prior attempt's runtime CLI corruption did NOT reproduce — build -o/run/test/argv-forwarding all exercised green; the interacting defect was among the session-3 fixes (clause keying / sidecar records). Batch bracket: build rc=0, fixpoint rc=0, move-audit rc=0 (ground truth), drop-audit rc=0 (vs seed baseline), debug-alloc 64 PASS / 0 FAIL, :test failures unchanged-known (17, all #761 release-lane + derives). issue65_fstring_mixed_holes respelled + green; err_ctor_payload_reuse pins the diagnostic.

  4. added 2 commits that reference this issue on Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions