]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - ir.c
ir: fix bug that functions without declared locals would put temps at position zero ...
[xonotic/gmqcc.git] / ir.c
diff --git a/ir.c b/ir.c
index dcf03e0f2905397a839542194e2b1c58b820fc20..ed01439943131636e368a48cee3b4d45f5d39e65 100644 (file)
--- a/ir.c
+++ b/ir.c
@@ -2548,7 +2548,7 @@ static bool gen_global_function(ir_builder *ir, ir_value *global)
     fun.firstlocal = code_globals_elements;
     fun.locals     = irfun->allocated_locals + irfun->locals_count;
 
-    local_var_end = 0;
+    local_var_end = fun.firstlocal;
     for (i = 0; i < irfun->locals_count; ++i) {
         if (!ir_builder_gen_global(ir, irfun->locals[i])) {
             irerror(irfun->locals[i]->context, "Failed to generate global %s\n", irfun->locals[i]->name);