From 4bbf1d12b5c79eae94ba931052af66001659cc91 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Tue, 4 Aug 2020 00:50:33 +0200 Subject: [PATCH] 7c: now really fix OASxxx operations the previous patch broke 64-bit ops as the type for the operation is determined from the first argument to gopcode() (nod1.type), not the type the result (nod.type). so we need to include the conversion of nod1 type to the type of nod. --- sys/src/cmd/7c/cgen.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/sys/src/cmd/7c/cgen.c b/sys/src/cmd/7c/cgen.c index 2e6010b81..bed0087f9 100644 --- a/sys/src/cmd/7c/cgen.c +++ b/sys/src/cmd/7c/cgen.c @@ -287,25 +287,28 @@ cgenrel(Node *n, Node *nn, int inrel) reglcgen(&nod2, l, Z); else nod2 = *l; - regalloc(&nod, n, nn); - cgen(r, &nod); + regalloc(&nod1, r, Z); + cgen(r, &nod1); } else { - regalloc(&nod, n, nn); - cgen(r, &nod); + regalloc(&nod1, r, Z); + cgen(r, &nod1); if(l->addable < INDEXED) reglcgen(&nod2, l, Z); else nod2 = *l; } - regalloc(&nod1, n, Z); - gopcode(OAS, &nod2, Z, &nod1); + if(nod1.type->etype == nod2.type->etype || !typefd[nod1.type->etype]) + regalloc(&nod, &nod2, nn); + else + regalloc(&nod, &nod1, Z); + gopcode(OAS, &nod2, Z, &nod); if(nod1.type->etype != nod.type->etype){ regalloc(&nod3, &nod, Z); gmove(&nod1, &nod3); regfree(&nod1); nod1 = nod3; } - gopcode(o, &nod, &nod1, &nod); + gopcode(o, &nod1, &nod, &nod); gmove(&nod, &nod2); if(nn != Z) gmove(&nod, nn);