mirror of
https://github.com/golang/go
synced 2024-11-05 21:36:12 -07:00
f9226454b9
We need to explicitly convert pointers to unsafe.Pointer before passing to the runtime checkptr instrumentation in case the user declared their own type with underlying type unsafe.Pointer. Updates #22218. Fixes #34966. Change-Id: I3baa2809d77f8257167cd78f57156f819130baa8 Reviewed-on: https://go-review.googlesource.com/c/go/+/201782 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
15 lines
327 B
Go
15 lines
327 B
Go
// compile -d=checkptr
|
|
|
|
// Copyright 2019 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package p
|
|
|
|
import "unsafe"
|
|
|
|
type ptr unsafe.Pointer
|
|
|
|
func f(p ptr) *int { return (*int)(p) }
|
|
func g(p ptr) ptr { return ptr(uintptr(p) + 1) }
|