Repository navigation
-mm=own: a global's value is lent to a call unless the call may assign that global - #678
Merged
Merged
Conversation
…n that global #639 refused any call that might drop anything once a value read out of an assigned global was lent to it, though only a store to the global releases its block: `G = new N(2); other(G)`, where other assigns H, was rejected. The check now reads what pinAssignedGlobals (#661) put on the call, which runs before it: it refuses a call that may assign that global, or one it cannot name (an indirect call, a callee calling one), and lends to any other. A callee that assigns the global itself, through another function, a method or a function value is still refused. own_err_global_kept_field is now refused by checkGlobalRead, which it was written for: `keep` stores the lent value into a field that outlives the next assignment of `g`; its pinned message follows. Tests: own_global_argument_other_global under every model, own_err_global_argument_indirect. Own corpus unchanged (533). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What
Under
-mm=own, a value read out of an assigned global can now be lent to a call unless the call may assign that global, or a global the pass cannot name.Why
#639 refused any call that might drop anything once it was lent such a value. Only a store to the global releases its block, so
G = new N(2); other(G), whereotherassigns a different globalH, was rejected (the "#639 is coarse" half of own-raytrace follow-up 14).rejectGlobalArgumentsDroppednow reads__own_assigns_globals/__own_assigns_any_global.pinAssignedGlobals(#661) puts these on each call and runs just before the check. A callee that assigns the global itself, through another function, through a method or through a function value is still refused (new negativeown_err_global_argument_indirect; the existing transitive and method negatives still pass).own_err_global_kept_fieldis now refused bycheckGlobalRead, the check that test was written for:keepstores the lent value into a field that outlives the next assignment ofg. The test's comment and pinned message are updated to match.Tests
own_global_argument_other_globalcovers a callee, and a callee's callee, that assign another global. It runs under own, rc, gc and none.🤖 Generated with Claude Code