summaryrefslogtreecommitdiff
path: root/src/cmd/gc/gen.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2011-09-01 13:44:46 -0400
committerRuss Cox <rsc@golang.org>2011-09-01 13:44:46 -0400
commitc8587767a6c4eeb64118f78f6761f952141914f2 (patch)
treedcaad46c0cb9e3eff40d318476c40f8ff1a180f0 /src/cmd/gc/gen.c
parentf7a6931013a960a07cafe5e268a8461ef5093269 (diff)
downloadgo-c8587767a6c4eeb64118f78f6761f952141914f2.tar.gz
gc: fix label recursion bugs
Was keeping a pointer to the labeled statement in n->right, which meant that generic traversals of the tree visited it twice. That combined with aggressive flattening of the block structure when possible during parsing meant that the kinds of label: code label: code label: code sequences generated by yacc were giving the recursion 2? paths through the program. Fixes issue 2212. R=lvd CC=golang-dev http://codereview.appspot.com/4960050
Diffstat (limited to 'src/cmd/gc/gen.c')
-rw-r--r--src/cmd/gc/gen.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/cmd/gc/gen.c b/src/cmd/gc/gen.c
index 7dbe2c4cb..d585c451a 100644
--- a/src/cmd/gc/gen.c
+++ b/src/cmd/gc/gen.c
@@ -287,7 +287,7 @@ stmtlabel(Node *n)
if(n->sym != S)
if((lab = n->sym->label) != L)
if(lab->def != N)
- if(lab->def->right == n)
+ if(lab->def->defn == n)
return lab;
return L;
}
@@ -355,13 +355,13 @@ gen(Node *n)
if(lab->labelpc == P)
lab->labelpc = pc;
- if(n->right) {
- switch(n->right->op) {
+ if(n->defn) {
+ switch(n->defn->op) {
case OFOR:
case OSWITCH:
case OSELECT:
// so stmtlabel can find the label
- n->right->sym = lab->sym;
+ n->defn->sym = lab->sym;
}
}
break;