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: init loop does not trace through inlined functions #4758

Open
rsc opened this issue Feb 5, 2013 · 9 comments
Open

cmd/compile: init loop does not trace through inlined functions #4758

rsc opened this issue Feb 5, 2013 · 9 comments
Milestone

Comments

@rsc
Copy link
Contributor

rsc commented Feb 5, 2013

$ cat x.go
package p
var x = f
func f() { g() }
func g() { _ = x }
$ 6g x.go
x.go:2: initialization loop:
    x.go:2 x refers to
    x.go:3 f refers to
    x.go:2 x

Should be f refers to g refers to x (but g has been inlined into f and been dropped).
@rsc
Copy link
Contributor Author

rsc commented Mar 12, 2013

Comment 1:

Labels changed: added go1.1maybe, removed go1.1.

@robpike
Copy link
Contributor

robpike commented May 18, 2013

Comment 2:

Labels changed: added go1.2maybe, removed go1.1maybe.

@rsc
Copy link
Contributor Author

rsc commented Jul 30, 2013

Comment 3:

Labels changed: added feature.

@robpike
Copy link
Contributor

robpike commented Aug 30, 2013

Comment 4:

Not for 1.2.

Labels changed: removed go1.2maybe.

@rsc
Copy link
Contributor Author

rsc commented Nov 27, 2013

Comment 5:

Labels changed: added go1.3maybe.

@rsc
Copy link
Contributor Author

rsc commented Nov 27, 2013

Comment 6:

Labels changed: removed feature.

@rsc
Copy link
Contributor Author

rsc commented Dec 4, 2013

Comment 7:

Labels changed: added release-none, removed go1.3maybe.

@rsc
Copy link
Contributor Author

rsc commented Dec 4, 2013

Comment 8:

Labels changed: added repo-main.

@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@rsc rsc changed the title cmd/gc: init loop does not trace through inlined functions cmd/compile: init loop does not trace through inlined functions Jun 8, 2015
@cuonglm
Copy link
Member

cuonglm commented Oct 4, 2023

go1.21 and tip now emits:

p.go:3:5: initialization cycle for x
	p.go:3:5: x refers to
	p.go:5:6: f refers to
	p.go:6:6: g refers to
	p.go:3:5: x

I think we could close this issue now.

cc @rsc

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

No branches or pull requests

3 participants