Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
62c4818e
Commit
62c4818e
authored
Oct 20, 2009
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug136
R=ken OCL=35902 CL=35904
parent
a15aa05a
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
30 deletions
+10
-30
gen.c
src/cmd/gc/gen.c
+7
-23
go.h
src/cmd/gc/go.h
+2
-3
go.y
src/cmd/gc/go.y
+1
-1
bug136.go
test/fixedbugs/bug136.go
+0
-0
golden.out
test/golden.out
+0
-3
No files found.
src/cmd/gc/gen.c
View file @
62c4818e
...
...
@@ -62,7 +62,7 @@ allocparams(void)
}
void
newlab
(
int
op
,
Sym
*
s
)
newlab
(
int
op
,
Sym
*
s
,
Node
*
stmt
)
{
Label
*
lab
;
...
...
@@ -73,6 +73,7 @@ newlab(int op, Sym *s)
lab
->
sym
=
s
;
lab
->
op
=
op
;
lab
->
label
=
pc
;
lab
->
stmt
=
stmt
;
}
void
...
...
@@ -88,7 +89,6 @@ checklabels(void)
for
(
l
=
labellist
;
l
!=
L
;
l
=
l
->
link
)
{
switch
(
l
->
op
)
{
case
OFOR
:
case
OLABEL
:
// these are definitions -
s
=
l
->
sym
;
...
...
@@ -96,7 +96,6 @@ checklabels(void)
if
(
m
->
sym
!=
s
)
continue
;
switch
(
m
->
op
)
{
case
OFOR
:
case
OLABEL
:
// these are definitions -
// look for redefinitions
...
...
@@ -120,21 +119,6 @@ checklabels(void)
yyerror
(
"label %S not defined"
,
l
->
sym
);
}
Label
*
findlab
(
Sym
*
s
)
{
Label
*
l
;
for
(
l
=
labellist
;
l
!=
L
;
l
=
l
->
link
)
{
if
(
l
->
sym
!=
s
)
continue
;
if
(
l
->
op
!=
OFOR
)
continue
;
return
l
;
}
return
L
;
}
/*
* compile statements
*/
...
...
@@ -191,11 +175,11 @@ gen(Node *n)
break
;
case
OLABEL
:
newlab
(
OLABEL
,
n
->
left
->
sym
);
newlab
(
OLABEL
,
n
->
left
->
sym
,
n
->
right
);
break
;
case
OGOTO
:
newlab
(
OGOTO
,
n
->
left
->
sym
);
newlab
(
OGOTO
,
n
->
left
->
sym
,
N
);
gjmp
(
P
);
break
;
...
...
@@ -252,7 +236,7 @@ gen(Node *n)
continpc
=
pc
;
// define break and continue labels
if
((
lab
=
labellist
)
!=
L
&&
lab
->
label
==
p3
&&
lab
->
op
==
OLABEL
)
{
if
((
lab
=
labellist
)
!=
L
&&
lab
->
label
==
p3
&&
lab
->
op
==
OLABEL
&&
lab
->
stmt
==
n
)
{
lab
->
breakpc
=
breakpc
;
lab
->
continpc
=
continpc
;
}
...
...
@@ -291,7 +275,7 @@ gen(Node *n)
breakpc
=
gjmp
(
P
);
// break: goto done
// define break label
if
((
lab
=
labellist
)
!=
L
&&
lab
->
label
==
p3
&&
lab
->
op
==
OLABEL
)
if
((
lab
=
labellist
)
!=
L
&&
lab
->
label
==
p3
&&
lab
->
op
==
OLABEL
&&
lab
->
stmt
==
n
)
lab
->
breakpc
=
breakpc
;
patch
(
p1
,
pc
);
// test:
...
...
@@ -306,7 +290,7 @@ gen(Node *n)
breakpc
=
gjmp
(
P
);
// break: goto done
// define break label
if
((
lab
=
labellist
)
!=
L
&&
lab
->
label
==
p3
&&
lab
->
op
==
OLABEL
)
if
((
lab
=
labellist
)
!=
L
&&
lab
->
label
==
p3
&&
lab
->
op
==
OLABEL
&&
lab
->
stmt
==
n
)
lab
->
breakpc
=
breakpc
;
patch
(
p1
,
pc
);
// test:
...
...
src/cmd/gc/go.h
View file @
62c4818e
...
...
@@ -1089,6 +1089,7 @@ struct Label
{
uchar
op
;
// OGOTO/OLABEL
Sym
*
sym
;
Node
*
stmt
;
Prog
*
label
;
// pointer to code
Prog
*
breakpc
;
// pointer to code
Prog
*
continpc
;
// pointer to code
...
...
@@ -1097,7 +1098,6 @@ struct Label
#define L ((Label*)0)
EXTERN
Label
*
labellist
;
EXTERN
Label
*
findlab
(
Sym
*
);
typedef
struct
Plist
Plist
;
struct
Plist
...
...
@@ -1126,10 +1126,9 @@ void cgen_callmeth(Node *n, int proc);
void
cgen_dcl
(
Node
*
n
);
void
cgen_proc
(
Node
*
n
,
int
proc
);
void
checklabels
(
void
);
Label
*
findlab
(
Sym
*
s
);
void
gen
(
Node
*
n
);
void
genlist
(
NodeList
*
l
);
void
newlab
(
int
op
,
Sym
*
s
);
void
newlab
(
int
op
,
Sym
*
s
,
Node
*
);
Node
*
sysfunc
(
char
*
name
);
Plist
*
newplist
(
void
);
...
...
src/cmd/gc/go.y
View file @
62c4818e
...
...
@@ -1380,7 +1380,7 @@ stmt:
{
NodeList *l;
l = list1(nod(OLABEL, $1,
N
));
l = list1(nod(OLABEL, $1,
$3
));
if($3)
l = list(l, $3);
$$ = liststmt(l);
...
...
test/bugs/bug136.go
→
test/
fixed
bugs/bug136.go
View file @
62c4818e
File moved
test/golden.out
View file @
62c4818e
...
...
@@ -140,9 +140,6 @@ panic PC=xxx
== bugs/
=========== bugs/bug136.go
BUG: errchk: command succeeded unexpectedly
=========== bugs/bug162.go
123
BUG: should fail
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment