diff options
author | Michael Forney <mforney@mforney.org> | 2019-05-16 00:04:07 -0700 |
---|---|---|
committer | Michael Forney <mforney@mforney.org> | 2019-05-16 00:33:57 -0700 |
commit | e4778a0fb68d9a6cc388acab0b4ba68c6d5ea8d4 (patch) | |
tree | 506e221f7564d736ca391871be41813baf612d63 | |
parent | 99d9848603d07114a79093f5fe71d6cf08a606aa (diff) |
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.
-rw-r--r-- | qbe.c | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -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; } |