]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
Temporarily fix noreturn bug by creating an actual dummy return instruction after...
authorWolfgang Bumiller <blub@speed.at>
Thu, 20 Dec 2012 15:20:08 +0000 (16:20 +0100)
committerWolfgang Bumiller <blub@speed.at>
Thu, 20 Dec 2012 15:20:08 +0000 (16:20 +0100)
ir.c

diff --git a/ir.c b/ir.c
index 5161108c80dfe6d6600d2831bb7db50bfd5b1364..30cdda9095cafcd7850bf89b3b9ac41a42a291e6 100644 (file)
--- a/ir.c
+++ b/ir.c
@@ -1586,10 +1586,12 @@ ir_instr* ir_block_create_call(ir_block *self, lex_ctx ctx, const char *label, i
     in = ir_instr_new(ctx, self, (noreturn ? VINSTR_NRCALL : INSTR_CALL0));
     if (!in)
         return NULL;
     in = ir_instr_new(ctx, self, (noreturn ? VINSTR_NRCALL : INSTR_CALL0));
     if (!in)
         return NULL;
+    /*
     if (noreturn) {
         self->final = true;
         self->is_return = true;
     }
     if (noreturn) {
         self->final = true;
         self->is_return = true;
     }
+    */
     out = ir_value_out(self->owner, label, (func->outtype == TYPE_VOID) ? store_return : store_value, func->outtype);
     if (!out) {
         ir_instr_delete(in);
     out = ir_value_out(self->owner, label, (func->outtype == TYPE_VOID) ? store_return : store_value, func->outtype);
     if (!out) {
         ir_instr_delete(in);
@@ -1603,6 +1605,13 @@ ir_instr* ir_block_create_call(ir_block *self, lex_ctx ctx, const char *label, i
         return NULL;
     }
     vec_push(self->instr, in);
         return NULL;
     }
     vec_push(self->instr, in);
+    if (noreturn) {
+        if (!ir_block_create_return(self, ctx, NULL)) {
+            compile_error(ctx, "internal error: failed to generate dummy-return instruction");
+            ir_instr_delete(in);
+            return NULL;
+        }
+    }
     return in;
 }
 
     return in;
 }