nx_probe_ptrfield_idx.nx
buildroot/runtime/nx_probe_ptrfield_idx.nx
about
nx_probe_ptrfield_idx.nx -- MINIMAL REPRO for debt 1786057660.
CLAIM UNDER TEST: nx_cc miscompiles `structptr.field[i]` when `field` is a pointer to a
NON-BYTE type. Isolated by differential bisect in nx_linemap.nx (three *i64 fields); this
probe strips that finding to the smallest shape that can still exhibit it, so the verdict
is about the LANGUAGE FEATURE and not about the line map.
The estate's existing instance of the pattern is ctx.out[pos] in nx_import.nx, where the
field is *u8 -- element size 1, so an element-size scaling error is invisible BY
CONSTRUCTION. Every other *i64 indexing site nearby (canonicalise_path) uses a LOCAL
handle. So the codebase avoided this shape by accident, not by design, and nothing tests it.
Exit codes name the exact failing direction rather than a single boolean:
0 = no defect: field-index and hoisted-local addressing agree, both directions
11 = write-via-field / read-via-local disagreed at index 0 (base or scale wrong)
12 = ... at index 1 (index 0 agreeing but 1 not => SCALE, not base)
13 = ... at index 2
14 = write-via-local / read-via-field disagreed (the reverse direction)
15 = *u8 control FAILED -- if this fires the defect is broader than non-byte pointers
and the whole diagnosis in 1786057660 needs rewriting
dependencies 1 imports · 0 importers
imports: nx_syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| 31 | struct PfHolder |
consts
| 23 | const K_MAGIC_1111: i64 = 1111 |
| 24 | const K_MAGIC_2222: i64 = 2222 |
| 25 | const K_MAGIC_3333: i64 = 3333 |
| 26 | const K_MAGIC_4444: i64 = 4444 |
| 27 | const K_MAGIC_5555: i64 = 5555 |
| 28 | const K_MAGIC_6666: i64 = 6666 |
| 29 | const K_MAGIC_23331: i64 = 23331 |
functions
| 39 | func pf_say(s: *u8) -> i64 |
| 46 | func main() -> i64 |