Skip to content

transform: preserve autofree scopes around synthetic branches - #31766

Merged
medvednikov merged 1 commit into
masterfrom
fix/ci-autofree-synthetic-scopes-20261103
Nov 3, 2026
Merged

medvednikov merged 1 commit into
masterfrom
fix/ci-autofree-synthetic-scopes-20261103

Conversation

@medvednikov

@medvednikov medvednikov commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Problem

Ved's Linux CI compiles successfully in production mode but fails its autofree build with string__free(&(final)) referring to an undeclared local in draw_text_line_standard_syntax (job).

Two lowered blocks consume cleanup slots that the checker never recorded as source scopes: the wrapper holding hoisted else if condition statements, and the successful branch of a plain array index or { fallback } lookup. Those extra slots shift later cleanup into earlier branches.

Change

Mark these two synthetic blocks with the existing skip-scope-drops mechanism. Their nested source branches and the explicit or fallback continue to consume their own cleanup slots normally.

Add an autofree regression that exercises all membership branches and successful, out-of-bounds, and negative array indices. It checks exact destructor order, fallback destruction only on failure, and a later cloned string whose misplaced cleanup reproduces the C compilation error.

Validation

  • Reproduced the exact Ved generated-C failure and reduced both scope mismatches before their fixes.
  • Rebuilt the compiler.
  • New regression passes 2 tests, 32 assertions under GCC with -new-compiler -autofree -gc none.
  • Actual native Linux Ved builds at unchanged head cd82b857c5e65de987da6ca6633e11240cea3a07 pass with both -autofree and -prod, using GCC and the new compiler.
  • All 11 autofree test files passed, including the process-spawning loop-control regression.
  • Generated C frees word before its continue and final inside its declaring block.
  • Formatting, git diff --check, and independent source review pass.
  • The full compiler diagnostics gate passed with 1,941 passed, 6 skipped (1,947 total): 53 skip-unused cases, 8 comptime-define cases, and 1,880 main cases. Exit status 0.
  • This gate tested the frozen base 882c110bfc9595d3b823ef8e8c6813717f9d658a plus exactly these three changed files, matching published head c2fa59572efa59fffbcdf6906189aafd36d9099c. Post-run checks confirmed unchanged source and compiler hashes.

This is the compiler-side follow-up for vlang/ved#215.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-03T06:29:57.202276Z c2fa595 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@medvednikov
medvednikov merged commit 3d95272 into master Nov 3, 2026
@JalonSolov
JalonSolov deleted the fix/ci-autofree-synthetic-scopes-20261103 branch November 3, 2026 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant