]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: escape unsafe.Pointer conversions when -d=checkptr
authorMatthew Dempsky <mdempsky@google.com>
Thu, 17 Oct 2019 19:31:07 +0000 (12:31 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Thu, 17 Oct 2019 20:09:00 +0000 (20:09 +0000)
commitb6b984fcff9b6b3b8789c0b628e3226c1edc8b81
tree18d21016ed196e3c0515262f1a07145d465b6fde
parent9b8079158488120a0586d79ec57e0505fe0ec3eb
cmd/compile: escape unsafe.Pointer conversions when -d=checkptr

This CL tweaks escape analysis to treat unsafe.Pointer(ptr) as an
escaping operation when -d=checkptr is enabled. This allows better
detection of unsafe pointer arithmetic and conversions, because the
runtime checkptr instrumentation can currently only detect object
boundaries for heap objects, not stack objects.

Updates #22218.
Fixes #34959.

Change-Id: I856812cc23582fe4d0d401592583323e95919f28
Reviewed-on: https://go-review.googlesource.com/c/go/+/201781
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/cmd/compile/internal/gc/escape.go
src/cmd/compile/internal/gc/walk.go