reinterpretarray: fix offset indexing in pass-through wrappers #63418
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.41) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.41 · 183 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.312
Shallow Review Depth
shallow_review_depth
0.289
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #63418"
general
weight: 0.35
adienes
Claude:
---
Wrappers such as
OffsetArrayaround a reshapedreinterpretpass indexing through withIndexSCartesian2. Its fallback methods treatedSCartesianIndex2.j, a linear index of the innermost parent, as a 1-based position. With an offset parent, reductions read the wrong elements andcopyto!, which indexes under@inbounds, wrote past the parent:The two-dimensional method was also declared for a size ratio of 2 (
IndexSCartesian2{2}) rather than for two dimensions, so other ratios reached_ind2subon a single offset axis and threw, e.g.sum(OffsetArray(reinterpret(reshape, UInt8, UInt32[1, 2, 3]), 0, 10)).This replaces the fallbacks with one mapping: subtract the iterator's starting index and place the position on the wrapper's trailing axes. The wrong results came in with #58898 (1.13); before that these cases threw.
sumover a 10^6-element ratio-2 wrapped array, which used the removed method, takes the same time.This was found and fixed with Claude Code (Opus 5.5) and reviewed by Codex (gpt-6-astra). The human author has not yet reviewed the change or this text.