1
0
mirror of https://github.com/golang/go synced 2024-11-21 18:24:46 -07:00

gc: final ...T bug for the day

R=ken2
CC=golang-dev
https://golang.org/cl/199046
This commit is contained in:
Russ Cox 2010-02-01 16:22:16 -08:00
parent f7e2266ce6
commit 45515011cc
4 changed files with 4 additions and 5 deletions

View File

@ -411,6 +411,8 @@ cgen_dcl(Node *n)
}
if(!(n->class & PHEAP))
return;
if(n->alloc == nil)
n->alloc = callnew(n->type);
cgen_as(n->heapaddr, n->alloc);
}

View File

@ -1907,7 +1907,6 @@ addrescapes(Node *n)
n->class |= PHEAP;
n->addable = 0;
n->ullman = 2;
n->alloc = callnew(n->type);
n->xoffset = 0;
// create stack variable to hold pointer to heap

View File

@ -2182,6 +2182,8 @@ paramstoheap(Type **argin)
continue;
// generate allocation & copying code
if(v->alloc == nil)
v->alloc = callnew(v->type);
nn = list(nn, nod(OAS, v->heapaddr, v->alloc));
nn = list(nn, nod(OAS, v, v->stackparam));
}

View File

@ -18,13 +18,11 @@ func sumC(args ...int) int {
return func() int { return sum(args) } ()
}
/* TODO(rsc)
var sumD = func(args ...int) int { return sum(args) }
var sumE = func() func(...int) int { return func(args ...int) int { return sum(args) } } ()
var sumF = func(args ...int) func() int { return func() int { return sum(args) } }
*/
func sumA(args []int) int {
s := 0
@ -76,7 +74,6 @@ func main() {
if x := sumC(4, 5, 6); x != 15 {
panicln("sumC 15", x)
}
/* TODO(rsc)
if x := sumD(4, 5, 7); x != 16 {
panicln("sumD 16", x)
}
@ -86,7 +83,6 @@ func main() {
if x := sumF(4, 5, 9)(); x != 18 {
panicln("sumF 18", x)
}
*/
if x := sum2(1, 2, 3); x != 2*6 {
panicln("sum 6", x)
}