aboutsummaryrefslogtreecommitdiff
path: root/test/escape_unsafe.go
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2019-08-30 10:56:30 -0700
committerMatthew Dempsky <mdempsky@google.com>2019-09-03 17:52:06 +0000
commit9f89edcd9668bb3b011961fbcdd8fc2796acba5d (patch)
treefac2ea3d67038eff5b913af5cb6b24224c94767f /test/escape_unsafe.go
parenta71967e4c5aa34f274b8b9aff915f14ac00e7ee8 (diff)
downloadgo-9f89edcd9668bb3b011961fbcdd8fc2796acba5d.tar.gz
go-9f89edcd9668bb3b011961fbcdd8fc2796acba5d.zip
cmd/compile: silence esc diagnostics about directiface OCONVIFACEs
In general, a conversion to interface type may require values to be boxed, which in turn necessitates escape analysis to determine whether the boxed representation can be stack allocated. However, esc.go used to unconditionally print escape analysis decisions about OCONVIFACE, even for conversions that don't require boxing (e.g., pointers, channels, maps, functions). For test compatibility with esc.go, escape.go similarly printed these useless diagnostics. This CL removes the diagnostics, and updates test expectations accordingly. Change-Id: I97c57a4a08e44d265bba516c78426ff4f2bf1e12 Reviewed-on: https://go-review.googlesource.com/c/go/+/192697 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'test/escape_unsafe.go')
-rw-r--r--test/escape_unsafe.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/escape_unsafe.go b/test/escape_unsafe.go
index 16f14c07be..b34beacccb 100644
--- a/test/escape_unsafe.go
+++ b/test/escape_unsafe.go
@@ -41,12 +41,12 @@ func arithMask() unsafe.Pointer {
// BAD: should be "leaking param: p to result ~r1 level=0$"
func valuePointer(p *int) unsafe.Pointer { // ERROR "leaking param: p$"
- return unsafe.Pointer(reflect.ValueOf(p).Pointer()) // ERROR "p escapes to heap"
+ return unsafe.Pointer(reflect.ValueOf(p).Pointer())
}
// BAD: should be "leaking param: p to result ~r1 level=0$"
func valueUnsafeAddr(p *int) unsafe.Pointer { // ERROR "leaking param: p$"
- return unsafe.Pointer(reflect.ValueOf(p).Elem().UnsafeAddr()) // ERROR "p escapes to heap"
+ return unsafe.Pointer(reflect.ValueOf(p).Elem().UnsafeAddr())
}
// (6) Conversion of a reflect.SliceHeader or reflect.StringHeader