summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2013-03-20 11:44:24 -0400
committerOri Bernstein <ori@eigenstate.org>2013-03-20 11:44:24 -0400
commita2d39ddf4e0d6dc324bd0af41d89c942f4f8a49c (patch)
tree98d1ed1c382d309fb6159ff2818d42204b352e68
parent058840464506a633eae1c49e349a242be31dba69 (diff)
downloadmc-a2d39ddf4e0d6dc324bd0af41d89c942f4f8a49c.tar.gz
Calculate the size to blit when creating a union correctly.
-rw-r--r--6/simp.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/6/simp.c b/6/simp.c
index a4aa494..4521283 100644
--- a/6/simp.c
+++ b/6/simp.c
@@ -295,10 +295,10 @@ size_t tysize(Type *t)
return sz;
break;
case Tyunion:
- sz = Ptrsz;
+ sz = Wordsz;
for (i = 0; i < t->nmemb; i++)
if (t->udecls[i]->etype)
- sz = max(sz, tysize(t->udecls[i]->etype) + Ptrsz);
+ sz = max(sz, tysize(t->udecls[i]->etype) + Wordsz);
return align(sz, Ptrsz);
break;
case Tybad: case Tyvar: case Typaram: case Tyunres: case Tygeneric: case Ntypes:
@@ -987,7 +987,7 @@ static Node *simpucon(Simp *s, Node *n, Node *dst)
u = addk(u, Wordsz);
if (stacktype(uc->etype)) {
elt = addr(s, elt, uc->etype);
- sz = disp(n->line, tysize(uc->utype));
+ sz = disp(n->line, tysize(uc->etype));
r = mkexpr(n->line, Oblit, u, elt, sz, NULL);
} else {
r = set(deref(u), elt);