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

Closed
mdempsky opened this issue Sep 3, 2017 · 3 comments
Closed

cmd/compile: failure to reject initialization loop #21752

mdempsky opened this issue Sep 3, 2017 · 3 comments
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@mdempsky
Copy link
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
Copy link
Contributor

Marking 1.10 so it stays on radar.

@griesemer griesemer modified the milestones: Go1.10, Go1.11 Nov 28, 2017
@ianlancetaylor ianlancetaylor added the NeedsFix The path to resolution is known, but the work has not been done. label Jun 30, 2018
@ianlancetaylor ianlancetaylor modified the milestones: Go1.11, Go1.12 Jun 30, 2018
@odeke-em
Copy link
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.

@odeke-em odeke-em self-assigned this Oct 18, 2018
@griesemer griesemer modified the milestones: Go1.12, Go1.13 Nov 28, 2018
@griesemer griesemer modified the milestones: Go1.13, Go1.14 May 6, 2019
@rsc rsc modified the milestones: Go1.14, Backlog Oct 9, 2019
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jul 13, 2022
@mdempsky
Copy link
Member Author

mdempsky commented Sep 7, 2023

This was fixed by switching to types2.

@mdempsky mdempsky closed this as completed Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

6 participants