Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(85)

Unified Diff: test/escape2.go

Issue 6061043: code review 6061043: cmd/gc: fix addresses escaping through closures called ... (Closed)
Patch Set: diff -r 316890203045 https://go.googlecode.com/hg/ Created 14 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/cmd/gc/esc.c ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/escape2.go
===================================================================
--- a/test/escape2.go
+++ b/test/escape2.go
@@ -1065,3 +1065,34 @@
goto L1
_ = i
}
+
+func foo124(x **int) { // ERROR "does not escape"
rsc 2012/04/23 19:42:29 Please put the variable names in these patterns, l
+ var i int // ERROR "moved to heap"
+ p := &i // ERROR "&i escapes"
+ func() { // ERROR "does not escape"
+ *x = p // ERROR "leaking closure reference"
+ }()
+}
+
+func foo125(ch chan *int) { // ERROR "does not escape"
rsc 2012/04/23 19:42:29 Please make a foo125a variant with defer func inst
+ var i int // ERROR "moved to heap"
+ p := &i // ERROR "&i escapes"
+ func() { // ERROR "does not escape"
+ ch <- p // ERROR "leaking closure reference"
+ }()
+}
+
+func foo126() {
+ var px *int // loopdepth 0
+ for {
+ // loopdepth 1
+ var i int // ERROR "moved to heap"
+ // px = &i // would escape i-> should move to heap, as should the one below
rsc 2012/04/23 19:42:29 Confusing. Delete.
+ func() { // ERROR "func literal does not escape"
+ px = &i // ERROR "&i escapes"
+ }()
+ }
+
+}
+
+
« no previous file with comments | « src/cmd/gc/esc.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b