]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
Still need to generate the jump...
authorWolfgang (Blub) Bumiller <blub@speed.at>
Fri, 30 Nov 2012 11:23:27 +0000 (12:23 +0100)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Fri, 30 Nov 2012 11:23:27 +0000 (12:23 +0100)
ast.c

diff --git a/ast.c b/ast.c
index 7afe3fb0ccdd19b38d592e4b4b40806722b6c0a5..417fc15acbf6b01814da15fc7df974e890f199a8 100644 (file)
--- a/ast.c
+++ b/ast.c
@@ -2082,7 +2082,7 @@ bool ast_ifthen_codegen(ast_ifthen *self, ast_function *func, bool lvalue, ir_va
     ir_block *onfalse;
     ir_block *ontrue_endblock = NULL;
     ir_block *onfalse_endblock = NULL;
-    ir_block *merge;
+    ir_block *merge = NULL;
 
     /* We don't output any value, thus also don't care about r/lvalue */
     (void)out;
@@ -2154,19 +2154,19 @@ bool ast_ifthen_codegen(ast_ifthen *self, ast_function *func, bool lvalue, ir_va
         if (onfalse && !onfalse_endblock->final && !ir_block_create_jump(onfalse_endblock, merge))
             return false;
 
-        /* we create the if here, that way all blocks are ordered :)
-         */
-        if (!ir_block_create_if(cond, condval,
-                                (ontrue  ? ontrue  : merge),
-                                (onfalse ? onfalse : merge)))
-        {
-            return false;
-        }
-
         /* Now enter the merge block */
         func->curblock = merge;
     }
 
+    /* we create the if here, that way all blocks are ordered :)
+     */
+    if (!ir_block_create_if(cond, condval,
+                            (ontrue  ? ontrue  : merge),
+                            (onfalse ? onfalse : merge)))
+    {
+        return false;
+    }
+
     return true;
 }