Source file
test/fixedbugs/issue19168.go
1
2
3
4
5
6
7 package p
8
9 import (
10 "reflect"
11 "unsafe"
12
13 reflect2 "reflect"
14 )
15
16 func sink(e interface{})
17
18 func a(hdr *reflect.SliceHeader, p *byte) {
19 hdr.Data = uintptr(unsafe.Pointer(p))
20 }
21
22 func b(hdr *reflect.StringHeader, p *byte) {
23 hdr.Data = uintptr(unsafe.Pointer(p))
24 }
25
26 func c(hdrs *[1]reflect.SliceHeader, p *byte) {
27 hdrs[0].Data = uintptr(unsafe.Pointer(p))
28 }
29
30 func d(hdr *struct{ s reflect.StringHeader }, p *byte) {
31 hdr.s.Data = uintptr(unsafe.Pointer(p))
32 }
33
34 func e(p *byte) (resHeap, resStack string) {
35 sink(&resHeap)
36
37 hdr := (*reflect.StringHeader)(unsafe.Pointer(&resHeap))
38 hdr.Data = uintptr(unsafe.Pointer(p))
39
40
41 hdr = (*reflect.StringHeader)(unsafe.Pointer(&resStack))
42 hdr.Data = uintptr(unsafe.Pointer(p))
43
44 return
45 }
46
47 func f(hdr *reflect2.SliceHeader, p *byte) {
48 hdr.Data = uintptr(unsafe.Pointer(p))
49 }
50
51 type SliceHeader struct {
52 Data uintptr
53 }
54
55 func g(hdr *SliceHeader, p *byte) {
56
57 hdr.Data = uintptr(unsafe.Pointer(p))
58 }
59
View as plain text