[hackers] [scc] [cc1] Fix size/offset calculation for structs || Roberto E. Vargas Caballero
commit 9761a80a98bd2f59d922f83862f4faa7a4389861
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Wed Sep 28 12:28:00 2016 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
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
_AT_@ -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 {
Received on Wed Sep 28 2016 - 12:35:15 CEST
This archive was generated by hypermail 2.3.0
: Wed Sep 28 2016 - 12:36:15 CEST