aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/proc.go
diff options
context:
space:
mode:
authorCherry Mui <cherryyz@google.com>2021-05-20 21:40:32 -0400
committerCherry Mui <cherryyz@google.com>2021-05-21 22:12:18 +0000
commit6a81e063dd0bf28d21b7085cc1d9e76eaeb78460 (patch)
tree3ffe0cf53f957ddb5c7fc6666f25dd2408d4db30 /src/runtime/proc.go
parent7d928460a183f4efeed97638aa29f5f1fe74e397 (diff)
downloadgo-6a81e063dd0bf28d21b7085cc1d9e76eaeb78460.tar.gz
go-6a81e063dd0bf28d21b7085cc1d9e76eaeb78460.zip
[dev.typeparams] runtime: fix misuse of funcPC
funcPC expects a func value. There are places where we pass an unsafe.Pointer, which is technically undefined. In proc.go it is actually representing a func value, so the expression does the right thing. Cast to a func value so it is clearer. In os_freebsd.go it is a raw function pointer. Using funcPC on a raw function pointer is incorrect. Just use it directly instead. Change-Id: I3c5d61cea08f0abf5737834b520f9f1b583c1d34 Reviewed-on: https://go-review.googlesource.com/c/go/+/321953 Trust: Cherry Mui <cherryyz@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'src/runtime/proc.go')
-rw-r--r--src/runtime/proc.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/runtime/proc.go b/src/runtime/proc.go
index 694f456ac5..6c896cb993 100644
--- a/src/runtime/proc.go
+++ b/src/runtime/proc.go
@@ -6487,7 +6487,8 @@ func doInit(t *initTask) {
// Load stats non-atomically since tracinit is updated only by this init goroutine.
after := inittrace
- pkg := funcpkgpath(findfunc(funcPC(firstFunc)))
+ f := *(*func())(unsafe.Pointer(&firstFunc))
+ pkg := funcpkgpath(findfunc(funcPC(f)))
var sbuf [24]byte
print("init ", pkg, " @")