cproc

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.nihaljere.xyz/cproc
Log | Files | Refs | Submodules | README | LICENSE

commit e4778a0fb68d9a6cc388acab0b4ba68c6d5ea8d4
parent 99d9848603d07114a79093f5fe71d6cf08a606aa
Author: Michael Forney <mforney@mforney.org>
Date:   Thu, 16 May 2019 00:04:07 -0700

qbe: Fix error check for invalid object

The result of funcexpr might be NULL if we are in a dead branch, but
this doesn't mean that we had an invalid object.

Diffstat:
Mqbe.c | 6++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/qbe.c b/qbe.c @@ -537,16 +537,14 @@ funclval(struct func *f, struct expr *e) break; case EXPRUNARY: if (e->op != TMUL) - break; + error(&tok.loc, "expression is not an object"); lval.addr = funcexpr(f, e->base); break; default: if (e->type->kind != TYPESTRUCT && e->type->kind != TYPEUNION) - break; + error(&tok.loc, "expression is not an object"); lval.addr = funcinst(f, ICOPY, &iptr, funcexpr(f, e)); } - if (!lval.addr) - error(&tok.loc, "expression is not an object"); return lval; }