Repository navigation
Handle overlapping copyto! within a ChainedVector - #137
Open
quinnj-bot[bot] wants to merge 2 commits into
Open
quinnj-bot[bot] wants to merge 2 commits into
quinnj-bot[bot] wants to merge 2 commits into
Conversation
Fails on main; passes with the next commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copying chunk by chunk overwrote an overlapping source before reading it, so copyto!(x, 2, x, 1, 2) repeated the first element. Call Base.unalias(dest, src) first, as Base's generic copyto! does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
quinnj-bot
Bot
force-pushed
the
claude/chainedvector-copyto-overlap
branch
from
November 19, 2026 06:32
26fddfd to
0eee67e
Compare
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.
Why
A
ChainedVectorshould give the same answers as the same data in aVector.copyto!from aChainedVectorinto itself, or from a view of itself, copied chunk by chunk without checking for overlap. When the destination range starts after the source range, it overwrote source elements before reading them:What changed
copyto!(dest, doffs, src, soffs, n)methods that take aChainedVectorcallBase.unalias(dest, src)first, as Base's genericcopyto!does. An overlapping source is copied before the write starts.Scope
ArgumentError, as the existing tests expect.VectorthrowsBoundsErrorthere.Blast radius
Non-overlapping copies pay one identity check. Overlapping copies now allocate a copy of the source, which is what Base does for other arrays.
Verification
mainand passes on this branch (Julia 1.12.6).ChainedVectorinto itself, from a view of it, and into a view of it.ChainedVector,SentinelVector, andMissingVector, compared withVector) reports this mismatch onmainand not with the fixes applied.🤖 Generated with Claude Code