code wiki / _hdl_build / nx_fwdconst_scan.nx
nx_fwdconst_scan.nx
buildroot/runtime/_hdl_build/nx_fwdconst_scan.nx
about
nx_fwdconst_scan.nx -- FORWARD-CONST DEAD-READ DETECTOR (eats seq360's discovery half, 2026-07-20).
The miscompile class: a module const READ by code textually ABOVE its declaration resolves to
CONSTANT 0 in binaries built before the 07-20 nx_cc diagnostic (proven live: AT_FDCWD dirfd=0,
VC_EO_PART/VC_EO_T8 codec early-outs dead since 07-12). The new compiler REJECTS the pattern at
build time; this organ finds it in SOURCE so already-shipped binaries' sources get fixed+rebuilt
deliberately, and the class is sweepable on cadence forever.
argv: <dir> [dir2] [dir3] (flat dirs, .nx files; the build-resolution pair is the usual input)
Report rows: FWDCONST <file> use-line=<L> const=<NAME> decl-line=<D>
Summary: NX-FWDCONST-SCAN files=<f> consts=<c> flagged=<n> skipped-big=<s> (exit 0 = scan completed)
HONEST SCOPE v1: full-comment lines (// or \) and double-quoted spans are SKIPPED; an INLINE
trailing comment mentioning the name still flags (rare; review rows by eye). Reporter only --
a ratchet gate asserting flagged<=N composes on top once the map is eaten.
license_tier: ORIGINAL No hw writes (Rule 26).
dependencies 2 imports · 0 importers
imports: nx_sovjson_lib.nxnx_syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 16 | const FW_MAGIC_4096: i64 = 4096 |
| 17 | const FW_MAGIC_262144: i64 = 262144 |
| 19 | const FW_FILE_CAP: i64 = 2097152 |
| 20 | const FW_NAME_CAP: i64 = 64 |
| 21 | const FW_MAX_CONSTS: i64 = 512 |
functions
| 26 | func fw_w(s: *u8) -> i64 { return sj_puts(s) } |
| 28 | func fw_wn(v: i64) -> i64 |
| 42 | func fw_isid(c: i64) -> i64 |
| 50 | func fw_read(path: *u8, buf: *u8, cap: i64) -> i64 |
| 60 | func fw_line_of(buf: *u8, off: i64) -> i64 called by 1: fw_process |
| 67 | func ends_nx2(nm: *u8) -> i64 called by 1: main |
| 75 | func join2(buf: *u8, dir: *u8, name: *u8) -> i64 called by 1: main |
| 88 | func fw_collect(buf: *u8, n: i64) -> i64 |
| 131 | func fw_first_use(buf: *u8, limit: i64, name: *u8) -> i64 |
| 179 | func fw_process(path: *u8, buf: *u8) -> i64 |
| 209 | func main(argc: i64, argv: *i64) -> i64 |