commit 9761a80a98bd2f59d922f83862f4faa7a4389861
Author: Roberto E. Vargas Caballero <[email protected]>
AuthorDate: Wed Sep 28 12:28:00 2016 +0200
Commit: Roberto E. Vargas Caballero <[email protected]>
CommitDate: Wed Sep 28 12:28:00 2016 +0200
[cc1] Fix size/offset calculation for structs
The code was adding when it should only assign. With the previous
code we were duplicating the offset for every field with aligment
different of 0.
diff --git a/cc1/types.c b/cc1/types.c
index 44deac6..d49b3e5 100644
--- a/cc1/types.c
+++ b/cc1/types.c
@@ -210,7 +210,7 @@ typesize(Type *tp)
align = a;
if (tp->op == STRUCT) {
if (--a != 0)
- size += (size + a) & ~a;
+ size = (size + a) & ~a;
size += aux->size;
offset = size;
} else {