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: add consistency check that local variables are associated with Curfn #30754

mdempsky opened this issue Mar 12, 2019 · 1 comment


Copy link

@mdempsky mdempsky commented Mar 12, 2019

CL 153841 needed to create local temporaries in "init" to handle when f(g()) appears in a package-scope initialization statement.

But the concurrently developed CL 159717 moved initialization statements to run in "init.ializer" instead of "init."

The result was entirely unsafe because initialization statements compiled within "init.ializer" were referring to local variables in "init," but it seems like there weren't any compiler consistency checks that noticed this. It was only detected because net/http/pprof happened to fail very loudly at runtime when built with -gcflags=-N.

Granted maybe CL 153841 was being too clever with its solution to "init" (now "init.ializer") not yet existing and it's worth revisiting whether "init.ializer" can be created earlier, but it still surprised me that the backend didn't notice it was using a PAUTO variable from another function.

@julieqiu julieqiu added the NeedsInvestigation label Mar 12, 2019
Copy link

@julieqiu julieqiu commented Mar 12, 2019

@julieqiu julieqiu added this to the Go1.13 milestone Mar 12, 2019
@andybons andybons removed this from the Go1.13 milestone Jul 8, 2019
@andybons andybons added this to the Go1.14 milestone Jul 8, 2019
@rsc rsc removed this from the Go1.14 milestone Oct 9, 2019
@rsc rsc added this to the Backlog milestone Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

4 participants