From e4778a0fb68d9a6cc388acab0b4ba68c6d5ea8d4 Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Thu, 16 May 2019 00:04:07 -0700 Subject: 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. --- qbe.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/qbe.c b/qbe.c index 6c1474c..be31952 100644 --- 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; } -- cgit v1.2.3