mirror of
https://github.com/golang/go
synced 2024-11-21 16:54:46 -07:00
gc: test + fix escape analysis bug
R=lvd CC=golang-dev https://golang.org/cl/5333049
This commit is contained in:
parent
1fe22d2d24
commit
b4df33a6ea
@ -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"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user