aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2019-02-21 00:58:04 -0800
committerMichael Forney <mforney@mforney.org>2019-02-21 00:58:04 -0800
commit82d4b0852ecb1cda828a072be919d846eb326f77 (patch)
tree755a36db39856b96510ddd565e39a69a114cbc96
parent0f31c1e97fa86ca4c82ce726852621380ddc8c46 (diff)
downloadcproc-82d4b0852ecb1cda828a072be919d846eb326f77.tar.xz
Fix decay on qualified array types
-rw-r--r--expr.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/expr.c b/expr.c
index 2db2622..97b2fd5 100644
--- a/expr.c
+++ b/expr.c
@@ -54,7 +54,6 @@ static struct expression *mkunaryexpr(enum tokenkind, struct expression *);
static struct expression *
decay(struct expression *e)
{
- struct expression *old = e;
struct type *t;
enum typequalifier tq = QUALNONE;
@@ -62,12 +61,12 @@ decay(struct expression *e)
t = typeunqual(e->type, &tq);
switch (t->kind) {
case TYPEARRAY:
- e = mkunaryexpr(TBAND, old);
- e->type = mkqualifiedtype(mkpointertype(old->type->base), tq);
+ e = mkunaryexpr(TBAND, e);
+ e->type = mkqualifiedtype(mkpointertype(t->base), tq);
e->flags |= EXPRFLAG_DECAYED;
break;
case TYPEFUNC:
- e = mkunaryexpr(TBAND, old);
+ e = mkunaryexpr(TBAND, e);
e->flags |= EXPRFLAG_DECAYED;
break;
}