Skip to content

Add raw pointer address escape checks#33

Merged
itsfuad merged 2 commits into
mainfrom
feature/raw-pointer-safety
Jun 28, 2026
Merged

Add raw pointer address escape checks#33
itsfuad merged 2 commits into
mainfrom
feature/raw-pointer-safety

Conversation

@itsfuad

@itsfuad itsfuad commented Jun 28, 2026

Copy link
Copy Markdown
Member

Summary

  • add @expr address operator with mutable and const raw pointer typing
  • move raw pointer escape analysis into dedicated ownership phase after typechecking
  • reject returning pointers known to point at local storage, while allowing module-scope const addresses
  • preserve address-of field storage via MIR FieldAddr so @box.field does not become pointer to a temp copy

Follow-up

  • Refactor MIR field/index access to projection places #32 tracks MIR projection/place refactor before arrays, slices, maps, or any future addressable composite work
  • hard line: do not add IndexAddr, SliceAddr, or MapAddr nodes; pivot to Project + Load/Store or generalized Place first

Validation

  • env GOCACHE=/tmp/peeper-go-cache go test ./internal/semantics/ownership ./internal/semantics/typechecker ./internal/ir/hir_lower ./internal/ir/mir ./internal/backend/llvm ./internal/pipeline -timeout 120s -count=1 -p 2
  • env GOCACHE=/tmp/peeper-go-cache go test ./... -timeout 120s -count=1 -p 2
  • git diff --check
  • env GOCACHE=/tmp/peeper-go-cache go run ./scripts/bundle.go

@itsfuad itsfuad force-pushed the feature/raw-pointer-safety branch from c276f0f to 51dd3ac Compare June 28, 2026 20:15
@itsfuad itsfuad merged commit 25ac52a into main Jun 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant