scc

simple C compiler
git clone git@git.2f30.org/scc.git
Log | Files | Refs | README | LICENSE

commit 9761a80a98bd2f59d922f83862f4faa7a4389861
parent fb1c921d30051447b2de4fb500de943e270756fe
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Wed, 28 Sep 2016 12:28:00 +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.

Diffstat:
Mcc1/types.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 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 {