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
8c0b699c
Commit
8c0b699c
authored
Dec 09, 2011
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gc: fix another blank bug
R=ken2 CC=golang-dev
https://golang.org/cl/5478051
parent
2e338fa6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
0 deletions
+36
-0
gsubr.c
src/cmd/5g/gsubr.c
+6
-0
gsubr.c
src/cmd/6g/gsubr.c
+7
-0
gsubr.c
src/cmd/8g/gsubr.c
+6
-0
blank.go
test/blank.go
+17
-0
No files found.
src/cmd/5g/gsubr.c
View file @
8c0b699c
...
...
@@ -515,6 +515,12 @@ nodarg(Type *t, int fp)
n
->
orig
=
t
->
nname
;
fp:
// Rewrite argument named _ to __,
// or else the assignment to _ will be
// discarded during code generation.
if
(
isblank
(
n
))
n
->
sym
=
lookup
(
"__"
);
switch
(
fp
)
{
default:
fatal
(
"nodarg %T %d"
,
t
,
fp
);
...
...
src/cmd/6g/gsubr.c
View file @
8c0b699c
...
...
@@ -481,6 +481,7 @@ nodarg(Type *t, int fp)
n
=
nod
(
ONAME
,
N
,
N
);
n
->
type
=
t
->
type
;
n
->
sym
=
t
->
sym
;
if
(
t
->
width
==
BADWIDTH
)
fatal
(
"nodarg: offset not computed for %T"
,
t
);
n
->
xoffset
=
t
->
width
;
...
...
@@ -488,6 +489,12 @@ nodarg(Type *t, int fp)
n
->
orig
=
t
->
nname
;
fp:
// Rewrite argument named _ to __,
// or else the assignment to _ will be
// discarded during code generation.
if
(
isblank
(
n
))
n
->
sym
=
lookup
(
"__"
);
switch
(
fp
)
{
case
0
:
// output arg
n
->
op
=
OINDREG
;
...
...
src/cmd/8g/gsubr.c
View file @
8c0b699c
...
...
@@ -967,6 +967,12 @@ nodarg(Type *t, int fp)
n
->
orig
=
t
->
nname
;
break
;
}
// Rewrite argument named _ to __,
// or else the assignment to _ will be
// discarded during code generation.
if
(
isblank
(
n
))
n
->
sym
=
lookup
(
"__"
);
switch
(
fp
)
{
default:
...
...
test/blank.go
View file @
8c0b699c
...
...
@@ -118,12 +118,29 @@ func (TI) M(x int, y int) {
}
}
var
fp
=
func
(
_
int
,
y
int
)
{}
func
init
()
{
fp
=
fp1
}
func
fp1
(
x
,
y
int
)
{
if
x
!=
y
{
println
(
"invalid fp1 call:"
,
x
,
y
)
panic
(
"bad fp1"
)
}
}
func
m
()
{
var
i
I
i
=
TI
{}
i
.
M
(
1
,
1
)
i
.
M
(
2
,
2
)
fp
(
1
,
1
)
fp
(
2
,
2
)
}
// useless but legal
...
...
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