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

Open
mdempsky opened this issue Mar 12, 2019 · 1 comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@mdempsky
Copy link
Member

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 Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Mar 12, 2019
@julieqiu
Copy link
Member

@julieqiu julieqiu added this to the Go1.13 milestone Mar 12, 2019
@andybons andybons modified the milestones: Go1.13, Go1.14 Jul 8, 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
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. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
Status: Triage Backlog
Development

No branches or pull requests

5 participants