Don't segfault on bare return statements.

I will probably need to do something about the required operand for v6
progs, but this will do for now.
This commit is contained in:
Bill Currie 2011-01-30 21:43:56 +09:00
parent 440a13b649
commit e7424e1496

View file

@ -758,8 +758,10 @@ statement_uexpr (sblock_t *sblock, expr_t *e)
if (!e->e.expr.e1 && !options.traditional)
opcode = "<RETURN_V>";
s = new_statement (opcode);
sblock = statement_subexpr (sblock, e->e.expr.e1, &s->opa);
s->opa->type = ev_void;
if (e->e.expr.e1) {
sblock = statement_subexpr (sblock, e->e.expr.e1, &s->opa);
s->opa->type = ev_void;
}
sblock_add_statement (sblock, s);
sblock->next = new_sblock ();
sblock = sblock->next;