diff options
Diffstat (limited to 'codegen.c')
| -rw-r--r-- | codegen.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -496,9 +496,10 @@ static void emit_expr( static void emit_return(FILE* outfile, const struct return_node* node) { if (active_fn == NULL) CGEN_PANIC("must be inside a function to return"); + unsigned long long return_type_sz = get_type_size(&active_fn->return_type); if (node->ret_val != NULL) { - if (active_fn->return_type.def->sz == 0) + if (return_type_sz == 0) CGEN_PANIC( "returning a value from void function %s", active_fn->name); @@ -507,9 +508,9 @@ static void emit_return(FILE* outfile, const struct return_node* node) { node->ret_val, &(struct lval_def) { .loc = RV_LOC, - .sz = active_fn->return_type.def->sz, + .sz = return_type_sz, }); - } else if (active_fn->return_type.def->sz > 0) { + } else if (return_type_sz > 0) { CGEN_PANIC( "non-void function %s should return a value", active_fn->name); } |
