]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - ir.c
Merge branch 'cooking' of github.com:graphitemaster/gmqcc into cooking
[xonotic/gmqcc.git] / ir.c
diff --git a/ir.c b/ir.c
index 50100107b3f281c457374774202995a98358815e..84455d56a2d48dc0b72bdd31e44e9a699521dfc7 100644 (file)
--- a/ir.c
+++ b/ir.c
@@ -3151,14 +3151,14 @@ static bool gen_function_varargs_copy(ir_function *self)
     stmt.o3.s1 = 0;
     maxparams = numparams + self->max_varargs;
     for (i = numparams; i < maxparams; ++i) {
-        if (i <= 8) {
+        if (i < 8) {
             stmt.o1.u1 = OFS_PARM0 + 3*i;
             stmt.o2.u1 = ir_value_code_addr(self->locals[i]);
             code_push_statement(&stmt, self->context.line);
             continue;
         }
-        ext = i - 9;
-        if (ext >= vec_size(ir->extparams))
+        ext = i - 8;
+        while (ext >= vec_size(ir->extparams))
             ir_gen_extparam(ir);
 
         ep = ir->extparams[ext];
@@ -3292,6 +3292,8 @@ static void gen_vector_defs(prog_section_def def, const char *name)
         def.offset++;
         component[len-1]++;
     }
+
+    mem_d(component);
 }
 
 static void gen_vector_fields(prog_section_field fld, const char *name)
@@ -3320,6 +3322,8 @@ static void gen_vector_fields(prog_section_field fld, const char *name)
         fld.offset++;
         component[len-1]++;
     }
+
+    mem_d(component);
 }
 
 static bool ir_builder_gen_global(ir_builder *self, ir_value *global, bool islocal)
@@ -3327,7 +3331,7 @@ static bool ir_builder_gen_global(ir_builder *self, ir_value *global, bool isloc
     size_t           i;
     int32_t         *iptr;
     prog_section_def def;
-    bool             pushdef = false;
+    bool             pushdef = opts.optimizeoff;
 
     def.type   = global->vtype;
     def.offset = vec_size(code_globals);