From 6463228d028a4755ef819dcfbbf6426e3a9f8626 Mon Sep 17 00:00:00 2001 From: eunhhu Date: Mon, 19 Oct 2026 07:23:29 +0100 Subject: Lists declared together: three names or more made the statements a cycle (each copy took the first's next, the copy before it), so the compiler never ended (found writing linebreak.aup's nine lists as two lines); frictions declares four --- compiler/compile.c | 2 +- tests/check.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/compiler/compile.c b/compiler/compile.c index 26e7172..f161182 100644 --- a/compiler/compile.c +++ b/compiler/compile.c @@ -1354,7 +1354,7 @@ static Stmt *statement(Compiler *c, unsigned depth) { for (unsigned i = 1; i < s->name_count; ++i) { Stmt *other = allocate(c, sizeof(*other)); *other = *s; - other->names = NULL, other->name_count = 0; + other->names = NULL, other->name_count = 0, other->next = NULL; /* (s's next is the first other by now) */ memcpy(other->name, s->names[i], NAME); last = last->next = other; } diff --git a/tests/check.py b/tests/check.py index 9368854..4a9daea 100644 --- a/tests/check.py +++ b/tests/check.py @@ -714,8 +714,10 @@ on go { ns.append(0) ns[0], ns[1] = 3, go.k b = b + ns[0] * 100 + ns[1] - let xs, ys: list of number + let xs, ys, zs, us: list of number let ps, qs: list of P + zs.append(1) + us.append(2) for w in 0 .. go.k { xs.append(w) ys.append(w * 2) @@ -731,7 +733,7 @@ on go { for v in xs { t = t + v } for v in ys { t = t + v * 100 } for p in ps { t = t + p.x * 10000 } - total = t + qs.count + total = t + qs.count + (zs.count + us.count - 2) * 1000000 } ''' -- cgit v1.2.3