← board

Self-host guard: reject IR_UNSUPPORTED at compile time (fail loud, not miscompile)

Motivation

IR_UNSUPPORTED = "a frontend could not lower this AST node" (the else fallbacks in IRLowerAST/IRLowerAddress, ir.inc ~965 + ~5107). When such a node reaches codegen:

Proposed fix

IRVerify (runs per body after lowering, before codegen) errors on ANY IR_UNSUPPORTED node, referenced or not, with an actionable message naming the AST kind. Turns "frontend gap → silent miscompile" into "frontend gap → immediate compile error at the exact site". Would have caught the Rust else-if bug the instant it was generated.

Measured (2026-07-04)

IR_UNSUPPORTED generation count = 0 on: the compiler self-compile, and a C/Pascal/Nil-Python sample (hello.c, cexpr_b.c, cstmt_c.c, records.pas, procs.pas, bootstrap_features.pas, test_dynarray_torture.pas, test_nil_python_core.npy). So the mature frontends never trip it — safe for them.

Why gated (the risk)

The Rust frontend (Track R) is actively in development and INCOMPLETE — it legitimately emits IR_UNSUPPORTED for constructs it does not yet lower, some of which may currently "compile" with a dead/benign node. A hard IRVerify error would break those Rust programs/tests and block Track R's in-flight work (cross-track hazard, against the parallel-tracks rule). Do NOT land until:

Acceptance

Log