]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
ir_block_create_{phi,call} now check self->final
authorWolfgang (Blub) Bumiller <blub@speed.at>
Wed, 19 Dec 2012 19:39:44 +0000 (20:39 +0100)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Wed, 19 Dec 2012 19:39:44 +0000 (20:39 +0100)
ir.c

diff --git a/ir.c b/ir.c
index 411fcdc55377c8cf3d8277e123355224920fe0b4..009cf764a7e26b04ce78df67fc28be4f3c19abe1 100644 (file)
--- a/ir.c
+++ b/ir.c
@@ -1525,6 +1525,10 @@ ir_instr* ir_block_create_phi(ir_block *self, lex_ctx ctx, const char *label, in
 {
     ir_value *out;
     ir_instr *in;
+    if (self->final) {
+        irerror(self->context, "unreachable statement (%s)", self->label);
+        return false;
+    }
     in = ir_instr_new(ctx, self, VINSTR_PHI);
     if (!in)
         return NULL;
@@ -1570,6 +1574,10 @@ ir_instr* ir_block_create_call(ir_block *self, lex_ctx ctx, const char *label, i
 {
     ir_value *out;
     ir_instr *in;
+    if (self->final) {
+        irerror(self->context, "unreachable statement (%s)", self->label);
+        return false;
+    }
     in = ir_instr_new(ctx, self, (noreturn ? VINSTR_NRCALL : INSTR_CALL0));
     if (!in)
         return NULL;