shithub: scc

Download patch

ref: f4be5adbc1593fe4b632d6ed8995c41193582971
parent: 32f13e84d1f68ada101e8a349c22388bd04a3d36
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Thu Nov 11 12:51:35 EST 2021

cc1: Fix struct size calculation

The size added for alignment was calculated in a wrong way,
making that any size was actually duplicated.

--- a/src/cmd/cc/cc1/types.c
+++ b/src/cmd/cc/cc1/types.c
@@ -229,7 +229,7 @@
 		 * alignment.
 		 */
 		if (tp->op == STRUCT && align-- > 1)
-			size += size+align & ~align;
+			size = size+align & ~align;
 		tp->size = size;
 		return;
 	case ENUM: