aboutsummaryrefslogtreecommitdiff
path: root/src/generator.c
diff options
context:
space:
mode:
authorMustafa Quraish <[email protected]>2022-02-02 19:35:04 -0500
committerMustafa Quraish <[email protected]>2022-02-02 19:44:36 -0500
commita9e4d231808aba5b146197ab59450c9035354b7f (patch)
tree4cd466cc362c3359ff9a276ef33a4fe3b49cb7c5 /src/generator.c
parentHandle OP_ASSIGN in `print_ast()` (diff)
downloadcup-a9e4d231808aba5b146197ab59450c9035354b7f.tar.xz
cup-a9e4d231808aba5b146197ab59450c9035354b7f.zip
Remove default initialization to 0 for variable declarations
This made sense when all variables were of the same size, but now with arrays we don't initialize them by default. Perhaps we should find a way to 0-initialize all the memory?
Diffstat (limited to 'src/generator.c')
-rw-r--r--src/generator.c5
1 files changed, 0 insertions, 5 deletions
diff --git a/src/generator.c b/src/generator.c
index f9aa787..4814f4f 100644
--- a/src/generator.c
+++ b/src/generator.c
@@ -280,11 +280,6 @@ void generate_statement(Node *stmt, FILE *out)
generate_expr_into_rax(stmt->var_decl.value, out);
i64 offset = stmt->var_decl.var.offset;
fprintf(out, " mov [rbp-%lld], rax\n", offset);
- } else {
- // Initialize to 0
- i64 offset = stmt->var_decl.var.offset;
- // TODO: Use correct size for the type
- fprintf(out, " mov qword [rbp-%lld], 0\n", offset);
}
} else if (stmt->type == AST_IF) {
assert(stmt->conditional.cond);