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.
front
cinap_lenrek 2020-08-04 00:50:33 +02:00
parent 1d07c2a161
commit 4bbf1d12b5
1 changed files with 10 additions and 7 deletions

View File

@ -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);