diff options
| author | nsfisis <nsfisis@gmail.com> | 2025-05-03 17:57:08 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2025-05-03 17:57:08 +0900 |
| commit | 79e00de77709e1a8a9a12939c59606e38b27e52f (patch) | |
| tree | 3cc4c38a513800c0829c5708dc6911417957b309 | |
| parent | fa1b51ea49e2902fcf778c2547f9f332640320f1 (diff) | |
| download | P4Dcc-79e00de77709e1a8a9a12939c59606e38b27e52f.tar.gz P4Dcc-79e00de77709e1a8a9a12939c59606e38b27e52f.tar.zst P4Dcc-79e00de77709e1a8a9a12939c59606e38b27e52f.zip | |
fix code generation failure if "if" stmt has no "else" clause
| -rw-r--r-- | main.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -841,7 +841,9 @@ void gen_if_stmt(CODEGEN* g, AST* ast) { gen_stmt(g, ast->node1); printf(" jmp .Lend%d\n", label); printf(".Lelse%d:\n", label); - gen_stmt(g, ast->node2); + if (ast->node2) { + gen_stmt(g, ast->node2); + } printf(".Lend%d:\n", label); } |
