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
01385b40
Commit
01385b40
authored
Oct 06, 2010
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gc: ... bug
Fixes #1165. R=ken2 CC=golang-dev
https://golang.org/cl/2339042
parent
30dd1911
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
9 deletions
+29
-9
walk.c
src/cmd/gc/walk.c
+9
-9
ddd.go
test/ddd.go
+20
-0
No files found.
src/cmd/gc/walk.c
View file @
01385b40
...
...
@@ -11,7 +11,7 @@ static Node* makenewvar(Type*, NodeList**, Node**);
static
Node
*
ascompatee1
(
int
,
Node
*
,
Node
*
,
NodeList
**
);
static
NodeList
*
ascompatee
(
int
,
NodeList
*
,
NodeList
*
,
NodeList
**
);
static
NodeList
*
ascompatet
(
int
,
NodeList
*
,
Type
**
,
int
,
NodeList
**
);
static
NodeList
*
ascompatte
(
int
,
Type
**
,
NodeList
*
,
int
,
NodeList
**
);
static
NodeList
*
ascompatte
(
int
,
int
,
Type
**
,
NodeList
*
,
int
,
NodeList
**
);
static
Node
*
convas
(
Node
*
,
NodeList
**
);
static
void
heapmoves
(
void
);
static
NodeList
*
paramstoheap
(
Type
**
argin
,
int
out
);
...
...
@@ -513,7 +513,7 @@ walkstmt(Node **np)
n
->
list
=
reorder3
(
ll
);
break
;
}
ll
=
ascompatte
(
n
->
op
,
getoutarg
(
curfn
->
type
),
n
->
list
,
1
,
&
n
->
ninit
);
ll
=
ascompatte
(
n
->
op
,
0
,
getoutarg
(
curfn
->
type
),
n
->
list
,
1
,
&
n
->
ninit
);
n
->
list
=
ll
;
break
;
...
...
@@ -708,7 +708,7 @@ walkexpr(Node **np, NodeList **init)
goto
ret
;
walkexpr
(
&
n
->
left
,
init
);
walkexprlist
(
n
->
list
,
init
);
ll
=
ascompatte
(
n
->
op
,
getinarg
(
t
),
n
->
list
,
0
,
init
);
ll
=
ascompatte
(
n
->
op
,
n
->
isddd
,
getinarg
(
t
),
n
->
list
,
0
,
init
);
n
->
list
=
reorder1
(
ll
);
goto
ret
;
...
...
@@ -718,7 +718,7 @@ walkexpr(Node **np, NodeList **init)
goto
ret
;
walkexpr
(
&
n
->
left
,
init
);
walkexprlist
(
n
->
list
,
init
);
ll
=
ascompatte
(
n
->
op
,
getinarg
(
t
),
n
->
list
,
0
,
init
);
ll
=
ascompatte
(
n
->
op
,
n
->
isddd
,
getinarg
(
t
),
n
->
list
,
0
,
init
);
n
->
list
=
reorder1
(
ll
);
if
(
isselect
(
n
))
{
// special prob with selectsend and selectrecv:
...
...
@@ -728,7 +728,7 @@ walkexpr(Node **np, NodeList **init)
Node
*
b
;
b
=
nodbool
(
0
);
typecheck
(
&
b
,
Erv
);
lr
=
ascompatte
(
n
->
op
,
getoutarg
(
t
),
list1
(
b
),
0
,
init
);
lr
=
ascompatte
(
n
->
op
,
0
,
getoutarg
(
t
),
list1
(
b
),
0
,
init
);
n
->
list
=
concat
(
n
->
list
,
lr
);
}
goto
ret
;
...
...
@@ -739,8 +739,8 @@ walkexpr(Node **np, NodeList **init)
goto
ret
;
walkexpr
(
&
n
->
left
,
init
);
walkexprlist
(
n
->
list
,
init
);
ll
=
ascompatte
(
n
->
op
,
getthis
(
t
),
list1
(
n
->
left
->
left
),
0
,
init
);
lr
=
ascompatte
(
n
->
op
,
getinarg
(
t
),
n
->
list
,
0
,
init
);
ll
=
ascompatte
(
n
->
op
,
0
,
getthis
(
t
),
list1
(
n
->
left
->
left
),
0
,
init
);
lr
=
ascompatte
(
n
->
op
,
n
->
isddd
,
getinarg
(
t
),
n
->
list
,
0
,
init
);
ll
=
concat
(
ll
,
lr
);
n
->
left
->
left
=
N
;
ullmancalc
(
n
->
left
);
...
...
@@ -1599,7 +1599,7 @@ dumpnodetypes(NodeList *l, char *what)
* func(expr-list)
*/
static
NodeList
*
ascompatte
(
int
op
,
Type
**
nl
,
NodeList
*
lr
,
int
fp
,
NodeList
**
init
)
ascompatte
(
int
op
,
int
isddd
,
Type
**
nl
,
NodeList
*
lr
,
int
fp
,
NodeList
**
init
)
{
Type
*
l
,
*
ll
;
Node
*
r
,
*
a
;
...
...
@@ -1654,7 +1654,7 @@ loop:
// only if we are assigning a single ddd
// argument to a ddd parameter then it is
// passed thru unencapsulated
if
(
r
!=
N
&&
lr
->
next
==
nil
&&
r
->
isddd
&&
eqtype
(
l
->
type
,
r
->
type
))
{
if
(
r
!=
N
&&
lr
->
next
==
nil
&&
isddd
&&
eqtype
(
l
->
type
,
r
->
type
))
{
a
=
nod
(
OAS
,
nodarg
(
l
,
fp
),
r
);
a
=
convas
(
a
,
init
);
nn
=
list
(
nn
,
a
);
...
...
test/ddd.go
View file @
01385b40
...
...
@@ -30,10 +30,14 @@ func sumA(args []int) int {
return
s
}
func
sumB
(
args
[]
int
)
int
{
return
sum
(
args
...
)
}
func
sum2
(
args
...
int
)
int
{
return
2
*
sum
(
args
...
)
}
func
sum3
(
args
...
int
)
int
{
return
3
*
sumA
(
args
)
}
func
sum4
(
args
...
int
)
int
{
return
4
*
sumB
(
args
)
}
func
intersum
(
args
...
interface
{})
int
{
s
:=
0
for
_
,
v
:=
range
args
{
...
...
@@ -119,6 +123,22 @@ func main() {
println
(
"sum 9"
,
x
)
panic
(
"fail"
)
}
if
x
:=
sum4
(
1
,
2
,
3
);
x
!=
4
*
6
{
println
(
"sum 6"
,
x
)
panic
(
"fail"
)
}
if
x
:=
sum4
();
x
!=
4
*
0
{
println
(
"sum 0"
,
x
)
panic
(
"fail"
)
}
if
x
:=
sum4
(
10
);
x
!=
4
*
10
{
println
(
"sum 10"
,
x
)
panic
(
"fail"
)
}
if
x
:=
sum4
(
1
,
8
);
x
!=
4
*
9
{
println
(
"sum 9"
,
x
)
panic
(
"fail"
)
}
if
x
:=
intersum
(
1
,
2
,
3
);
x
!=
6
{
println
(
"intersum 6"
,
x
)
panic
(
"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