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: nil type word in interface #28390

Closed
josharian opened this issue Oct 25, 2018 · 8 comments
Closed

cmd/compile: nil type word in interface #28390

josharian opened this issue Oct 25, 2018 · 8 comments

Comments

@josharian
Copy link
Contributor

Originally reported by @shuLhan on golang-dev.

The following code panics due to a nil type word:

package main

import (
	"fmt"
)

type A struct {
	K int
	S string
	M map[string]string
}

func newA(k int, s string) (a A) {
	a.K = k
	a.S = s
	a.M = make(map[string]string)
	a.M[s] = s
	return
}

func proxy() (x int, a A) {
	return 1, newA(2, "3")
}

func consume(x int, a interface{}) {
	fmt.Println(x)
	fmt.Println(a)
}

func main() {
	consume(proxy())
}

Introduced by CL 114797.

@josharian josharian added this to the Go1.12 milestone Oct 25, 2018
@josharian josharian self-assigned this Oct 25, 2018
@josharian
Copy link
Contributor Author

I'm really surprised that this didn't fail anywhere else in all.bash.

In any case, testing a fix now.

@gopherbot
Copy link

Change https://golang.org/cl/144598 mentions this issue: cmd/compile: convert arguments as needed

@cherrymui
Copy link
Member

I'm really surprised that this didn't fail anywhere else in all.bash.

I guess it only triggers in the form of f(g()) where g returns multiple results and some of the results need conversion? That is probably quite rare...

@josharian
Copy link
Contributor Author

Actually, g() is inlined in the code above, so it isn't (really) of the form f(g()).

@tandr
Copy link

tandr commented Oct 25, 2018

if this regression is reproducible on Go 1.11.1 (as reported in golang-nuts), it seems to be appropriate to have it cherrypicked for go1.11.2 as a target. (IMHO)

@josharian
Copy link
Contributor Author

Do you have a link handy for the 1.11.1 reproduction report? I can’t reproduce locally with 1.11.1. And the code in question is very much new to 1.12...

@cherrymui
Copy link
Member

I don't think it is reproducible with Go 1.11. I can only reproduce it with tip, and the culprit CL is pretty recent, past Go 1.11.

@tandr do you have a link to golang-nuts report?

@tandr
Copy link

tandr commented Oct 25, 2018

D'oh, my bad... I misread the https://groups.google.com/forum/#!topic/golang-dev/3Fy0M5dlc-w -- it is NOT reproducible on 1.11.1 (first email in a thread - https://groups.google.com/d/msg/golang-dev/3Fy0M5dlc-w/s5ZdqvfOBwAJ )

Terrible sorry for the noise

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants