Skip to content

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

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

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

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

cherrymui opened this issue Jan 25, 2018 · 7 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Milestone

Comments

@cherrymui
Copy link
Member

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
Copy link
Member Author

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

@mvdan
Copy link
Member

mvdan 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 The path to resolution is known, but the work has not been done. label Jan 25, 2018
@gopherbot
Copy link
Contributor

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

@randall77
Copy link
Contributor

randall77 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
Copy link
Member Author

cherrymui 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
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
Copy link
Contributor

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

@gopherbot
Copy link
Contributor

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

@golang golang locked and limited conversation to collaborators Jul 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Projects
None yet
Development

No branches or pull requests

5 participants