aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qbe.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/qbe.c b/qbe.c
index 670ad83..c6986b4 100644
--- a/qbe.c
+++ b/qbe.c
@@ -1038,7 +1038,7 @@ emitfunc(struct function *f, bool global)
size_t n;
if (!f->end->terminated)
- funcret(f, NULL);
+ funcret(f, strcmp(f->name, "main") == 0 ? mkintconst(&i32, 0) : NULL);
if (global)
puts("export");
fputs("function ", stdout);