1// run -gcflags=-d=checkptr
2
3// Copyright 2019 The Go Authors. All rights reserved.
4// Use of this source code is governed by a BSD-style
5// license that can be found in the LICENSE file.
6
7package main
8
9import (
10	"reflect"
11	"unsafe"
12)
13
14var s []int
15
16func main() {
17	s = []int{42}
18	h := (*reflect.SliceHeader)(unsafe.Pointer(&s))
19	x := *(*int)(unsafe.Pointer(h.Data))
20	if x != 42 {
21		panic(x)
22	}
23}
24