code wiki / (root) / nx_fbench_negctl.nx

nx_fbench_negctl.nx source

↩ module page · 17 lines · 857 B

1// nx_fbench_negctl.nx -- NEGATIVE CONTROL v2 (output-level) for the forge gap-bench judge. 2// Builds GREEN on purpose but prints a WRONG result line (54, hardcoded). The byte-exact 3// output comparator MUST reject it, and the source-literal check MUST flag the hardcode. 4// v1 finding (banked): the simple `1 +\n2` multi-line-expr shape did NOT trip nx_cc on 5// 2026-07-12 -- the statement-boundary gotcha is shape-dependent; build-level judge 6// discrimination is witnessed by the three raw-condition failures instead. 7import "nx_syscalls.nx" 8 9func nc_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } 10 11func nc_puts(s: *u8) -> i64 { let n: i64 = nc_slen(s); sys_write(1, s, n); return 0 } 12 13func main(argc: i64, argv: *i64) -> i64 { 14 nc_puts("FBENCH-T1 fib10=54 sum100=5050\n" as *u8) 15 sys_exit(0) 16 return 0 17}