go version go1.19.5 linux/amd64
go version devel go1.20-76d39ae349 Tue Jan 10 20:34:22 2023 +0000 linux/amd64
package p
import "os"
func f() {
os.Stdout.Write([]byte{'h', 'e', 'l', 'l', 'o'})
}
Linux:
$ GOOS=linux gotip build -gcflags=-m test.go
./test.go:5:6: can inline f
./test.go:6:24: []byte{...} does not escape <<<<
Windows:
$ GOOS=windows gotip build -gcflags=-m test.go
./test.go:5:6: can inline f
./test.go:6:24: []byte{...} escapes to heap <<<<
Read is also affected.
Reproducible on tip and 1.19.5.
Related to #41474
Linux:
Windows:
Readis also affected.Reproducible on tip and 1.19.5.
Related to #41474