mirror of
https://github.com/golang/go
synced 2024-09-05 16:04:50 +00:00
![Cuong Manh Le](/assets/img/avatar_default.png)
CL 497276 added optimization for len(string([]byte)) by avoiding call to slicebytetostring. However, the bytes to string expression may contain init nodes, which need to be preserved. Otherwise, it would make the liveness analysis confusing about the lifetime of temporary variables created by init nodes. Fixes #61778 Change-Id: I6d1280a7d61bcc75f11132af41bda086f084ab54 Reviewed-on: https://go-review.googlesource.com/c/go/+/516375 Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
14 lines
250 B
Go
14 lines
250 B
Go
// compile
|
|
|
|
// Copyright 2023 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package p
|
|
|
|
func f(s []byte) {
|
|
switch "" {
|
|
case string(append(s, 'a')):
|
|
}
|
|
}
|