mirror of
				https://github.com/golang/go.git
				synced 2025-11-04 02:30:57 +00:00 
			
		
		
		
	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>
		
			
				
	
	
		
			14 lines
		
	
	
	
		
			327 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			14 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) }
 |