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

gccgo: unreported initialization cycles #7961

Closed
griesemer opened this issue May 9, 2014 · 4 comments
Closed

gccgo: unreported initialization cycles #7961

griesemer opened this issue May 9, 2014 · 4 comments

Comments

@griesemer
Copy link
Contributor

The gccgo compiler does not report initialization cycles that exist through function
values created via method values and method expressions:

http://play.golang.org/p/QP6sz05ZX-

See also spec clarification https://golang.org/cl/99020043 (issue  6703).
@ianlancetaylor
Copy link
Contributor

Comment 1:

Is this still a problem?

@griesemer
Copy link
Contributor Author

Comment 2:

I believe it is. Per the spec:
"A reference to a method m is a method value or method expression of the form t.m, where
the (static) type of t is not an interface type, and the method m is in the method set
of t. It is immaterial whether the resulting function value t.m is invoked." (
http://tip.golang.org/ref/spec#Package_initialization )
In the code mentioned above, when enabling the line (removing the comment //)
    x = T(0).m
the gccgo doesn't complain. But T(0).m is a method value, and T(0) (== t) is not of
interface type. The next line correctly reports a cycle, and it's only difference is
that it calls the method.
Per the spec, whether the function/method is called is irrelevant (because the value
could easily be assigned to a variable which is then called afterwards, thus hiding a
cycle).

@paranoiacblack
Copy link
Contributor

Comment 3:

Status changed to Started.

@paranoiacblack
Copy link
Contributor

Comment 4:

Fixed in https://code.google.com/p/gofrontend/source/detail?r=f0e1f402d71c.

Status changed to Fixed.

@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
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