diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-01-06 09:26:13 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-01-06 09:26:13 +0900 |
| commit | b400b6bbdc526f5de357cb2657d79ea0343870bc (patch) | |
| tree | dc5faeb2f26221b16d7b0b65058ac9d8ce344d1d /tests | |
| parent | 4fd882beeee2ccbcc5b097cde9ba0e32b1b99a3e (diff) | |
| download | ducc-b400b6bbdc526f5de357cb2657d79ea0343870bc.tar.gz ducc-b400b6bbdc526f5de357cb2657d79ea0343870bc.tar.zst ducc-b400b6bbdc526f5de357cb2657d79ea0343870bc.zip | |
fix: for loop with multiple variable declarations
In this C code,
for (T v = expr1, u = expr2; ...; ...) { ... }
the "expr2" was silently discarded before.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/for_loops.sh | 17 |
1 files changed, 17 insertions, 0 deletions
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 |
