Skip to content

merge3 --resolve no longer crashes a -prod build - #26

Merged
MartenH merged 1 commit into
mainfrom
merge3-resolve-prod
Oct 31, 2026
Merged

MartenH merged 1 commit into
mainfrom
merge3-resolve-prod

Conversation

@MartenH

@MartenH MartenH commented Oct 31, 2026

Copy link
Copy Markdown
Owner

merge3 --resolve crashes on every run of a -prod build: exit 139 on Linux, 0xC0000005 from the Windows binary CI builds. The merge itself finishes; the crash is writing the result. Reports and merges without --resolve are fine, and so is any build without -prod.

Cause. first escapes to the heap, because &first.ours is taken, so V types if decisions.len == 0 { first } else { flatxml.merge3(...)! } as a pointer. The generated C for the else branch is __if_val_3 = &__or_val_5;, the address of a local of that block. Optimized, the slot is reused and res.m3.edit is read back as nil. It is a V code generation fault, and this is the one place in arxmodel's generated C that has it.

Fix. An if statement assigning to m3, which copies the value.

Checked, with the pinned V:

  • scripts/merge3_cli_test.sh on a Linux -prod build: exit 139 at main, passes here.
  • v test arxmodel: 19 of 19.
  • On a large real-world model, with a Windows -prod build of this change: plain merges are byte-identical to the build before merge3 reports conflicts as JSON and takes decisions on them #25's follow-ups, and all ours, all theirs and half and half give the same results as that build.

Not in this PR. CI did not see this because merge3 never runs on a -prod binary: the test job's binary is a debug build, and the windows job runs only check and merge. Adding scripts/merge3_cli_test.sh dist/arxmodel.exe to the windows job would close that; a workflow edit is not something this token can push.

v fmt -verify reports arxmodel/compare.v on main too, at a line this does not touch; it is left alone.

🤖 Generated with Claude Code

With `first` on the heap, V makes `if decisions.len == 0 { first } else
{ flatxml.merge3(...)! }` a pointer, and in the else branch that pointer
is to a value of the block, gone when it ends. An optimizing C compiler
reuses the place, so the edit read back is nil and writing the result
crashes on every --resolve, with the same source fine without -prod.
An assignment in an `if` statement copies the value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 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-10-31T14:34:43.061573Z 7b282d5 PR opened
ℹ️ 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.

@MartenH
MartenH merged commit 6b65260 into main Oct 31, 2026
2 checks passed
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