_offc_minrepro.nx source
↩ module page · 13 lines · 425 B
1import "syscalls.nx"
2
3// Minimal repro for the main()-miscompile bug found in stage 3.
4// Expected behavior: prints "A\n" to stdout, exits 0.
5// Observed in nxc.elf: no output, exit 0 (sys_mmap call elided,
6// pointer arithmetic uses i64 stride instead of u8 stride).
7func main() -> i64 {
8 let p: *u8 = sys_mmap(16)
9 p[0] = 65 // 'A'
10 p[1] = 10 // '\n'
11 sys_write(1, p, 2)
12 return 0
13}