Skip to content

cmd/compile: failure to reject initialization loop #21752

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
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. FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@mdempsky
Copy link
Contributor

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
@mknyszek mknyszek moved this to Triage Backlog in Go Compiler / Runtime Jul 15, 2022
@mdempsky
Copy link
Contributor Author

mdempsky commented Sep 7, 2023

This was fixed by switching to types2.

@mdempsky mdempsky closed this as completed Sep 7, 2023
@github-project-automation github-project-automation bot moved this from Triage Backlog to Done in Go Compiler / Runtime Sep 7, 2023
@golang golang locked and limited conversation to collaborators Sep 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge 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