aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2019-02-12 15:32:05 -0800
committerMichael Forney <mforney@mforney.org>2019-02-12 15:32:05 -0800
commitbf348610b7e133e7b06b7f0275509d77adf17a38 (patch)
tree5333af22fb47b960bb2fe3076cf510a07e2499d6
parent3556b3d1c8fa6282a0dcc0764e5d8cf619333800 (diff)
downloadcproc-bf348610b7e133e7b06b7f0275509d77adf17a38.tar.xz
Fix adding pointer to integer
-rw-r--r--expr.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/expr.c b/expr.c
index 9e92fd3..683d117 100644
--- a/expr.c
+++ b/expr.c
@@ -309,6 +309,7 @@ mkbinaryexpr(struct location *loc, enum tokenkind op, struct expression *l, stru
r = mkbinaryexpr(loc, TMUL, exprconvert(r, &typeulong), mkconstexpr(&typeulong, t->base->size));
} else if (lp & PROPINT && r->type->kind == TYPEPOINTER) {
t = r->type;
+ l = mkbinaryexpr(loc, TMUL, exprconvert(l, &typeulong), mkconstexpr(&typeulong, t->base->size));
} else {
error(loc, "invalid operands to '+' operator");
}