ref: d555aa6e04f4459fd6bc5f8e1fb07f80cdc29b50
parent: 446f1577da01b4c8a25da882739050832f0698b1
author: Ori Bernstein <[email protected]>
date: Fri Jul 20 13:47:38 EDT 2012
Fix up pointer unwrapping in offsetof().
--- a/8/simp.c
+++ b/8/simp.c
@@ -519,10 +519,9 @@
size_t i;
size_t off;
- if (aggr->expr.type->type == Typtr)
- aggr = aggr->expr.args[0];
- ty = aggr->expr.type;
- ty = tybase(ty);
+ ty = tybase(exprtype(aggr));
+ if (ty->type == Typtr)
+ ty = tybase(ty->sub[0]);
assert(ty->type == Tystruct);
nl = ty->sdecls;