Fix some bugs and a memleak in the testsuite.

This commit is contained in:
Dale Weiler 2013-06-22 01:56:22 +00:00
parent 063c50fce4
commit bbffdde2dc
3 changed files with 10 additions and 5 deletions

6
ast.c
View file

@ -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;

5
ir.c
View file

@ -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));

4
test.c
View file

@ -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);
}