← Back to Pull requests

fix: integer-address pointer reconstruction (`inttoptr` + GEP) #4251

Closed
unknown closed this pull request without merging on Oct 23, 2026 19:08 UTC
View on GitHub
unknown unknown commented on Jul 27, 2026 16:00 UTC
Author

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 on cgutils.pointer_add to produce the final pointer. Following Numba PR https://github.com/numba/numba/pull/10696, pointer_add now preserves pointer provenance by using LLVM's getelementptr (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_add semantics while making pointer provenance explicit in the generated LLVM IR.

Motivation

Numba PR #10696 changed cgutils.pointer_add to 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_add accepts integer addresses.

No user-facing API changes are introduced.

Diff: 247 lines (+185 / -62) across 3 files Reviewer: sklam Review duration: 126908m
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
0.39
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
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
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 38.9% (MEDIUM) · Higher = larger blast radius
38.9%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 60.5% · Lower = rushed or shallow review
60.5%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 15.4% · Safe to merge
15.4%