mirror of
https://github.com/golang/go
synced 2024-11-12 00:20:22 -07:00
code gen error for *(complex)++
includes array[i]++ and slice[i]++ R=rsc CC=golang-dev https://golang.org/cl/2614041
This commit is contained in:
parent
6a3b29895f
commit
6096fc83cd
@ -458,13 +458,14 @@ cgen_asop(Node *n)
|
||||
}
|
||||
if(nr->ullman < UINF)
|
||||
if(sudoaddable(a, nl, &addr, &w)) {
|
||||
w = optoas(OAS, nl->type);
|
||||
regalloc(&n2, nl->type, N);
|
||||
p1 = gins(AMOVW, N, &n2);
|
||||
p1 = gins(w, N, &n2);
|
||||
p1->from = addr;
|
||||
regalloc(&n3, nr->type, N);
|
||||
cgen(nr, &n3);
|
||||
gins(a, &n3, &n2);
|
||||
p1 = gins(AMOVW, &n2, N);
|
||||
p1 = gins(w, &n2, N);
|
||||
p1->to = addr;
|
||||
regfree(&n2);
|
||||
regfree(&n3);
|
||||
|
@ -1835,14 +1835,20 @@ oindex:
|
||||
gmove(&n2, reg);
|
||||
}
|
||||
|
||||
if(*w == 1)
|
||||
switch(*w) {
|
||||
case 1:
|
||||
gins(AADD, reg1, reg);
|
||||
else if(*w == 2)
|
||||
break;
|
||||
case 2:
|
||||
gshift(AADD, reg1, SHIFT_LL, 1, reg);
|
||||
else if(*w == 4)
|
||||
break;
|
||||
case 4:
|
||||
gshift(AADD, reg1, SHIFT_LL, 2, reg);
|
||||
else if(*w == 8)
|
||||
break;
|
||||
case 8:
|
||||
gshift(AADD, reg1, SHIFT_LL, 3, reg);
|
||||
break;
|
||||
}
|
||||
|
||||
naddr(reg1, a, 1);
|
||||
a->type = D_OREG;
|
||||
|
Loading…
Reference in New Issue
Block a user