fix: integer-address pointer reconstruction (`inttoptr` + GEP) #4251
All Vouch review confidence checks passed
Residual risk 0.15 = Change Risk (0.39) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 247 lines diff across 3 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.330
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #4251"
general
weight: 0.35
sklam
Summary
This PR updates Awkward's Numba lowering to explicitly reconstruct typed pointers from integer addresses before performing pointer arithmetic.
Awkward stores buffer addresses in its lookup table as integer values (
intp). Several lowering paths reconstructed element addresses by performing integer address arithmetic and relying oncgutils.pointer_addto produce the final pointer. Following Numba PR https://github.com/numba/numba/pull/10696,pointer_addnow preserves pointer provenance by using LLVM'sgetelementptr(GEP), which requires its base operand to already be a pointer.This PR updates these call sites to:
reconstruct typed pointers explicitly with
builder.inttoptr(),perform element addressing using
builder.gep(),avoid integer address arithmetic after pointer reconstruction.
The resulting code is compatible with the updated
pointer_addsemantics while making pointer provenance explicit in the generated LLVM IR.Motivation
Numba PR #10696 changed
cgutils.pointer_addto use GEP instead of byte-wise pointer arithmetic in order to avoid LLVM miscompilations related to pointer provenance.Awkward intentionally stores external buffer addresses as integers in its lookup table. Those addresses should therefore be converted back into typed pointers explicitly before any pointer arithmetic is performed. This makes the intended semantics explicit and avoids relying on implicit integer-to-pointer conversions.
This change is independent of the recent work on native string lowering and instead updates the underlying pointer handling used by the Numba integration.
Changes
replace integer-address pointer arithmetic with explicit
builder.inttoptr()calls where appropriate,use
builder.gep()for element addressing once a typed pointer has been reconstructed,remove assumptions that
cgutils.pointer_addaccepts integer addresses.No user-facing API changes are introduced.