Commit b4df33a6 authored by Russ Cox's avatar Russ Cox

gc: test + fix escape analysis bug

R=lvd
CC=golang-dev
https://golang.org/cl/5333049
parent 1fe22d2d
......@@ -239,6 +239,7 @@ esc(Node *n)
case OPROC:
// go f(x) - f and x escape
escassign(&theSink, n->left->left);
escassign(&theSink, n->left->right); // ODDDARG for call
for(ll=n->left->list; ll; ll=ll->next)
escassign(&theSink, ll->n);
break;
......
......@@ -6,7 +6,10 @@
package foo
import "unsafe"
import (
"fmt"
"unsafe"
)
var gxx *int
......@@ -993,3 +996,18 @@ L100:
goto L99
goto L100
}
func foo121() {
for i := 0; i < 10; i++ {
defer myprint(nil, i) // ERROR "[.][.][.] argument escapes to heap"
go myprint(nil, i) // ERROR "[.][.][.] argument escapes to heap"
}
}
// same as foo121 but check across import
func foo121b() {
for i := 0; i < 10; i++ {
defer fmt.Printf("%d", i) // ERROR "[.][.][.] argument escapes to heap"
go fmt.Printf("%d", i) // ERROR "[.][.][.] argument escapes to heap"
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment