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: failure to reject initialization loop #21752

Open
mdempsky opened this Issue Sep 3, 2017 · 2 comments

Comments

Projects
None yet
4 participants
@mdempsky
Member

mdempsky commented Sep 3, 2017

cmd/compile accepts this bit of code, while go/types and gccgo reject it as an initialization cycle ("A refers to A"):

var A = func() int {
	if false {
		return A
	}
	return 0
}()

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

Related #21750. The common issue here is probably that we're performing initialization order analysis based on the optimized/inlined functions rather than the original Go source.

/cc @griesemer

@griesemer griesemer self-assigned this Sep 18, 2017

@griesemer griesemer added this to the Go1.10 milestone Sep 18, 2017

@griesemer

This comment has been minimized.

Contributor

griesemer commented Sep 18, 2017

Marking 1.10 so it stays on radar.

@griesemer griesemer modified the milestones: Go1.10, Go1.11 Nov 28, 2017

@ianlancetaylor ianlancetaylor modified the milestones: Go1.11, Go1.12 Jun 30, 2018

@odeke-em

This comment has been minimized.

Member

odeke-em commented Oct 18, 2018

Thanks for the report @mdempsky! Commenting here to add this to my priority list or at least radar, for Go1.12.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment