summaryrefslogtreecommitdiff
path: root/6/simp.c
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-12-29 01:43:27 -0800
committerOri Bernstein <ori@eigenstate.org>2015-12-29 01:43:27 -0800
commit30c37c6b26a9be12a7e07628a170ba32d1861ef0 (patch)
treec96401a2977a357d0b7fce0a8fd75e9f85f49dcf /6/simp.c
parente11e5f143419b049f2c93a4b361a668b57a77fc0 (diff)
downloadmc-30c37c6b26a9be12a7e07628a170ba32d1861ef0.tar.gz
Correct alignment of unions.
Diffstat (limited to '6/simp.c')
-rw-r--r--6/simp.c23
1 files changed, 1 insertions, 22 deletions
diff --git a/6/simp.c b/6/simp.c
index f150d8e..d3505b9 100644
--- a/6/simp.c
+++ b/6/simp.c
@@ -95,28 +95,7 @@ static int ispure(Node *n)
size_t alignto(size_t sz, Type *t)
{
- size_t a;
- size_t i;
-
- t = tybase(t);
- a = 0;
- switch (t->type) {
- case Tyarray:
- a = alignto(1, t->sub[0]);
- case Tytuple:
- for (i = 0; i < t->nsub; i++)
- a = max(alignto(1, t->sub[i]), a);
- break;
- case Tystruct:
- for (i = 0; i < t->nmemb; i++)
- a = max(alignto(1, decltype(t->sdecls[i])), a);
- break;
- default:
- a = tysize(t);
- break;
- }
-
- return align(sz, min(a, Ptrsz));
+ return align(sz, tyalign(t));
}
static Type *base(Type *t)