From b400b6bbdc526f5de357cb2657d79ea0343870bc Mon Sep 17 00:00:00 2001 From: nsfisis Date: Tue, 6 Jan 2026 09:26:13 +0900 Subject: fix: for loop with multiple variable declarations In this C code, for (T v = expr1, u = expr2; ...; ...) { ... } the "expr2" was silently discarded before. --- tests/for_loops.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tests') diff --git a/tests/for_loops.sh b/tests/for_loops.sh index 2e3205f..ef54d06 100644 --- a/tests/for_loops.sh +++ b/tests/for_loops.sh @@ -139,3 +139,20 @@ int main() { } EOF +cat <<'EOF' > expected +0 1 +1 3 +2 5 +3 7 +4 9 +EOF + +test_diff <<'EOF' +int printf(); + +int main() { + for (int i = 0, j = 1; i < 5; i++, j += 2) { + printf("%d %d\n", i, j); + } +} +EOF -- cgit v1.2.3-70-g09d2