aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-05-05 13:59:13 +0900
committernsfisis <nsfisis@gmail.com>2025-05-05 13:59:13 +0900
commitd0642298179e9aa2ea3c20c132417a5842979daa (patch)
treee526c14898455af1b786795ce046426329e940ff
parentd69d3821580cceb37a8c8f4a270db8d2c3f6d1c8 (diff)
downloadP4Dcc-d0642298179e9aa2ea3c20c132417a5842979daa.tar.gz
P4Dcc-d0642298179e9aa2ea3c20c132417a5842979daa.tar.zst
P4Dcc-d0642298179e9aa2ea3c20c132417a5842979daa.zip
fix issue where "for" init expr is not popped out
-rw-r--r--main.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/main.c b/main.c
index 8b7e1c5..05d2a2e 100644
--- a/main.c
+++ b/main.c
@@ -1752,6 +1752,7 @@ void gen_for_stmt(struct CodeGen* g, struct AstNode* ast) {
if (ast->expr1) {
gen_expr(g, ast->expr1, GEN_RVAL);
+ printf(" pop rax\n");
}
printf(".Lbegin%d:\n", label);
gen_expr(g, ast->expr2, GEN_RVAL);