From: Dale Weiler Date: Sat, 22 Jun 2013 01:56:22 +0000 (+0000) Subject: Fix some bugs and a memleak in the testsuite. X-Git-Tag: v0.3.0~84 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=bbffdde2dc5503cc6da92b4e7291c5b5e139de98;p=xonotic%2Fgmqcc.git Fix some bugs and a memleak in the testsuite. --- diff --git a/ast.c b/ast.c index 584bda0..87d34ce 100644 --- a/ast.c +++ b/ast.c @@ -2883,9 +2883,13 @@ bool ast_loop_codegen(ast_loop *self, ast_function *func, bool lvalue, ir_value /* Now all blocks are in place */ /* From 'bin' we jump to whatever comes first */ if (bprecond) tmpblock = bprecond; - else if (bbody) tmpblock = bbody; + else tmpblock = bbody; /* can never be null */ + + /* DEAD CODE else if (bpostcond) tmpblock = bpostcond; else tmpblock = bout; + */ + if (!ir_block_create_jump(bin, ast_ctx(self), tmpblock)) return false; diff --git a/ir.c b/ir.c index 72e7406..3fe9908 100644 --- a/ir.c +++ b/ir.c @@ -2584,7 +2584,8 @@ bool ir_function_calculate_liferanges(ir_function *self) /* parameters live at 0 */ for (i = 0; i < vec_size(self->params); ++i) - ir_value_life_merge(self->locals[i], 0); + if (!ir_value_life_merge(self->locals[i], 0)) + compile_error(self->context, "internal error: failed value-life merging"); do { self->run_id++; @@ -3875,7 +3876,7 @@ void ir_block_dump(ir_block* b, char *ind, { size_t i; oprintf("%s:%s\n", ind, b->label); - strncat(ind, "\t", IND_BUFSZ); + strncat(ind, "\t", IND_BUFSZ-1); if (b->instr && b->instr[0]) oprintf("%s (%i) [entry]\n", ind, (int)(b->instr[0]->eid-1)); diff --git a/test.c b/test.c index 29aefc1..d49575c 100644 --- a/test.c +++ b/test.c @@ -110,8 +110,7 @@ static FILE ** task_popen(const char *command, const char *mode) { data->handles[2] = fdopen(errhandle[0], mode); /* sigh */ - if (argv) - vec_free(argv); + vec_free(argv); return data->handles; } else if (data->pid == 0) { /* child */ @@ -639,6 +638,7 @@ static void task_template_destroy(task_template_t **tmpl) { * Nullify all the template members otherwise NULL comparision * checks will fail if tmpl pointer is reused. */ + mem_d((*tmpl)->tempfilename); mem_d(*tmpl); }