ref: 5edfa586205c1c9b886c313242c5e3506a10af4e
parent: 44bddd8297ea0a5f07fc7f0827d4cf5fe0c44bc7
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Mon Aug 3 20:50:33 EDT 2020
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.
--- a/sys/src/cmd/7c/cgen.c
+++ b/sys/src/cmd/7c/cgen.c
@@ -287,18 +287,21 @@
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);
@@ -305,7 +308,7 @@
regfree(&nod1);
nod1 = nod3;
}
- gopcode(o, &nod, &nod1, &nod);
+ gopcode(o, &nod1, &nod, &nod);
gmove(&nod, &nod2);
if(nn != Z)
gmove(&nod, nn);
--
⑨