-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/compile: missing write barrier on zeroing/assigning global #18956
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
Labels
Milestone
Comments
CL https://golang.org/cl/36355 mentions this issue. |
CL https://golang.org/cl/36410 mentions this issue. |
CL https://golang.org/cl/36531 mentions this issue. |
CL 36530 pending for cherry-pick. Then this bug should be moved to Go 1.9 for the followup CL. |
gopherbot
pushed a commit
that referenced
this issue
Feb 7, 2017
The compiler did not emit write barrier for assigning global with struct literal, like global = T{} where T contains pointer. The relevant code path is: walkexpr OAS var_ OSTRUCTLIT oaslit anylit OSTRUCTLIT walkexpr OAS var_ nil return without adding write barrier return true break (without adding write barrier) This CL makes oaslit not apply to globals. See also CL https://go-review.googlesource.com/c/36355/ for an alternative fix. The downside of this is that it generates static data for zeroing struct now. Also this only covers global. If there is any lurking bug with implicit zeroing other than globals, this doesn't fix. Fixes #18956. Change-Id: Ibcd27e4fae3aa38390ffa94a32a9dd7a802e4b37 Reviewed-on: https://go-review.googlesource.com/36410 Reviewed-by: Russ Cox <[email protected]> Run-TryBot: Cherry Zhang <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> (cherry picked from commit 160914e) Reviewed-on: https://go-review.googlesource.com/36531
The new write barrier insertion in SSA shouldn't have this problem. Closing. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
What version of Go are you using (
go version
)?tip (
go version devel +47d2a4dafa Mon Feb 6 07:21:14 2017 +0000 darwin/amd64
)For this code
the compiler does not generate write barrier.
But I believe it should have write barrier for the new hybrid barrier.
cc @aclements
The text was updated successfully, but these errors were encountered: