code wiki / _hdl_build / nx_probe_intptr_live.nx
nx_probe_intptr_live.nx source
↩ module page · 21 lines · 1337 B
1// nx_probe_intptr_live.nx -- LIVE WITNESS for the REVERSE call-arg type direction (2026-08-05):
2// a NON-CONST typed INTEGER (here argc, a parameter) passed into a *u8 parameter must BUILD-FAIL
3// with `argument type mismatch`. ⚠A `let n: i64 = 7` argument does NOT witness this: an integer
4// LITERAL is exempt by design (VK_CONST_INT -- the sentinel/null idiom), and using one silently
5// tests the exemption instead of the check.
6// This direction was DISABLED from 2026-08-01 until two root fixes landed: (1) the `as T` cast no
7// longer mutates its operand's type in place, (2) pointer arithmetic (`ptr + int`) keeps its
8// POINTER type instead of decaying to i64 -- the latter is what made the corpus idiom
9// `emit(out + o, cap - o)` look like an integer argument and produced the 57/70 residue.
10// Both gated by nx_cc_equiv_gate 10/10 + selfhost, shipped via promote_toolchain (canary GREEN).
11// REPRO: change pn_ptr(b) below to pn_ptr(b) and /api/build this target -> refusal expected.
12// Kept VALID in-tree (compiler-root probe convention); the witness is the edit+build cycle.
13// license_tier: ORIGINAL expect_exit: 0
14import "nx_syscalls.nx"
15func pn_ptr(p: *u8) -> i64 { return p[0] as i64 }
16func main(argc: i64, argv: *i64) -> i64 {
17 let b: *u8 = sys_mmap(64)
18 let x: i64 = pn_ptr(b)
19 sys_exit(0)
20 return 0
21}