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
836a517f
Commit
836a517f
authored
Jan 11, 2012
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gc: fix inlining bug
Fixes #2682. R=lvd CC=golang-dev
https://golang.org/cl/5538043
parent
f2b51f56
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
10 deletions
+29
-10
src/cmd/gc/fmt.c
src/cmd/gc/fmt.c
+3
-1
test/fixedbugs/bug392.dir/one.go
test/fixedbugs/bug392.dir/one.go
+12
-3
test/fixedbugs/bug392.dir/two.go
test/fixedbugs/bug392.dir/two.go
+13
-1
test/fixedbugs/bug392.go
test/fixedbugs/bug392.go
+1
-5
No files found.
src/cmd/gc/fmt.c
View file @
836a517f
...
...
@@ -1078,7 +1078,9 @@ exprfmt(Fmt *f, Node *n, int prec)
if
(
n
->
val
.
ctype
==
CTNIL
)
n
=
n
->
orig
;
// if this node was a nil decorated with at type, print the original naked nil
if
(
n
->
type
!=
types
[
n
->
type
->
etype
]
&&
n
->
type
!=
idealbool
&&
n
->
type
!=
idealstring
)
{
if
(
isptr
[
n
->
type
->
etype
])
// Need parens when type begins with what might
// be misinterpreted as a unary operator: * or <-.
if
(
isptr
[
n
->
type
->
etype
]
||
(
n
->
type
->
etype
==
TCHAN
&&
n
->
type
->
chan
==
Crecv
))
return
fmtprint
(
f
,
"(%T)(%V)"
,
n
->
type
,
&
n
->
val
);
else
return
fmtprint
(
f
,
"%T(%V)"
,
n
->
type
,
&
n
->
val
);
...
...
test/fixedbugs/bug392.dir/one.go
View file @
836a517f
// Copyright 2012 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.
// Functions that the inliner exported incorrectly.
package
one
type
file
int
func
(
file
*
file
)
isnil
()
bool
{
return
file
==
nil
}
func
(
fil
*
file
)
isnil2
()
bool
{
return
fil
==
nil
}
type
T
int
// Issue 2678
func
F1
(
T
*
T
)
bool
{
return
T
==
nil
}
// Issue 2682.
func
F2
(
c
chan
int
)
bool
{
return
c
==
(
<-
chan
int
)(
nil
)
}
test/fixedbugs/bug392.dir/two.go
View file @
836a517f
// Copyright 2012 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.
// Use the functions in one.go so that the inlined
// forms get type-checked.
package
two
import
_
"./one"
import
"./one"
func
use
()
{
one
.
F1
(
nil
)
one
.
F2
(
nil
)
}
test/fixedbugs/bug392.go
View file @
836a517f
// $G $D/$F.dir/one.go && $G
-ll
$D/$F.dir/two.go
// $G $D/$F.dir/one.go && $G $D/$F.dir/two.go
// Copyright 2011 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.
//
// Issue 2678
// -ll flag in command above is to force typecheck on import, needed to trigger the bug.
// fixedbugs/bug392.dir/two.go:3: cannot call non-function *one.file (type one.file)
package
ignored
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