diff options
author | Michael Forney <mforney@mforney.org> | 2020-04-05 15:35:28 -0700 |
---|---|---|
committer | Michael Forney <mforney@mforney.org> | 2020-04-05 15:35:28 -0700 |
commit | 045ddffae08419e2df9f40b878ecd58e705275e1 (patch) | |
tree | e5a9c96980ed10bb70ca86236794c5d0c186f218 | |
parent | 87cf5431f3ed9ed5fa4a8b99cd5b9582ebff23ae (diff) | |
download | cproc-045ddffae08419e2df9f40b878ecd58e705275e1.tar.xz |
expr: Just ignore decayed operand in unary `&` operator
Reusing the decayed expression is more complicated, and only saved
one malloc.
-rw-r--r-- | expr.c | 11 |
1 files changed, 3 insertions, 8 deletions
@@ -119,14 +119,9 @@ mkunaryexpr(enum tokenkind op, struct expr *base) switch (op) { case TBAND: if (base->decayed) { - /* - An array gets decayed to a pointer to its first element, - but with an explicit '&' operator, it is a pointer to - the array. - */ - base->type = mkpointertype(base->base->type, base->base->qual); - base->decayed = false; - return base; + expr = base; + base = base->base; + free(expr); } /* Allow struct and union types even if they are not lvalues, |