code: plan9front

Download patch

ref: deb39a43ae5ed09c7971726cedeb06a9f65ccc6d
parent: c3ca13a71a1d8928c7c7b931e0423ffe0544418a
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Thu May 4 02:27:04 EDT 2023

7c: copy the remainder of packed structs

--- a/sys/src/cmd/7c/cgen.c
+++ b/sys/src/cmd/7c/cgen.c
@@ -1120,6 +1120,20 @@
 		n->type = t;
 	}
 
+	if((m = w % SZ_LONG) > 0){
+		nod1.xoffset = nod2.xoffset = w - m;
+		regalloc(&nod3, &regnode, Z);
+		do{
+			gins(AMOVB, &nod1, &nod3);
+			gins(AMOVB, &nod3, &nod2);
+			nod1.xoffset++;
+			nod2.xoffset++;
+		}while(--m > 0);
+		regfree(&nod3);
+		nod1.xoffset = 0;
+		nod2.xoffset = 0;
+	}
+
 	w /= SZ_LONG;
 	if(w <= 5) {
 		layout(&nod1, &nod2, w, 0, Z);