1
0
mirror of https://github.com/golang/go synced 2024-11-12 03:40:21 -07:00

bug fix for &x[0] when x is slice

R=ken
OCL=25044
CL=25044
This commit is contained in:
Russ Cox 2009-02-15 13:15:46 -08:00
parent 18ed7e690a
commit 3b3e63735e

View File

@ -3745,10 +3745,13 @@ addrescapes(Node *n)
case ODOT:
case OINDEX:
// ODOTPTR has already been
// introduced, so these are the non-pointer
// ODOT and OINDEX.
addrescapes(n->left);
// ODOTPTR has already been introduced,
// so these are the non-pointer ODOT and OINDEX.
// In &x[0], if x is a slice, then x does not
// escape--the pointer inside x does, but that
// is always a heap pointer anyway.
if(!isslice(n->left->type))
addrescapes(n->left);
break;
}
}