go version
go version go1.10.2 darwin/amd64
test code:
func TestPoint(t *testing.T) {
type A struct {
X int
Y string
}
type B struct {
X int
Y string
Z string
}
a := A{X: 2, Y: "yy"}
b := (*B)(unsafe.Pointer(&a))
b.Z = "zz"
fmt.Printf(" z: %v\n", b.Z)
return
}
panic info:
=== RUN TestPoint
z: zz
runtime: unexpected return pc for runtime.sigpanic called from 0x2
stack: frame={sp:0xc42004cf58, fp:0xc42004cfa8}
stack=[0xc42004c000,0xc42004d000)
000000c42004ce58: 000000c42004ce88 00000000010514bb <runtime.call32+59>
000000c42004ce68: 000000c4200c00f0 000000c4200b8020
000000c42004ce78: 0000000000000007 0000000000000020
000000c42004ce88: 000000c42004cf28 0000000001027ee9 <runtime.gopanic+553>
000000c42004ce98: 0000000000000000 0000000001136758
000000c42004cea8: 000000c42008e6b0 0000000800000008
000000c42004ceb8: 0000000000000000 000000c420033720
000000c42004cec8: 00000000010973c2 <fmt.Printf+114> 000000c420066600
000000c42004ced8: 000000c42009a008 000000c42008e6a0
000000c42004cee8: 000000c42008e680 000000c420066628
000000c42004cef8: 000000c420066620 000000c42004ce68
000000c42004cf08: 0000000001108ea0 00000000011d4f80
000000c42004cf18: 0000000000000000 0000000000000001
000000c42004cf28: 000000c42004cf48 0000000001026f5e <runtime.panicmem+94>
000000c42004cf38: 0000000001108ea0 00000000011d4f80
000000c42004cf48: 000000c42004cf98 000000000103b7aa <runtime.sigpanic+378>
000000c42004cf58: <000000c420066600 0000000000000001
000000c42004cf68: 0000000000000000 00000000010fe240
000000c42004cf78: 000000c420082460 000000c420066600
000000c42004cf88: 000000000112d8f6 0000000000000002
000000c42004cf98: 000000000112d8f8 !0000000000000002
000000c42004cfa8: >000000c4200c00f0 00000000000aace2
000000c42004cfb8: 00000000011dc160 0000000000000000
000000c42004cfc8: 0000000001053ac1 <runtime.goexit+1> 000000c4200c00f0
000000c42004cfd8: 0000000001136150 0000000000000000
000000c42004cfe8: 0000000000000000 0000000000000000
000000c42004cff8: 0000000000000000
fatal error: unknown caller pc
runtime stack:
runtime.throw(0x112fd13, 0x11)
/Users/bao/Documents/reading/golang/go1.10.2/src/runtime/panic.go:616
+0x81
runtime.gentraceback(0xffffffffffffffff, 0xffffffffffffffff, 0x0,
0xc420066600, 0x0, 0x0, 0x7fffffff, 0x1136348, 0x7ffeefbff088, 0x0, ...)
/Users/bao/Documents/reading/golang/go1.10.2/src/runtime/traceback.go:257
+0x1bdb
runtime.copystack(0xc420066600, 0x1000, 0x1)
/Users/bao/Documents/reading/golang/go1.10.2/src/runtime/stack.go:891
+0x270
runtime.newstack()
/Users/bao/Documents/reading/golang/go1.10.2/src/runtime/stack.go:1063
+0x30f
runtime.morestack()
/Users/bao/Documents/reading/golang/go1.10.2/src/runtime/asm_amd64.s:492
+0x89
goroutine 19 [copystack]:
fmt.(*pp).argNumber(0xc4200c6000, 0x0, 0x112db26, 0x5, 0x1, 0x1, 0x0, 0x0,
0x0)
/Users/bao/Documents/reading/golang/go1.10.2/src/fmt/print.go:926
+0x112 fp=0xc42004cb48 sp=0xc42004cb40 pc=0x109d9a2
fmt.(*pp).doPrintf(0xc4200c6000, 0x112db26, 0x5, 0xc42004ccc8, 0x1, 0x1)
/Users/bao/Documents/reading/golang/go1.10.2/src/fmt/print.go:1014
+0x1ca fp=0xc42004cc30 sp=0xc42004cb48 pc=0x109deba
fmt.Sprintf(0x112db26, 0x5, 0xc4200334c8, 0x1, 0x1, 0xc42008e6d8,
0xc42008e6e0)
/Users/bao/Documents/reading/golang/go1.10.2/src/fmt/print.go:203 +0x66
fp=0xc42004cc88 sp=0xc42004cc30 pc=0x1097466
testing.fmtDuration(0xa388, 0x3, 0xc420026570)
/Users/bao/Documents/reading/golang/go1.10.2/src/testing/testing.go:438
+0xdf fp=0xc42004cce8 sp=0xc42004cc88 pc=0x10ae90f
testing.(*T).report(0xc4200c00f0)
/Users/bao/Documents/reading/golang/go1.10.2/src/testing/testing.go:997
+0x57 fp=0xc42004cdf8 sp=0xc42004cce8 pc=0x10afcf7
testing.tRunner.func1(0xc4200c00f0)
/Users/bao/Documents/reading/golang/go1.10.2/src/testing/testing.go:741
+0x285 fp=0xc42004ce68 sp=0xc42004cdf8 pc=0x10b2e75
runtime.call32(0x0, 0x1136758, 0xc42008e6b0, 0x800000008)
/Users/bao/Documents/reading/golang/go1.10.2/src/runtime/asm_amd64.s:585
+0x3b fp=0xc42004ce98 sp=0xc42004ce68 pc=0x10514bb
panic(0x1108ea0, 0x11d4f80)
/Users/bao/Documents/reading/golang/go1.10.2/src/runtime/panic.go:502
+0x229 fp=0xc42004cf38 sp=0xc42004ce98 pc=0x1027ee9
runtime.panicmem()
/Users/bao/Documents/reading/golang/go1.10.2/src/runtime/panic.go:63
+0x5e fp=0xc42004cf58 sp=0xc42004cf38 pc=0x1026f5e
runtime: unexpected return pc for runtime.sigpanic called from 0x2
stack: frame={sp:0xc42004cf58, fp:0xc42004cfa8}
stack=[0xc42004c000,0xc42004d000)
000000c42004ce58: 000000c42004ce88 00000000010514bb <runtime.call32+59>
000000c42004ce68: 000000c4200c00f0 000000c4200b8020
000000c42004ce78: 0000000000000007 0000000000000020
000000c42004ce88: 000000c42004cf28 0000000001027ee9 <runtime.gopanic+553>
000000c42004ce98: 0000000000000000 0000000001136758
000000c42004cea8: 000000c42008e6b0 0000000800000008
000000c42004ceb8: 0000000000000000 000000c420033720
000000c42004cec8: 00000000010973c2 <fmt.Printf+114> 000000c420066600
000000c42004ced8: 000000c42009a008 000000c42008e6a0
000000c42004cee8: 000000c42008e680 000000c420066628
000000c42004cef8: 000000c420066620 000000c42004ce68
000000c42004cf08: 0000000001108ea0 00000000011d4f80
000000c42004cf18: 0000000000000000 0000000000000001
000000c42004cf28: 000000c42004cf48 0000000001026f5e <runtime.panicmem+94>
000000c42004cf38: 0000000001108ea0 00000000011d4f80
000000c42004cf48: 000000c42004cf98 000000000103b7aa <runtime.sigpanic+378>
000000c42004cf58: <000000c420066600 0000000000000001
000000c42004cf68: 0000000000000000 00000000010fe240
000000c42004cf78: 000000c420082460 000000c420066600
000000c42004cf88: 000000000112d8f6 0000000000000002
000000c42004cf98: 000000000112d8f8 !0000000000000002
000000c42004cfa8: >000000c4200c00f0 00000000000aace2
000000c42004cfb8: 00000000011dc160 0000000000000000
000000c42004cfc8: 0000000001053ac1 <runtime.goexit+1> 000000c4200c00f0
000000c42004cfd8: 0000000001136150 0000000000000000
000000c42004cfe8: 0000000000000000 0000000000000000
000000c42004cff8: 0000000000000000
runtime.sigpanic()
/Users/bao/Documents/reading/golang/go1.10.2/src/runtime/signal_unix.go:388
+0x17a fp=0xc42004cfa8 sp=0xc42004cf58 pc=0x103b7aa
created by testing.(*T).Run
/Users/bao/Documents/reading/golang/go1.10.2/src/testing/testing.go:824
+0x2e0
goroutine 1 [chan receive]:
testing.(*T).Run(0xc4200c00f0, 0x112e47d, 0x9, 0x1136150, 0x1065836)
/Users/bao/Documents/reading/golang/go1.10.2/src/testing/testing.go:825
+0x301
testing.runTests.func1(0xc4200c0000)
/Users/bao/Documents/reading/golang/go1.10.2/src/testing/testing.go:1063
+0x64
testing.tRunner(0xc4200c0000, 0xc42004bdf8)
/Users/bao/Documents/reading/golang/go1.10.2/src/testing/testing.go:777
+0xd0
testing.runTests(0xc4200a0020, 0x11d5140, 0x1, 0x1, 0x100e759)
/Users/bao/Documents/reading/golang/go1.10.2/src/testing/testing.go:1061
+0x2c4
testing.(*M).Run(0xc4200b4000, 0x0)
/Users/bao/Documents/reading/golang/go1.10.2/src/testing/testing.go:978
+0x171
main.main()
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.