diff options
Diffstat (limited to 'src/runtime/testdata/testprog/checkptr.go')
| -rw-r--r-- | src/runtime/testdata/testprog/checkptr.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/runtime/testdata/testprog/checkptr.go b/src/runtime/testdata/testprog/checkptr.go index 60e71e66d7..ff99fa8c7b 100644 --- a/src/runtime/testdata/testprog/checkptr.go +++ b/src/runtime/testdata/testprog/checkptr.go @@ -16,6 +16,7 @@ func init() { register("CheckPtrAlignmentNilPtr", CheckPtrAlignmentNilPtr) register("CheckPtrArithmetic", CheckPtrArithmetic) register("CheckPtrArithmetic2", CheckPtrArithmetic2) + register("CheckPtrArithmeticUnsafeAdd", CheckPtrArithmeticUnsafeAdd) register("CheckPtrSize", CheckPtrSize) register("CheckPtrSmall", CheckPtrSmall) register("CheckPtrSliceOK", CheckPtrSliceOK) @@ -79,6 +80,11 @@ func CheckPtrArithmetic2() { sink2 = unsafe.Pointer(uintptr(p) & ^one) } +func CheckPtrArithmeticUnsafeAdd() { + data := make([]byte, 128) + sink2 = (*byte)(unsafe.Add(unsafe.Pointer(unsafe.SliceData(data)), len(data))) +} + func CheckPtrSize() { p := new(int64) sink2 = p |
