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

Comments

@mdempsky
Copy link
Member

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

This comment has been minimized.

Copy link

commented Mar 12, 2019

@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.