1
0
mirror of https://github.com/golang/go synced 2024-11-12 04:50:21 -07:00

some array init bugs

renamed 6g/(gen|align|obj).c

R=r
OCL=29205
CL=29205
This commit is contained in:
Ken Thompson 2009-05-21 15:44:06 -07:00
parent d5269d0008
commit bba10b3f49
5 changed files with 9 additions and 6 deletions

View File

@ -15,9 +15,9 @@ HFILES=\
OFILES=\ OFILES=\
list.$O\ list.$O\
obj.$O\ gobj.$O\
align.$O\ galign.$O\
gen.$O\ ggen.$O\
cgen.$O\ cgen.$O\
gsubr.$O\ gsubr.$O\
peep.$O\ peep.$O\

View File

@ -3970,9 +3970,11 @@ structlit(Node *n, Node *var)
r = listfirst(&saver, &n->left); r = listfirst(&saver, &n->left);
if(r != N && r->op == OEMPTY) if(r != N && r->op == OEMPTY)
r = N; r = N;
if(r == N)
return var;
mixflag = 0; mixflag = 0;
if(r != N && r->op == OKEY) { if(r->op == OKEY) {
a = nod(OAS, var, N); a = nod(OAS, var, N);
addtop = list(addtop, a); addtop = list(addtop, a);
goto loop2; goto loop2;
@ -4050,11 +4052,11 @@ arraylit(Node *n, Node *var)
r = N; r = N;
while(r != N) { while(r != N) {
b++;
if(r->op == OKEY) { if(r->op == OKEY) {
evconst(r->left); evconst(r->left);
b = nonnegconst(r->left); b = nonnegconst(r->left);
} }
b++;
if(b > ninit) if(b > ninit)
ninit = b; ninit = b;
r = listnext(&saver); r = listnext(&saver);
@ -4064,7 +4066,8 @@ arraylit(Node *n, Node *var)
if(b == -100) { if(b == -100) {
// flag for [...] // flag for [...]
b = ninit; b = ninit;
t = shallow(t); if(var == N)
t = shallow(t);
t->bound = b; t->bound = b;
} }