nx_rw_castidx.nx source
↩ module page · 15 lines · 560 B
1// nx_rw_castidx.nx -- TRAP WITNESS (pack-rules vet). Tactic under test: indexing the result of an
2// `as *T` cast in ONE expression ((raw) as *i64)[2] -- the documented 2026-07-09 miscompile
3// (returns pointer-magnitude garbage). Exit 0 iff the inline form reads the correct value.
4// license_tier: ORIGINAL
5import "nx_syscalls.nx"
6
7func main(argc: i64, argv: *i64) -> i64 {
8 let raw: *u8 = sys_mmap(64) as *u8
9 let p: *i64 = raw as *i64
10 p[2] = 777
11 let v: i64 = ((raw) as *i64)[2]
12 if v == 777 { sys_exit(0) }
13 sys_exit(1)
14 return 0
15}