1
0
mirror of https://github.com/golang/go synced 2024-11-18 01:04:48 -07:00

sync/atomic: suppress checkptr errors for hammerStoreLoadPointer

This test could be updated to use unsafe.Pointer arithmetic properly
(e.g., see discussion at #34972), but it doesn't seem worthwhile. The
test is just checking that LoadPointer and StorePointer are atomic.

Updates #34972.

Change-Id: I85a8d610c1766cd63136cae686aa8a240a362a18
Reviewed-on: https://go-review.googlesource.com/c/go/+/202597
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Matthew Dempsky 2019-10-21 17:06:02 -07:00
parent 22278ca0d4
commit a97ccc8940

View File

@ -1140,6 +1140,9 @@ func hammerStoreLoadUintptr(t *testing.T, paddr unsafe.Pointer) {
StoreUintptr(addr, new)
}
//go:nocheckptr
// This code is just testing that LoadPointer/StorePointer operate
// atomically; it's not actually calculating pointers.
func hammerStoreLoadPointer(t *testing.T, paddr unsafe.Pointer) {
addr := (*unsafe.Pointer)(paddr)
v := uintptr(LoadPointer(addr))