Commit 9906bfc7 authored by Russ Cox's avatar Russ Cox

6g ninit fixes - fixes the two test cases

i isolated last night.  does not fix rob's
interface-smashing bug.

R=ken
OCL=18698
CL=18698
parent 66c6b13b
......@@ -478,6 +478,8 @@ EXTERN ushort block; // current block number
EXTERN Node* retnil;
EXTERN Node* fskel;
EXTERN Node* addtop;
EXTERN char* context;
EXTERN int thechar;
EXTERN char* thestring;
......
......@@ -303,6 +303,9 @@ Bvardcl:
}
| new_name_list_r type '=' expr_list
{
if(addtop != N)
fatal("new_name_list_r type '=' expr_list");
$$ = rev($1);
dodclvar($$, $2);
......@@ -423,6 +426,9 @@ simple_stmt:
}
| exprsym3_list_r LCOLAS expr_list
{
if(addtop != N)
fatal("exprsym3_list_r LCOLAS expr_list");
$$ = rev($1);
$$ = colas($$, $3);
$$ = nod(OAS, $$, $3);
......
......@@ -2417,20 +2417,20 @@ adddot(Node *n)
walktype(n->left, Erv);
t = n->left->type;
if(t == T)
return n;
goto ret;
if(n->right->op != ONAME)
return n;
goto ret;
s = n->right->sym;
if(s == S)
return n;
goto ret;
for(d=0; d<nelem(dotlist); d++) {
c = adddot1(s, t, d);
if(c > 0)
goto out;
}
return n;
goto ret;
out:
if(c > 1)
......@@ -2441,6 +2441,9 @@ out:
n = nod(ODOT, n, n->right);
n->left->right = newname(dotlist[c].field->sym);
}
ret:
n->ninit = list(addtop, n->ninit);
addtop = N;
return n;
}
......
......@@ -8,7 +8,6 @@ static Type* sw1(Node*, Type*);
static Type* sw2(Node*, Type*);
static Type* sw3(Node*, Type*);
static Node* curfn;
static Node* addtop;
enum
{
......@@ -65,6 +64,8 @@ walk(Node *fn)
if(curfn->type->outtuple)
if(walkret(curfn->nbody))
yyerror("function ends without a return statement");
if(addtop != N)
fatal("addtop in walk");
walkstate(curfn->nbody);
if(debug['W']) {
snprint(s, sizeof(s), "after %S", curfn->nname->sym);
......@@ -1544,6 +1545,9 @@ walkdot(Node *n)
{
Type *t;
addtop = list(addtop, n->ninit);
n->ninit = N;
if(n->left == N || n->right == N)
return;
switch(n->op) {
......
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