cmd/compile: copy causes escape #15730
Labels
early-in-cycle
A change that should be done early in the 3 month dev cycle.
FrozenDueToAge
NeedsFix
The path to resolution is known, but the work has not been done.
Performance
Milestone
go version
)?go version devel +0a9595f Tue May 17 18:46:03 2016 -0400 linux/amd64
go env
)?GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/austin/r/go"
GORACE=""
GOROOT="/home/austin/go.dev"
GOTOOLDIR="/home/austin/go.dev/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build366275436=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
I expected "abc" in
main
to not escape and the conversion tointerface{}
to not allocate.If I use
copy
intest
, escape analysis determines that arg's content escapes, which causes the args slice to escape, which causes theconvT2E
inmain
to allocate. However, if I do the copy "manually" by looping over the string, args does not escape, and theconvT2E
happens on the stack./cc @dr2chase @randall77
The text was updated successfully, but these errors were encountered: