nx_smoke_repro2.nx source
↩ module page · 51 lines · 1125 B
1// smoke_repro2.nx -- closer to the lex_ident_or_kw shape.
2// Adds a function call inside the loop body.
3
4// nx_safety_envelope:
5// intended_use: AUTO_APPLIED -- primitive-specific tuning queued
6// sil_target: SIL1
7// evidence: [bulk_applied_2026-05-16, see-file-comment-for-detail]
8// verdict: NOT_YET_EVALUATED
9
10import "nx_syscalls.nx"
11
12struct S {
13 src: *u8,
14 pos: i64,
15}
16
17func peek2(L: *S) -> i64 {
18 let s: *u8 = L.src
19 return s[L.pos]
20}
21
22func is_alpha2(c: i64) -> i64 {
23 if c >= 0x41 { if c <= 0x5A { return 1 } }
24 if c >= 0x61 { if c <= 0x7A { return 1 } }
25 return 0
26}
27
28func work(L: *S) -> i64 {
29 let raw: *u8 = sys_mmap(96)
30 let t: *S = raw as *S
31 t.src = 0 as *u8
32 t.pos = 0
33 var i: i64 = 0
34 while i < 3 {
35 let c: i64 = peek2(L)
36 if is_alpha2(c) {
37 i = i + 1
38 }
39 if is_alpha2(c) == 0 { break }
40 }
41 return i
42}
43
44func main() -> i64 {
45 let raw: *u8 = sys_mmap(64)
46 let L: *S = raw as *S
47 L.src = "abc"
48 L.pos = 0
49 let r: i64 = work(L)
50 return __syscall(93, r, 0, 0, 0, 0, 0)
51}