Debian Codegraph @

test/fixedbugs/bug513.go

raw
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
12 package main
13
14 import "unsafe"
15
16 var v1 = new([2]int16)
17 var v2 *[3]int64
18
19 func main() {
20 v2 = (*[3]int64)(unsafe.Pointer(uintptr(unsafe.Pointer(&(*v1)[0]))))
21 }