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 d36d945c646800a23a4d4f8c05ab3f2ca4c8f535
parent 792beff25a6ca5aaf26d5a6dd2449f2e0aefbebb
Author: Michael Forney <mforney@mforney.org>
Date:   Wed, 13 Feb 2019 18:04:28 -0800

Add some missing lvalue conversions

Diffstat:
Mexpr.c | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)

diff --git a/expr.c b/expr.c @@ -479,6 +479,7 @@ postfixexpr(struct scope *s, struct expression *r) /* fallthrough */ case TARROW: op = tok.kind; + lvalueconvert(r); if (r->type->kind != TYPEPOINTER) error(&tok.loc, "arrow operator must be applied to pointer to struct/union"); tq = QUALNONE; @@ -556,6 +557,7 @@ unaryexpr(struct scope *s) case TMUL: next(); l = castexpr(s); + lvalueconvert(l); if (l->type->kind != TYPEPOINTER) error(&tok.loc, "cannot dereference non-pointer"); e = mkexpr(EXPRUNARY, l->type->base, EXPRFLAG_LVAL); @@ -823,6 +825,7 @@ assignexpr(struct scope *s) } next(); r = assignexpr(s); + lvalueconvert(r); if (op) { /* rewrite `E1 OP= E2` as `T = &E1, *T = *T OP E2`, where T is a temporary slot */ tmp = mkexpr(EXPRTEMP, mkpointertype(l->type), EXPRFLAG_LVAL);