aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/testdata/testprog/checkptr.go
diff options
context:
space:
mode:
authorCherry Zhang <cherryyz@google.com>2020-08-21 14:18:06 -0400
committerCherry Zhang <cherryyz@google.com>2020-08-21 14:18:06 -0400
commit0ef562592fe05b50b0ae8fce495ee7e2eec791f0 (patch)
treed1c0f668e473ebdcb4a30e190008043bdb223bd9 /src/runtime/testdata/testprog/checkptr.go
parentac5c406ef0ab20e2a11f57470271266ef4265221 (diff)
parent9679b307334bce77cc6e50751956a4c717e9458c (diff)
downloadgo-0ef562592fe05b50b0ae8fce495ee7e2eec791f0.tar.xz
[dev.link] all: merge branch 'master' into dev.link
Change-Id: Ic66b5138f3ecd9e9a48d7ab05782297c06e4a5b5
Diffstat (limited to 'src/runtime/testdata/testprog/checkptr.go')
-rw-r--r--src/runtime/testdata/testprog/checkptr.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/runtime/testdata/testprog/checkptr.go b/src/runtime/testdata/testprog/checkptr.go
index 45e6fb1aa5..e0a2794f4c 100644
--- a/src/runtime/testdata/testprog/checkptr.go
+++ b/src/runtime/testdata/testprog/checkptr.go
@@ -10,6 +10,7 @@ func init() {
register("CheckPtrAlignmentNoPtr", CheckPtrAlignmentNoPtr)
register("CheckPtrAlignmentPtr", CheckPtrAlignmentPtr)
register("CheckPtrArithmetic", CheckPtrArithmetic)
+ register("CheckPtrArithmetic2", CheckPtrArithmetic2)
register("CheckPtrSize", CheckPtrSize)
register("CheckPtrSmall", CheckPtrSmall)
}
@@ -32,6 +33,13 @@ func CheckPtrArithmetic() {
sink2 = (*int)(unsafe.Pointer(i))
}
+func CheckPtrArithmetic2() {
+ var x [2]int64
+ p := unsafe.Pointer(&x[1])
+ var one uintptr = 1
+ sink2 = unsafe.Pointer(uintptr(p) & ^one)
+}
+
func CheckPtrSize() {
p := new(int64)
sink2 = p