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
a62467af
Commit
a62467af
authored
Apr 13, 2009
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix stringrange test
R=ken OCL=27353 CL=27353
parent
907509de
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
26 deletions
+43
-26
obj.c
src/cmd/gc/obj.c
+0
-1
walk.c
src/cmd/gc/walk.c
+28
-20
golden.out
test/golden.out
+0
-4
stringrange.go
test/stringrange.go
+15
-1
No files found.
src/cmd/gc/obj.c
View file @
a62467af
...
...
@@ -500,7 +500,6 @@ void
stringpool
(
Node
*
n
)
{
Pool
*
p
;
int
w
;
if
(
n
->
op
!=
OLITERAL
||
n
->
val
.
ctype
!=
CTSTR
)
{
if
(
n
->
val
.
ctype
==
CTNIL
)
...
...
src/cmd/gc/walk.c
View file @
a62467af
...
...
@@ -3197,7 +3197,7 @@ Node*
dorange
(
Node
*
nn
)
{
Node
*
k
,
*
v
,
*
m
;
Node
*
n
,
*
hv
,
*
hc
,
*
ha
,
*
hk
,
*
on
,
*
r
,
*
a
;
Node
*
n
,
*
hv
,
*
hc
,
*
ha
,
*
hk
,
*
o
hk
,
*
o
n
,
*
r
,
*
a
;
Type
*
t
,
*
th
;
int
local
;
...
...
@@ -3339,9 +3339,17 @@ strng:
hk
=
nod
(
OXXX
,
N
,
N
);
// hidden key
tempname
(
hk
,
types
[
TINT
]);
ohk
=
nod
(
OXXX
,
N
,
N
);
// old hidden key
tempname
(
ohk
,
types
[
TINT
]);
ha
=
nod
(
OXXX
,
N
,
N
);
// hidden string
tempname
(
ha
,
t
);
hv
=
N
;
if
(
v
!=
N
)
{
hv
=
nod
(
OXXX
,
N
,
N
);
// hidden value
tempname
(
hv
,
types
[
TINT
]);
}
if
(
local
)
{
k
=
old2new
(
k
,
types
[
TINT
]);
...
...
@@ -3353,27 +3361,22 @@ strng:
a
=
nod
(
OAS
,
ha
,
m
);
n
->
ninit
=
a
;
//
kh
= 0
a
=
nod
(
OAS
,
hk
,
nodintconst
(
0
));
//
ohk
= 0
a
=
nod
(
OAS
,
o
hk
,
nodintconst
(
0
));
n
->
ninit
=
list
(
n
->
ninit
,
a
);
// k = hk
a
=
nod
(
OAS
,
k
,
hk
);
n
->
ninit
=
list
(
n
->
ninit
,
a
);
// hk[,v] = stringiter(ha,hk)
// hk[,hv] = stringiter(ha,hk)
if
(
v
!=
N
)
{
// hk,v = stringiter2(ha, hk)
on
=
syslook
(
"stringiter2"
,
0
);
// argtype(on, v->type);
a
=
list
(
ha
,
hk
);
a
=
list
(
ha
,
nodintconst
(
0
)
);
a
=
nod
(
OCALL
,
on
,
a
);
a
=
nod
(
OAS
,
list
(
hk
,
v
),
a
);
a
=
nod
(
OAS
,
list
(
hk
,
h
v
),
a
);
}
else
{
// hk = stringiter(ha, hk)
on
=
syslook
(
"stringiter"
,
0
);
a
=
list
(
ha
,
hk
);
a
=
list
(
ha
,
nodintconst
(
0
)
);
a
=
nod
(
OCALL
,
on
,
a
);
a
=
nod
(
OAS
,
hk
,
a
);
}
...
...
@@ -3382,18 +3385,13 @@ strng:
// while(hk != 0)
n
->
ntest
=
nod
(
ONE
,
hk
,
nodintconst
(
0
));
// k = hk
a
=
nod
(
OAS
,
k
,
hk
);
n
->
nincr
=
a
;
// hk[,v] = stringiter(ha,hk)
// hk[,hv] = stringiter(ha,hk)
if
(
v
!=
N
)
{
// hk,v = stringiter2(ha, hk)
// hk,
h
v = stringiter2(ha, hk)
on
=
syslook
(
"stringiter2"
,
0
);
// argtype(on, v->type);
a
=
list
(
ha
,
hk
);
a
=
nod
(
OCALL
,
on
,
a
);
a
=
nod
(
OAS
,
list
(
hk
,
v
),
a
);
a
=
nod
(
OAS
,
list
(
hk
,
h
v
),
a
);
}
else
{
// hk = stringiter(ha, hk)
on
=
syslook
(
"stringiter"
,
0
);
...
...
@@ -3403,6 +3401,16 @@ strng:
}
n
->
nincr
=
list
(
n
->
nincr
,
a
);
// k,ohk[,v] = ohk,hk,[,hv]
a
=
nod
(
OAS
,
k
,
ohk
);
n
->
nbody
=
a
;
a
=
nod
(
OAS
,
ohk
,
hk
);
n
->
nbody
=
list
(
n
->
nbody
,
a
);
if
(
v
!=
N
)
{
a
=
nod
(
OAS
,
v
,
hv
);
n
->
nbody
=
list
(
n
->
nbody
,
a
);
}
addtotop
(
n
);
goto
out
;
...
...
test/golden.out
View file @
a62467af
...
...
@@ -67,10 +67,6 @@ panic PC=xxx
=========== ./sigchld.go
survived SIGCHLD
=========== ./stringrange.go
after loop i is 18 not 17
FAIL
=========== ./turing.go
Hello World!
...
...
test/stringrange.go
View file @
a62467af
...
...
@@ -40,8 +40,22 @@ func main() {
fmt
.
Println
(
"after loop i is"
,
i
,
"not"
,
len
(
s
)
-
1
);
ok
=
false
;
}
i
=
12345
;
c
=
23456
;
for
i
,
c
=
range
""
{
}
if
i
!=
12345
{
fmt
.
Println
(
"range empty string assigned to index:"
,
i
);
ok
=
false
;
}
if
c
!=
23456
{
fmt
.
Println
(
"range empty string assigned to value:"
,
c
);
ok
=
false
;
}
if
!
ok
{
fmt
.
Println
(
"
FAIL
"
);
fmt
.
Println
(
"
BUG: stringrange
"
);
sys
.
Exit
(
1
)
}
}
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