aboutsummaryrefslogtreecommitdiff
path: root/test/escape4.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2012-03-05 13:51:44 -0500
committerRuss Cox <rsc@golang.org>2012-03-05 13:51:44 -0500
commitcae604f734ac4e444a36bc3dc18afa42c6f4c737 (patch)
treee2bff6e9caedf1976ea0e2e20c759511427f6e1b /test/escape4.go
parent5ab9d2befd7c37468121081a84188aa687678e13 (diff)
downloadgo-cae604f734ac4e444a36bc3dc18afa42c6f4c737.tar.gz
go-cae604f734ac4e444a36bc3dc18afa42c6f4c737.zip
cmd/gc: must not inline panic, recover
R=lvd, gri CC=golang-dev https://golang.org/cl/5731061
Diffstat (limited to 'test/escape4.go')
-rw-r--r--test/escape4.go20
1 files changed, 13 insertions, 7 deletions
diff --git a/test/escape4.go b/test/escape4.go
index ab3aee2244..8875708963 100644
--- a/test/escape4.go
+++ b/test/escape4.go
@@ -11,8 +11,8 @@ package foo
var p *int
-func alloc(x int) *int { // ERROR "can inline alloc" "moved to heap: x"
- return &x // ERROR "&x escapes to heap"
+func alloc(x int) *int { // ERROR "can inline alloc" "moved to heap: x"
+ return &x // ERROR "&x escapes to heap"
}
var f func()
@@ -22,12 +22,18 @@ func f1() {
// Escape analysis used to miss inlined code in closures.
- func() { // ERROR "func literal does not escape"
- p = alloc(3) // ERROR "inlining call to alloc" "&x escapes to heap" "moved to heap: x"
+ func() { // ERROR "func literal does not escape"
+ p = alloc(3) // ERROR "inlining call to alloc" "&x escapes to heap" "moved to heap: x"
}()
-
- f = func() { // ERROR "func literal escapes to heap"
- p = alloc(3) // ERROR "inlining call to alloc" "&x escapes to heap" "moved to heap: x"
+
+ f = func() { // ERROR "func literal escapes to heap"
+ p = alloc(3) // ERROR "inlining call to alloc" "&x escapes to heap" "moved to heap: x"
}
f()
}
+
+func f2() {} // ERROR "can inline f2"
+
+// No inline for panic, recover.
+func f3() { panic(1) }
+func f4() { recover() }