From: Russ Cox Date: Sun, 15 Feb 2009 21:15:46 +0000 (-0800) Subject: bug fix for &x[0] when x is slice X-Git-Tag: weekly.2009-11-06~2176 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=3b3e63735eb8a00b7cabbbe223a116148a0635dd;p=gostls13.git bug fix for &x[0] when x is slice R=ken OCL=25044 CL=25044 --- diff --git a/src/cmd/gc/walk.c b/src/cmd/gc/walk.c index 1d20633487..f3a3bd6e55 100644 --- a/src/cmd/gc/walk.c +++ b/src/cmd/gc/walk.c @@ -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; } }