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