From be43babc1886fc5efee898b2a3d0285012e511fb Mon Sep 17 00:00:00 2001 From: zinc Date: Thu, 15 Oct 2026 22:15:38 +0330 Subject: definite assignment: reading a local before it is initialized is a compile error (spec 4.1.5, b.1.9) track linited per local alongside the ownership state; snapshots, exit records and joins carry it, and a join keeps a local set only when every reaching path set it. x = e, a declaration initializer, &x (out-parameter), a full array initializer, or using an aggregate as an address set a local; field and element writes do not set the aggregate. while/for bodies that may run zero times do not count; do/while does. compiler, runtime, std, actor and lsp sources initialize the locals the rule flagged; zc0 accepts = {} brace lists (zeroed). tests: tests/errors/uninit_*.zc, tests/conformance/4-statements/uninit_*.zc --- src/compiler/lex.zc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/compiler/lex.zc') diff --git a/src/compiler/lex.zc b/src/compiler/lex.zc index 95415a6..3b810ba 100644 --- a/src/compiler/lex.zc +++ b/src/compiler/lex.zc @@ -377,7 +377,7 @@ int fieldscan(int n) { // before a program it joins to the runtime. the rest of the line is read here and the marker kept: the // source is read once to find the signatures and again to compile, and it counts only when compiling reaches it. int mark_line() { - char[300] b; int n = 0, i, base; word name; + char[300] b = {}; int n = 0, i, base; word name; while (ch >= 0 && ch != 10) { if (n < 298) { b[n] = ch; n++; } nextch(); } while (n && (b[n - 1] == 13 || b[n - 1] == 32)) n--; b[n] = 0; -- cgit v1.2.3