[MemoryPacking] Check the full destination before split writes #9431
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.31) × (1 − Review Confidence (0.43)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.31 · 104 lines diff across 1 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 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
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.278
Real PR Conversation Timeline
1 comments
"Review active on #9431"
general
weight: 0.35
kripken
--memory-packingcan change what’s left in memory after a trap. The originalmemory.initchecks the whole destination range before writing anything. If the pass splits it up, an early piece can write before a later piece traps. In the regression test, the original leaves the byte at42, but the optimized version overwrites it with0.This adds one bounds check before any split writes when the pass can’t prove the destination is in bounds. If it can prove the range is safe, there’s no extra check.
I added 16 cases covering memory32 and memory64, constant and dynamic destinations, and both zero and nonzero leading pieces. The out-of-bounds cases fail without the fix; all 16 pass with it. I also updated the two existing lit cases to show the check.
I attest that this code is my original creation.
Nathan, ChipLab