Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile: type..eq function not generated #23546

Closed
cherrymui opened this issue Jan 25, 2018 · 7 comments

Comments

Projects
None yet
5 participants
@cherrymui
Copy link
Contributor

commented Jan 25, 2018

What version of Go are you using (go version)?

tip (e72e69a)

Does this issue reproduce with the latest release?

Yes, reproducible with Go 1.9, but not with Go 1.8.

What did you do?

https://play.golang.org/p/YoPVe0Td6KL

package main

func main() {
	a := f()
	println(a == f())
}

func f() [2]interface{} {
	var out [2]interface{}
	return out
}

This code does not build with Go tip:

$ go run x2.go 
# command-line-arguments
type..eq.[2]interface {}: call to external function
main.main: relocation target type..eq.[2]interface {} not defined
main.main: undefined: "type..eq.[2]interface {}"

It builds with Go 1.8 and gccgo.

$ go1.8 run x2.go 
true
$ go run -compiler=gccgo x2.go
true

@cherrymui cherrymui changed the title cmd/compile: .eq function not generated cmd/compile: type..eq function not generated Jan 25, 2018

@cherrymui

This comment has been minimized.

Copy link
Contributor Author

commented Jan 25, 2018

If [2]interface{} is changed to [0]interface{} or [1]interface{}, it builds fine. It seems length >= 2 makes it fail.

@mvdan

This comment has been minimized.

Copy link
Member

commented Jan 25, 2018

Not a regression in 1.10, so marking for 1.11.

@mvdan mvdan added this to the Go1.11 milestone Jan 25, 2018

@mvdan mvdan added the NeedsFix label Jan 25, 2018

@gopherbot

This comment has been minimized.

Copy link

commented Jan 25, 2018

Change https://golang.org/cl/89735 mentions this issue: test: add test for gccgo bug 23545

@randall77

This comment has been minimized.

Copy link
Contributor

commented Jan 29, 2018

Weird. This works:

$ go build issue23546.go
$ ./issue23546
true

But this doesn't:

$ go run issue23546.go
# command-line-arguments
type..eq.[2]interface {}: call to external function
main.main: relocation target type..eq.[2]interface {} not defined
main.main: undefined: "type..eq.[2]interface {}"
@cherrymui

This comment has been minimized.

Copy link
Contributor Author

commented Jan 29, 2018

Interesting.

This doesn't work:

$ go build -gcflags=-dwarf=false issue23546.go 
# command-line-arguments
type..eq.[2]interface {}: call to external function
main.main: relocation target type..eq.[2]interface {} not defined
main.main: undefined: "type..eq.[2]interface {}"

go run invokes the compiler with DWARF disabled. So it seems when we skip DWARF, we skipped too much.

gopherbot pushed a commit that referenced this issue Jan 31, 2018

test: add test for gccgo bug 23545
The fix is CL 91035.

Build only with gccgo at the moment, as it hits issue #23546.

Updates #23545.

Change-Id: I3a1367bb31b04773d31f71016f8fd7bd1855d7b5
Reviewed-on: https://go-review.googlesource.com/89735
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
@gopherbot

This comment has been minimized.

Copy link

commented Jul 6, 2018

Change https://golang.org/cl/122403 mentions this issue: cmd/compile: make sure alg functions are generated when we call them

@gopherbot

This comment has been minimized.

Copy link

commented Jul 7, 2018

Change https://golang.org/cl/122578 mentions this issue: cmd/compile: ensure alg functions are generated even without DWARF

@gopherbot gopherbot closed this in c801232 Jul 10, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.