From 46f50ee76c1b97bdddc56e594e24d946c4f4b621 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sat, 23 May 2020 17:25:13 -0400 Subject: [PATCH] translate-c: fix regression in do-while loop --- src-self-hosted/translate_c.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src-self-hosted/translate_c.zig b/src-self-hosted/translate_c.zig index 9efbe282e..428b8e11c 100644 --- a/src-self-hosted/translate_c.zig +++ b/src-self-hosted/translate_c.zig @@ -2478,8 +2478,8 @@ fn transDoWhileLoop( }; // In both cases above, we reserved 1 extra statement. - body_node.statements()[body_node.statements_len] = &if_node.base; body_node.statements_len += 1; + body_node.statements()[body_node.statements_len - 1] = &if_node.base; if (new) body_node.rbrace = try appendToken(rp.c, .RBrace, "}"); while_node.body = &body_node.base;