More bug fixes and dead code elimination

This commit is contained in:
Dale Weiler 2013-06-22 01:23:59 +00:00
parent 5429b6f189
commit 063c50fce4
3 changed files with 13 additions and 5 deletions

9
ast.c
View file

@ -2893,10 +2893,13 @@ bool ast_loop_codegen(ast_loop *self, ast_function *func, bool lvalue, ir_value
if (bprecond)
{
ir_block *ontrue, *onfalse;
if (bbody) ontrue = bbody;
ontrue = bbody; /* can never be null */
/* all of this is dead code
else if (bincrement) ontrue = bincrement;
else if (bpostcond) ontrue = bpostcond;
else ontrue = bprecond;
else ontrue = bpostcond;
*/
onfalse = bout;
if (self->pre_not) {
tmpblock = ontrue;

View file

@ -2755,7 +2755,12 @@ static bool parse_dowhile(parser_t *parser, ast_block *block, ast_expression **o
if (vec_last(parser->breaks) != label || vec_last(parser->continues) != label) {
parseerror(parser, "internal error: label stack corrupted");
rv = false;
ast_delete(*out);
/*
* Test for NULL otherwise ast_delete dereferences null pointer
* and boom.
*/
if (*out)
ast_delete(*out);
*out = NULL;
}
else {

2
test.c
View file

@ -896,7 +896,7 @@ static void task_destroy(void) {
else
util_debug("TEST", "removed stderr log file: %s\n", task_tasks[i].stderrlogfile);
remove(task_tasks[i].tmpl->tempfilename);
(void)!remove(task_tasks[i].tmpl->tempfilename);
}
/* free util_strdup data for log files */