Repository navigation
rc: a global lent through a view is held from its read - #648
Merged
Merged
Conversation
A global, or a global's field, given to a call as a view - an interface,
a base class, an object literal holding it - and given a new value by a
later argument of the same call (`f(G, (G = mk(), x))` with an interface
parameter, `f({ v: G.v }, (G = mk(), x))`) was freed before the call ran.
The view is made at the call, after every argument is evaluated, and
holdGlobalArguments did not see through it: `globalOf` stopped at
`ts.NewInterface`, and an object literal holds what it was given with no
count until it is boxed for the interface, at the call too. Under rc the
hold now keeps the value behind the view - the object a cast or an
interface is made over, or each value stored into the literal's slot -
retained where it is read (#647). The fuzzer (#646) found these as A1's
view variant; they failed on #633 as well.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #647. This fixes the rc failures left in the fuzzer run there: A1's view variant.
A global, or a global's field, can be given to a call as a view: an interface parameter, a base-class parameter, or an object literal that holds it. If a later argument of the same call gives the global a new value, the block was freed before the call ran:
Why
A view is made at the call, after every argument has been evaluated.
holdGlobalArgumentsdidn't see through views:globalOfstopped atts.NewInterface, so nothing was held.Fix (rc only; own is unchanged)
The hold now keeps the value behind the view and retains it where it is read, as #647 does for a plain argument:
Tests
tests/00global_argument_view.tscovers:It runs compiled, under JIT, and in the rc/none corpus. It fails under rc on main on Linux.
Verification
ctest -C Release: Windows 4976/4976, WSL Linux 4958/4958.mm_fuzz.py --jobs 10 run --count 500 --seed 1(the run from rc: hold a global argument from its read, and give a const read of a global a count #647) on Linux: 0 rc failures, down from 7. The 3 own failures (R1, O4) are unchanged.--count 1000 --seed 2: 9 failures, all of which also fail on main. The 5 rc ones are A1 with a local or a parameter, not a global:f(n, (n = mk(), n)). That's a separate bug.🤖 Generated with Claude Code