]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
bodyless loops still have to loop
authorWolfgang (Blub) Bumiller <blub@speed.at>
Fri, 30 Nov 2012 20:34:49 +0000 (21:34 +0100)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Fri, 30 Nov 2012 20:34:49 +0000 (21:34 +0100)
ast.c

diff --git a/ast.c b/ast.c
index 5d824d0c44e5cf62651708a6eee6c2a6bcf84fc7..40a53a3f3c7ed19a3a253e0496b79fb1ab2c030d 100644 (file)
--- a/ast.c
+++ b/ast.c
@@ -2420,7 +2420,7 @@ bool ast_loop_codegen(ast_loop *self, ast_function *func, bool lvalue, ir_value
     bbreak = bout;
 
     /* The loop body... */
-    if (self->body)
+    /* if (self->body) */
     {
         bbody = ir_function_create_block(ast_ctx(self), func->ir_func, ast_function_label(func, "loop_body"));
         if (!bbody)
@@ -2437,9 +2437,11 @@ bool ast_loop_codegen(ast_loop *self, ast_function *func, bool lvalue, ir_value
             func->continueblock = bbody;
 
         /* generate */
-        cgen = self->body->expression.codegen;
-        if (!(*cgen)((ast_expression*)(self->body), func, false, &dummy))
-            return false;
+        if (self->body) {
+            cgen = self->body->expression.codegen;
+            if (!(*cgen)((ast_expression*)(self->body), func, false, &dummy))
+                return false;
+        }
 
         end_bbody = func->curblock;
         func->breakblock    = old_bbreak;