nx_empty_lit_probe.nx source
↩ module page · 24 lines · 1099 B
1// nx_empty_lit_probe.nx -- WITNESS for the empty-string-literal codegen bug (2026-07-16).
2// Hypothesis (from swarm_sched store bytes): `"" as *u8` emits a label with NO bytes (not even the
3// NUL terminator), so the pointer lands ON the next literal in the pool -- strlen("")==len(next
4// literal), and ("" as i64)==("HOLD" as i64). If the pool is correct: strlen=0, delta>=1, first=0.
5// license_tier: ORIGINAL expect_exit: 0
6import "nx_lib_std.nx"
7
8func main(argc: i64, argv: *i64) -> i64 {
9 let e: *u8 = "" as *u8
10 let h: *u8 = "HOLD" as *u8
11 var n: i64 = 0
12 while e[n] != (0 as u8) { n = n + 1 }
13 std_puts("EMPTY-LIT strlen=" as *u8)
14 std_pdec(n)
15 std_puts(" delta_to_next=" as *u8)
16 std_pdec((h as i64) - (e as i64))
17 std_puts(" first_byte=" as *u8)
18 std_pdec(e[0] as i64)
19 std_puts("\n" as *u8)
20 if n == 0 { std_putln("VERDICT: empty literal CORRECT (bug not present in this build lane)" as *u8) }
21 if n != 0 { std_putln("VERDICT: empty literal BROKEN (points into the next literal) -- never use \"\" as *u8" as *u8) }
22 sys_exit(0)
23 return 0
24}