diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2020-08-04 00:50:33 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2020-08-04 00:50:33 +0200 |
commit | 4bbf1d12b5c79eae94ba931052af66001659cc91 (patch) | |
tree | 8eb6f855080885f1042415c4564c538f2656e844 /sys/src/cmd/7c | |
parent | 1d07c2a1614a3121a5b9d86f95394caccd61ee56 (diff) |
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.
Diffstat (limited to 'sys/src/cmd/7c')
-rw-r--r-- | sys/src/cmd/7c/cgen.c | 17 |
1 files 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); |