Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
253fd30e
Commit
253fd30e
authored
Apr 30, 2010
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gc: bug271
Fixes #662. R=ken2 CC=golang-dev
https://golang.org/cl/978043
parent
560283c8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
8 deletions
+27
-8
src/cmd/gc/walk.c
src/cmd/gc/walk.c
+7
-8
test/fixedbugs/bug271.go
test/fixedbugs/bug271.go
+20
-0
No files found.
src/cmd/gc/walk.c
View file @
253fd30e
...
@@ -1618,7 +1618,7 @@ ascompatte(int op, Type **nl, NodeList *lr, int fp, NodeList **init)
...
@@ -1618,7 +1618,7 @@ ascompatte(int op, Type **nl, NodeList *lr, int fp, NodeList **init)
Type
*
l
,
*
ll
;
Type
*
l
,
*
ll
;
Node
*
r
,
*
a
;
Node
*
r
,
*
a
;
NodeList
*
nn
,
*
lr0
,
*
alist
;
NodeList
*
nn
,
*
lr0
,
*
alist
;
Iter
savel
,
peekl
;
Iter
savel
;
lr0
=
lr
;
lr0
=
lr
;
l
=
structfirst
(
&
savel
,
nl
);
l
=
structfirst
(
&
savel
,
nl
);
...
@@ -1626,11 +1626,9 @@ ascompatte(int op, Type **nl, NodeList *lr, int fp, NodeList **init)
...
@@ -1626,11 +1626,9 @@ ascompatte(int op, Type **nl, NodeList *lr, int fp, NodeList **init)
if
(
lr
)
if
(
lr
)
r
=
lr
->
n
;
r
=
lr
->
n
;
nn
=
nil
;
nn
=
nil
;
// 1 to many
// f(g()) where g has multiple return values
peekl
=
savel
;
if
(
r
!=
N
&&
lr
->
next
==
nil
&&
r
->
type
->
etype
==
TSTRUCT
&&
r
->
type
->
funarg
)
{
if
(
l
!=
T
&&
r
!=
N
&&
structnext
(
&
peekl
)
!=
T
&&
lr
->
next
==
nil
&&
r
->
type
->
etype
==
TSTRUCT
&&
r
->
type
->
funarg
)
{
// optimization - can do block copy
// optimization - can do block copy
if
(
eqtypenoname
(
r
->
type
,
*
nl
))
{
if
(
eqtypenoname
(
r
->
type
,
*
nl
))
{
a
=
nodarg
(
*
nl
,
fp
);
a
=
nodarg
(
*
nl
,
fp
);
...
@@ -1638,6 +1636,7 @@ ascompatte(int op, Type **nl, NodeList *lr, int fp, NodeList **init)
...
@@ -1638,6 +1636,7 @@ ascompatte(int op, Type **nl, NodeList *lr, int fp, NodeList **init)
nn
=
list1
(
convas
(
nod
(
OAS
,
a
,
r
),
init
));
nn
=
list1
(
convas
(
nod
(
OAS
,
a
,
r
),
init
));
goto
ret
;
goto
ret
;
}
}
// conversions involved.
// conversions involved.
// copy into temporaries.
// copy into temporaries.
alist
=
nil
;
alist
=
nil
;
...
@@ -1689,9 +1688,9 @@ loop:
...
@@ -1689,9 +1688,9 @@ loop:
if
(
l
==
T
||
r
==
N
)
{
if
(
l
==
T
||
r
==
N
)
{
if
(
l
!=
T
||
r
!=
N
)
{
if
(
l
!=
T
||
r
!=
N
)
{
if
(
l
!=
T
)
if
(
l
!=
T
)
yyerror
(
"
xxx
not enough arguments to %O"
,
op
);
yyerror
(
"not enough arguments to %O"
,
op
);
else
else
yyerror
(
"
xxx
too many arguments to %O"
,
op
);
yyerror
(
"too many arguments to %O"
,
op
);
dumptypes
(
nl
,
"expected"
);
dumptypes
(
nl
,
"expected"
);
dumpnodetypes
(
lr0
,
"given"
);
dumpnodetypes
(
lr0
,
"given"
);
}
}
...
...
test/fixedbugs/bug271.go
0 → 100644
View file @
253fd30e
// $G $D/$F.go && $L $F.$A && ./$A.out
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// http://code.google.com/p/go/issues/detail?id=662
package
main
import
"fmt"
func
f
()
(
int
,
int
)
{
return
1
,
2
}
func
main
()
{
s
:=
fmt
.
Sprint
(
f
())
if
s
!=
"1 2"
{
// with bug, was "{1 2}"
println
(
"BUG"
)
}
}
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