]> Nishi Git Mirror - gwion.git/commitdiff
:bug: Add local if unchecked return is compound
authorfennecdjay <fennecdjay@gmail.com>
Sun, 3 Jul 2022 23:00:05 +0000 (01:00 +0200)
committerfennecdjay <fennecdjay@gmail.com>
Sun, 3 Jul 2022 23:00:05 +0000 (01:00 +0200)
src/emit/emit.c

index 4c321da6638309ce04fdb52ce39b3fef00c146df..4f1700601aa7ab652d26e03132e9b6bc7048e01d 100644 (file)
@@ -2008,6 +2008,8 @@ ANN static m_bool emit_stmt_return(const Emitter emit, const Stmt_Exp stmt) {
       if (stmt->val->exp_type == ae_exp_call && emit->env->func == f)
         return optimize_tail_call(emit, &stmt->val->d.exp_call);
     }
+    if(!stmt->val->ref && isa(stmt->val->type, emit->gwion->type[et_compound]) > 0)
+      emit_local(emit, stmt->val->type);
     CHECK_BB(emit_exp(emit, stmt->val));
   }
   vector_add(&emit->code->stack_return, (vtype)emit_add_instr(emit, Goto));