code wiki / _hdl_build / nx_fwdconst_scan.nx

nx_fwdconst_scan.nx

buildroot/runtime/_hdl_build/nx_fwdconst_scan.nx

9467 B255 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

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

nx_sovjson_lib.nx nx_syscalls.nx nx_fwdconst_scan.nx

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

main fw_w sj_puts sys_write sys_exit sys_mmap sys_openat_rd sys_getdents64 dirent_type dirent_name ends_nx2 join2 fw_process fw_read sys_openat_rd ↻ sys_read sys_close fw_collect fw_isid fw_first_use fw_isid ↻ fw_w ↻ fw_line_of fw_wn sys_write ↻ sys_mmap ↻ dirent_reclen sys_close ↻ fw_wn ↻

structs

none

consts

16const FW_MAGIC_4096: i64 = 4096
17const FW_MAGIC_262144: i64 = 262144
19const FW_FILE_CAP: i64 = 2097152
20const FW_NAME_CAP: i64 = 64
21const FW_MAX_CONSTS: i64 = 512

functions

26func fw_w(s: *u8) -> i64 { return sj_puts(s) }
called by 2: fw_processmain calls 1: sj_puts
28func fw_wn(v: i64) -> i64
called by 2: fw_processmain calls 2: sys_writesys_mmap
42func fw_isid(c: i64) -> i64
50func fw_read(path: *u8, buf: *u8, cap: i64) -> i64
60func fw_line_of(buf: *u8, off: i64) -> i64
called by 1: fw_process
67func ends_nx2(nm: *u8) -> i64
called by 1: main
75func join2(buf: *u8, dir: *u8, name: *u8) -> i64
called by 1: main
88func fw_collect(buf: *u8, n: i64) -> i64
called by 1: fw_process calls 1: fw_isid
131func fw_first_use(buf: *u8, limit: i64, name: *u8) -> i64
called by 1: fw_process calls 1: fw_isid
179func fw_process(path: *u8, buf: *u8) -> i64
209func main(argc: i64, argv: *i64) -> i64