diff options
author | Keith Randall <khr@golang.org> | 2020-02-15 19:23:07 -0800 |
---|---|---|
committer | Keith Randall <khr@golang.org> | 2020-02-25 23:41:03 +0000 |
commit | 089e482b3dd2026178c8ee5b90d9aadb6bf81239 (patch) | |
tree | 744166f39c5e64ddf74079b52d49294f4f00494c /src/runtime/slice.go | |
parent | 0652c80e2afa14d62067be567c498c83a6485fd8 (diff) | |
download | go-089e482b3dd2026178c8ee5b90d9aadb6bf81239.tar.gz go-089e482b3dd2026178c8ee5b90d9aadb6bf81239.zip |
runtime: reorder race detector calls in slicecopy
In rare circumstances, this helps report a race which would
otherwise go undetected.
Fixes #36794
Change-Id: I8a3c9bd6fc34efa51516393f7ee72531c34fb073
Reviewed-on: https://go-review.googlesource.com/c/go/+/220685
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Diffstat (limited to 'src/runtime/slice.go')
-rw-r--r-- | src/runtime/slice.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/runtime/slice.go b/src/runtime/slice.go index 16937a2a01..9ad814a555 100644 --- a/src/runtime/slice.go +++ b/src/runtime/slice.go @@ -211,12 +211,12 @@ func slicecopy(to, fm slice, width uintptr) int { if raceenabled { callerpc := getcallerpc() pc := funcPC(slicecopy) - racewriterangepc(to.array, uintptr(n*int(width)), callerpc, pc) racereadrangepc(fm.array, uintptr(n*int(width)), callerpc, pc) + racewriterangepc(to.array, uintptr(n*int(width)), callerpc, pc) } if msanenabled { - msanwrite(to.array, uintptr(n*int(width))) msanread(fm.array, uintptr(n*int(width))) + msanwrite(to.array, uintptr(n*int(width))) } size := uintptr(n) * width |