shithub: riscv

Download patch

ref: 090af6255bebf0129c891116b53b31808fe49dc7
parent: deb39a43ae5ed09c7971726cedeb06a9f65ccc6d
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Sat May 6 00:59:28 EDT 2023

7c: node offsets aren't necessarily 0 - fixup packed structs

--- a/sys/src/cmd/7c/cgen.c
+++ b/sys/src/cmd/7c/cgen.c
@@ -1121,7 +1121,8 @@
 	}
 
 	if((m = w % SZ_LONG) > 0){
-		nod1.xoffset = nod2.xoffset = w - m;
+		nod1.xoffset += w - m;
+		nod2.xoffset += w - m;
 		regalloc(&nod3, &regnode, Z);
 		do{
 			gins(AMOVB, &nod1, &nod3);
@@ -1128,10 +1129,11 @@
 			gins(AMOVB, &nod3, &nod2);
 			nod1.xoffset++;
 			nod2.xoffset++;
+			w--;
 		}while(--m > 0);
 		regfree(&nod3);
-		nod1.xoffset = 0;
-		nod2.xoffset = 0;
+		nod1.xoffset -= w - m;
+		nod2.xoffset -= w - m;
 	}
 
 	w /= SZ_LONG;