1// run -race -gcflags=all=-d=checkptr=0 2 3//go:build ((linux && amd64) || (linux && ppc64le) || (darwin && amd64) || (freebsd && amd64) || (netbsd && amd64) || (windows && amd64)) && cgo 4 5// Copyright 2021 The Go Authors. All rights reserved. 6// Use of this source code is governed by a BSD-style 7// license that can be found in the LICENSE file. 8 9// Although -race turns on -d=checkptr, the explicit -d=checkptr=0 10// should override it. 11 12package main 13 14import "unsafe" 15 16var v1 = new([2]int16) 17var v2 *[3]int64 18 19func main() { 20 v2 = (*[3]int64)(unsafe.Pointer(uintptr(unsafe.Pointer(&(*v1)[0])))) 21} 22