Commit 6096fc83 authored by Ken Thompson's avatar Ken Thompson

code gen error for *(complex)++

includes array[i]++ and slice[i]++

R=rsc
CC=golang-dev
https://golang.org/cl/2614041
parent 6a3b2989
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment