shithub: scc

Download patch

ref: 95232a91309714fde82840811c7bae6c53dd5778
parent: 44956b98edc0b97ad3319467152ad362f1632e72
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Mon Jan 25 06:58:29 EST 2016

Fix definition of sizes for amd64 and i386

--- a/cc1/arch/amd64-sysv/arch.c
+++ b/cc1/arch/amd64-sysv/arch.c
@@ -80,7 +80,7 @@
 		.size = 2,
 		.integer = 1,
 		.arith = 1,
-		.align = 1,
+		.align = 2,
 		.n.rank = RANK_USHORT,
 		.printed = 1
 	},
@@ -91,7 +91,7 @@
 		.size = 2,
 		.integer = 1,
 		.arith = 1,
-		.align = 1,
+		.align = 2,
 		.sign = 1,
 		.n.rank = RANK_SHORT,
 		.printed = 1
@@ -100,10 +100,10 @@
 		.op = INT,
 		.letter = L_UINT,
 		.defined = 1,
-		.size = 2,
+		.size = 4,
 		.integer = 1,
 		.arith = 1,
-		.align = 1,
+		.align = 4,
 		.n.rank = RANK_UINT,
 		.printed = 1
 	},
@@ -111,10 +111,10 @@
 		.op = INT,
 		.letter = L_INT,
 		.defined = 1,
-		.size = 2,
+		.size = 4,
 		.integer = 1,
 		.arith = 1,
-		.align = 1,
+		.align = 4,
 		.sign = 1,
 		.n.rank = RANK_INT,
 		.printed = 1
@@ -123,10 +123,10 @@
 		.op = INT,
 		.letter = L_LONG,
 		.defined = 1,
-		.size = 4,
+		.size = 8,
 		.integer = 1,
 		.arith = 1,
-		.align = 1,
+		.align = 8,
 		.sign = 1,
 		.n.rank = RANK_LONG,
 		.printed = 1
@@ -135,10 +135,10 @@
 		.op = INT,
 		.letter = L_ULONG,
 		.defined = 1,
-		.size = 4,
+		.size = 8,
 		.integer = 1,
 		.arith = 1,
-		.align = 1,
+		.align = 8,
 		.n.rank = RANK_ULONG,
 		.printed = 1
 	},
@@ -149,7 +149,7 @@
 		.size = 8,
 		.integer = 1,
 		.arith = 1,
-		.align = 1,
+		.align = 8,
 		.n.rank = RANK_ULLONG,
 		.printed = 1
 	},
@@ -160,7 +160,7 @@
 		.size = 8,
 		.integer = 1,
 		.arith = 1,
-		.align = 1,
+		.align = 8,
 		.sign = 1,
 		.n.rank = RANK_LLONG,
 		.printed = 1
@@ -171,7 +171,7 @@
 		.defined = 1,
 		.size = 4,
 		.arith = 1,
-		.align = 1,
+		.align = 4,
 		.n.rank = RANK_FLOAT,
 		.printed = 1
 	},
@@ -181,7 +181,7 @@
 		.defined = 1,
 		.size = 8,
 		.arith = 1,
-		.align = 1,
+		.align = 8,
 		.n.rank = RANK_DOUBLE,
 		.printed = 1
 	},
@@ -191,7 +191,7 @@
 		.defined = 1,
 		.size = 16,
 		.arith = 1,
-		.align = 1,
+		.align = 16,
 		.n.rank = RANK_LDOUBLE,
 		.printed = 1
 	},
@@ -199,10 +199,10 @@
 		.op = INT,
 		.letter = L_UINT,
 		.defined = 1,
-		.size = 2,
+		.size = 8,
 		.integer = 1,
 		.arith = 1,
-		.align = 1,
+		.align = 8,
 		.n.rank = RANK_UINT,
 		.printed = 1
 	},
--- a/cc1/arch/amd64-sysv/arch.h
+++ b/cc1/arch/amd64-sysv/arch.h
@@ -26,8 +26,8 @@
 #define L_USHORT    L_UINT16
 #define L_INT       L_INT32
 #define L_UINT      L_UINT32
-#define L_LONG      L_INT32
-#define L_ULONG     L_UINT32
+#define L_LONG      L_INT64
+#define L_ULONG     L_UINT64
 #define L_LLONG     L_INT64
 #define L_ULLONG    L_UINT64
 #define L_ENUM      L_INT
--- a/cc1/arch/i386-sysv/arch.c
+++ b/cc1/arch/i386-sysv/arch.c
@@ -22,8 +22,8 @@
 	{       /* 1 = pvoidtype */
 		.op = PTR,
 		.letter = L_POINTER,
-		.size = 2,
-		.align = 2,
+		.size = 4,
+		.align = 4,
 		.printed = 1,
 		.defined = 1,
 	},
@@ -80,7 +80,7 @@
 		.size = 2,
 		.integer = 1,
 		.arith = 1,
-		.align = 1,
+		.align = 2,
 		.n.rank = RANK_USHORT,
 		.printed = 1
 	},
@@ -91,7 +91,7 @@
 		.size = 2,
 		.integer = 1,
 		.arith = 1,
-		.align = 1,
+		.align = 2,
 		.sign = 1,
 		.n.rank = RANK_SHORT,
 		.printed = 1
@@ -100,10 +100,10 @@
 		.op = INT,
 		.letter = L_UINT,
 		.defined = 1,
-		.size = 2,
+		.size = 4,
 		.integer = 1,
 		.arith = 1,
-		.align = 1,
+		.align = 4,
 		.n.rank = RANK_UINT,
 		.printed = 1
 	},
@@ -111,10 +111,10 @@
 		.op = INT,
 		.letter = L_INT,
 		.defined = 1,
-		.size = 2,
+		.size = 4,
 		.integer = 1,
 		.arith = 1,
-		.align = 1,
+		.align = 4,
 		.sign = 1,
 		.n.rank = RANK_INT,
 		.printed = 1
@@ -126,7 +126,7 @@
 		.size = 4,
 		.integer = 1,
 		.arith = 1,
-		.align = 1,
+		.align = 4,
 		.sign = 1,
 		.n.rank = RANK_LONG,
 		.printed = 1
@@ -138,7 +138,7 @@
 		.size = 4,
 		.integer = 1,
 		.arith = 1,
-		.align = 1,
+		.align = 4,
 		.n.rank = RANK_ULONG,
 		.printed = 1
 	},
@@ -149,7 +149,7 @@
 		.size = 8,
 		.integer = 1,
 		.arith = 1,
-		.align = 1,
+		.align = 4,
 		.n.rank = RANK_ULLONG,
 		.printed = 1
 	},
@@ -160,7 +160,7 @@
 		.size = 8,
 		.integer = 1,
 		.arith = 1,
-		.align = 1,
+		.align = 4,
 		.sign = 1,
 		.n.rank = RANK_LLONG,
 		.printed = 1
@@ -171,7 +171,7 @@
 		.defined = 1,
 		.size = 4,
 		.arith = 1,
-		.align = 1,
+		.align = 4,
 		.n.rank = RANK_FLOAT,
 		.printed = 1
 	},
@@ -181,7 +181,7 @@
 		.defined = 1,
 		.size = 8,
 		.arith = 1,
-		.align = 1,
+		.align = 4,
 		.n.rank = RANK_DOUBLE,
 		.printed = 1
 	},
@@ -189,9 +189,9 @@
 		.op = FLOAT,
 		.letter = L_LDOUBLE,
 		.defined = 1,
-		.size = 16,
+		.size = 12,
 		.arith = 1,
-		.align = 1,
+		.align = 4,
 		.n.rank = RANK_LDOUBLE,
 		.printed = 1
 	},
@@ -199,10 +199,10 @@
 		.op = INT,
 		.letter = L_UINT,
 		.defined = 1,
-		.size = 2,
+		.size = 4,
 		.integer = 1,
 		.arith = 1,
-		.align = 1,
+		.align = 4,
 		.n.rank = RANK_UINT,
 		.printed = 1
 	},
--- a/cc2/arch/amd64-sysv/types.c
+++ b/cc2/arch/amd64-sysv/types.c
@@ -42,7 +42,7 @@
 Type uint32type = {
 	.flags  = INTF,
 	.size   = 4,
-	.align  = 2
+	.align  = 4
 };
 
 Type uint64type = {
@@ -74,8 +74,8 @@
 };
 
 Type float80type = {
-	.size   = 10,
-	.align  = 12
+	.size   = 16,
+	.align  = 16
 };
 
 Type voidtype = {
--- a/cc2/arch/i386-sysv/types.c
+++ b/cc2/arch/i386-sysv/types.c
@@ -24,7 +24,7 @@
 Type int64type = {
 	.flags  = SIGNF | INTF,
 	.size   = 8,
-	.align  = 8
+	.align  = 4
 };
 
 Type uint8type = {
@@ -48,7 +48,7 @@
 Type uint64type = {
 	.flags  = INTF,
 	.size   = 8,
-	.align  = 2
+	.align  = 4
 };
 
 Type ptrtype = {
@@ -70,11 +70,11 @@
 
 Type float64type = {
 	.size   = 8,
-	.align  = 8
+	.align  = 4
 };
 
 Type float80type = {
-	.size   = 10,
+	.size   = 12,
 	.align  =  4
 };