ref: 9cf66b53a22258baae61a97a9f9b06afd72999cb
parent: 41ce4dfc1dd66f229d63305bf76881afaa137df1
author: Ori Bernstein <orib@google.com>
date: Wed Aug 15 13:11:19 EDT 2012
Make nested structs work.
--- a/6/simp.c
+++ b/6/simp.c
@@ -127,7 +127,7 @@
Node *n;
assert(a->expr.type->type == Typtr);
- n = mkexpr(a->line, Oload, a, NULL);
+ n = mkexpr(a->line, Oderef, a, NULL);
n->expr.type = base(a->expr.type);
return n;
}
@@ -594,9 +594,9 @@
args = n->expr.args;
ty = tybase(exprtype(args[0]));
if (ty->type == Typtr) {
- t = args[0];
+ t = lval(s, args[0]);
} else {
- t = addr(args[0], exprtype(n));
+ t = addr(lval(s, args[0]), exprtype(n));
}
u = disp(n->line, offset(args[0], args[1]));
r = add(t, u);
--
⑨