shithub: scc

Download patch

ref: 4b0f334f7eca8920c3b91ba1ab68d0ebaec0cce0
parent: 3c7cc0d1bdc0c364444098d0568590475fff13f7
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Wed Sep 28 08:28:00 EDT 2016

[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.

--- a/cc1/types.c
+++ b/cc1/types.c
@@ -210,7 +210,7 @@
 				align = a;
 			if (tp->op == STRUCT) {
 				if (--a != 0)
-					size += (size + a) & ~a;
+					size = (size + a) & ~a;
 				size += aux->size;
 				offset = size;
 			} else {