-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Closed
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.
Milestone
Description
What version of Go are you using (go version)?
go version go1.10.3 gccgo (GCC) 9.0.0 20180622 (experimental) linux/amd64
What did you do?
package main
type I interface{
M()
}
type T struct{}
func (T) M() {}
//go:noinline
func G() I {
println("XXX")
return T{}
}
//go:noinline
func G2(interface{}) {}
//go:noinline
func F() {
x := G().M
G2(x)
}
func main() {
F()
}
What did you expect to see?
$ go run -compiler=gc i.go
XXX
What did you see instead?
$ go run -compiler=gccgo i.go
XXX
XXX
It generates two calls to G in F, one in nil check, one in constructing the func value G().M.
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.