ReviewOS

home-lang/home

Typechecker: residual uninit-flow false positives via pointer-field aliasing

#38
Closed glennmichael123 opened this 24 days ago · 0 comments
24 days ago

Context

home #31 fixed many `use of possibly uninitialized variable` false positives by recognizing `&local` as a potential init point. But ~12 cases remain in the 2026-05-06 audit, all with subtler patterns:

  • Aliasing through pointer-to-struct fields
  • Writes through dereferenced pointers (`*p.field = ...` initializes the struct that `p` points at)
  • Multi-step alias chains (`let alias = &local; another_fn(alias)`)

Sample affected files

From the 2026-05-06 audit (filter `first_error` = `use of possibly uninitialized variable`):

  • `arch/arm64/...` (devicetree-shaped files)
  • Plus 10 others

Approach

Tighten the data-flow lattice. When the analyzer sees:

  • `*p = expr` and p was bound to &local → mark local as initialized
  • `p.field = expr` and p: *Struct (auto-deref) → mark the pointed-to struct's containing local
  • A let-binding that takes `&local` and is then passed to a function → conservatively mark local as initialized at the let-binding site

The trick: don't over-conservatively mark every let-binding as init (false negative); only when the let value is clearly an alias of a local.

Why this matters

12 modules unblocked. This is the residual after #31; same family of bug.

Reference

  • Predecessor: home #31 (closed)
  • 2026-05-06 audit

Sign in to comment on this issue.