Context
Two related typechecker bugs from the 2026-05-05 audit. Combined leverage: ~34 home-os kernel modules unblocked.
Bug 1: uninit-via-out-parameter (22 files)
The typechecker emits `error: use of possibly uninitialized variable` for variables that ARE initialized — through out-parameter calls, struct-field assignments, or array-element assignments.
fn fill_buffer(buf: *[16]u8) { ... } // initializes via pointer
fn caller() {
var buf: [16]u8 = undefined // explicit undefined
fill_buffer(&buf) // initializes
let first = buf[0] // ERROR: "use of possibly uninitialized variable"
}The flow analysis doesn't recognize that taking `&buf` and passing to a function counts as potential initialization. Same issue for `&struct.field` and `&array[i]`.
Bug 2: pointer-deref doesn't unwrap Reference (12 files)
fn caller(p: *u8) {
let ch: u8 = *p // ERROR: "Type mismatch: expected u8, found &u8"
}The typechecker keeps the Reference wrapper after * deref instead of unwrapping it.
Approach
Bug 1: extend flow analysis
In packages/types/src/type_system.zig, the uninit-tracking pass. When the analyzer sees:
- A function call with
&local_varas an argument → marklocal_varas initialized after the call - An assignment
local_var.field = exprorlocal_var[i] = expr→ marklocal_varas initialized - A pointer-pass via deref-then-assign through
&local_varchain → same
Conservative: any address-of operation on a local marks the local "may have been initialized through this path".
Bug 2: fix *ptr typing
Find where UnaryExpr.Deref is typed (likely in inferUnaryExpr or similar). When the operand has type *T / &T / Reference{T}, the result type is T, not Reference{T}. Bug is probably the result type construction returning the wrapper.
Affected files (sample, full lists in ~/Desktop/home-os-kernel-audit-2026-05-05.tsv)
Bug 1 (filter first_error = use of possibly uninitialized variable): ~22 files including core/process.home, drivers/hwmon.home, mm/buddy.home, ...
Bug 2 (filter Type mismatch.*found.*Reference or expected.*found.*&): ~12 files including various places where pointers are dereferenced.
Why this matters
Combined ~34 modules unblocked — biggest leverage on the post-#28 board.
Reference
- 2026-05-05 audit: `~/Desktop/home-os-kernel-audit-2026-05-05.tsv`