aboutsummaryrefslogtreecommitdiff
path: root/test/uintptrescapes2.go
diff options
context:
space:
mode:
authorCherry Zhang <cherryyz@google.com>2017-12-07 22:01:42 -0500
committerCherry Zhang <cherryyz@google.com>2018-02-14 21:41:39 +0000
commitbeeab6ac02754a3fc0272425ebcc0df42f60c868 (patch)
treec35a99ab67b1c567b0239fc9668b5f5fa9e59a10 /test/uintptrescapes2.go
parent91a6a2a30f95da8ae3fb6329a71c49ed13aa12ad (diff)
downloadgo-beeab6ac02754a3fc0272425ebcc0df42f60c868.tar.gz
go-beeab6ac02754a3fc0272425ebcc0df42f60c868.zip
cmd/compile: fix go:uintptrescapes tag for unnamed parameters
The tag was overwritten by the code for special handling unnamed parameters. Fixes #23045. Change-Id: Ie2e1db3e902a07a2bbbc2a3424cea300f0a42cc3 Reviewed-on: https://go-review.googlesource.com/82775 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'test/uintptrescapes2.go')
-rw-r--r--test/uintptrescapes2.go20
1 files changed, 16 insertions, 4 deletions
diff --git a/test/uintptrescapes2.go b/test/uintptrescapes2.go
index 57c21edbce..c94bc148c8 100644
--- a/test/uintptrescapes2.go
+++ b/test/uintptrescapes2.go
@@ -20,12 +20,24 @@ func F1(a uintptr) {} // ERROR "escaping uintptr"
//go:noinline
func F2(a ...uintptr) {} // ERROR "escaping ...uintptr" "a does not escape"
+//go:uintptrescapes
+//go:noinline
+func F3(uintptr) {} // ERROR "escaping uintptr"
+
+//go:uintptrescapes
+//go:noinline
+func F4(...uintptr) {} // ERROR "escaping ...uintptr"
+
func G() {
- var t int // ERROR "moved to heap"
- F1(uintptr(unsafe.Pointer(&t))) // ERROR "live at call to F1: .?autotmp" "&t escapes to heap"
+ var t int // ERROR "moved to heap"
+ F1(uintptr(unsafe.Pointer(&t))) // ERROR "live at call to F1: .?autotmp" "&t escapes to heap"
+ var t2 int // ERROR "moved to heap"
+ F3(uintptr(unsafe.Pointer(&t2))) // ERROR "live at call to F3: .?autotmp" "&t2 escapes to heap"
}
func H() {
- var v int // ERROR "moved to heap"
- F2(0, 1, uintptr(unsafe.Pointer(&v)), 2) // ERROR "live at call to newobject: .?autotmp" "live at call to F2: .?autotmp" "escapes to heap"
+ var v int // ERROR "moved to heap"
+ F2(0, 1, uintptr(unsafe.Pointer(&v)), 2) // ERROR "live at call to newobject: .?autotmp" "live at call to F2: .?autotmp" "escapes to heap"
+ var v2 int // ERROR "moved to heap"
+ F4(0, 1, uintptr(unsafe.Pointer(&v2)), 2) // ERROR "live at call to newobject: .?autotmp" "live at call to F4: .?autotmp" "escapes to heap"
}