summaryrefslogtreecommitdiff
path: root/test/escape2.go
diff options
context:
space:
mode:
authorLuuk van Dijk <lvd@golang.org>2011-12-15 17:35:59 +0100
committerLuuk van Dijk <lvd@golang.org>2011-12-15 17:35:59 +0100
commitcda9c0963b1bf5b4bd7ef9a039609d0aaf7da76f (patch)
tree824bc3e953ad5ce897279303c88f27db7c83b674 /test/escape2.go
parentc36f275f78046b686a9d53676e362065330e252c (diff)
downloadgo-cda9c0963b1bf5b4bd7ef9a039609d0aaf7da76f.tar.gz
gc: better loopdepth analysis for labels
This avoids degraded performance caused by extra labels emitted by inlining (breaking strconv ftoa alloc count unittest) and is better in any case. R=rsc CC=golang-dev http://codereview.appspot.com/5483071
Diffstat (limited to 'test/escape2.go')
-rw-r--r--test/escape2.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/escape2.go b/test/escape2.go
index 13ebe271d..e4d5084c7 100644
--- a/test/escape2.go
+++ b/test/escape2.go
@@ -1011,3 +1011,24 @@ func foo121b() {
go fmt.Printf("%d", i) // ERROR "[.][.][.] argument escapes to heap"
}
}
+
+// a harmless forward jump
+func foo122() {
+ var i *int
+
+ goto L1
+L1:
+ i = new(int) // ERROR "does not escape"
+ _ = i
+}
+
+// a backward jump, increases loopdepth
+func foo123() {
+ var i *int
+
+L1:
+ i = new(int) // ERROR "escapes"
+
+ goto L1
+ _ = i
+} \ No newline at end of file