aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2019-05-16 00:04:07 -0700
committerMichael Forney <mforney@mforney.org>2019-05-16 00:33:57 -0700
commite4778a0fb68d9a6cc388acab0b4ba68c6d5ea8d4 (patch)
tree506e221f7564d736ca391871be41813baf612d63
parent99d9848603d07114a79093f5fe71d6cf08a606aa (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.c6
1 files 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;
}