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: don't depend on statictmp_ variables being read only #21940

randall77 opened this Issue Sep 20, 2017 · 3 comments


None yet
5 participants
Copy link

randall77 commented Sep 20, 2017

In cmd/compile/internal/gc/racewalk.go:

		// statictmp's are read-only
		if strings.HasPrefix(n.Sym.Name, "statictmp_") {
			return true

This isn't really true. If you do:

type T struct {
	x int
var y = &T{}

Then the &T allocates a variable that starts with statictmp_, but it is writeable.

I think it would be hard to have a race on these variables, as they are only accessed directly during init functions. But maybe we should update the comment.


@ianlancetaylor ianlancetaylor added this to the Go1.11 milestone Mar 30, 2018


This comment has been minimized.

Copy link

odeke-em commented Jun 15, 2018

How's it going here @dvyukov and @randall77?


This comment has been minimized.

Copy link
Contributor Author

randall77 commented Jun 15, 2018

I'm not sure what the right answer is here. Possibly this allows races to go undetected. But it is a very weird corner case, not sure it is worth the effort.
In any case, nothing is happening on it. Punting.

@randall77 randall77 modified the milestones: Go1.11, Go1.12 Jun 15, 2018


This comment has been minimized.

Copy link

dvyukov commented Jun 15, 2018

How hard is it to detect these variables? Is it just checking some addrtaken flag?

@andybons andybons modified the milestones: Go1.12, Go1.13 Feb 12, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.