nx_rw_callarg.nx source
↩ module page · 22 lines · 707 B
1// nx_rw_callarg.nx -- TRAP WITNESS (pack-rules vet). Tactics under test: (a) a call nested inside
2// another call's argument g(h(z)); (b) a call inside an array-store RHS buf[i] = f(x) * 2. The
3// pack forbids both (hoist-first rule). Exit 0 iff BOTH compile and compute correctly.
4// license_tier: ORIGINAL
5import "nx_syscalls.nx"
6
7func rw_inc(x: i64) -> i64 { return x + 1 }
8
9func rw_double(x: i64) -> i64 { return x * 2 }
10
11func main(argc: i64, argv: *i64) -> i64 {
12 let a: i64 = rw_double(rw_inc(4))
13 let buf: *i64 = sys_mmap(64) as *i64
14 var i: i64 = 1
15 buf[i] = rw_inc(9) * 2
16 let b: i64 = buf[i]
17 if a == 10 {
18 if b == 20 { sys_exit(0) }
19 }
20 sys_exit(1)
21 return 0
22}