cmd/compile: mark negative size memclr non-inlineable

Fixes #59174

Change-Id: I72b2b068830b90d42a0186addd004fb3175b9126
Reviewed-on: https://go-review.googlesource.com/c/go/+/478375
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Jakub Ciolek <jakub@ciolek.dev>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Cuong Manh Le 2023-03-22 17:45:07 +07:00 committed by Gopher Robot
parent efaca3170f
commit 07559ceb72
2 changed files with 15 additions and 0 deletions

View File

@ -1370,6 +1370,9 @@ func zeroUpper56Bits(x *Value, depth int) bool {
}
func isInlinableMemclr(c *Config, sz int64) bool {
if sz < 0 {
return false
}
// TODO: expand this check to allow other architectures
// see CL 454255 and issue 56997
switch c.arch {

View File

@ -0,0 +1,12 @@
// 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 p() {
s := make([]int, copy([]byte{' '}, "")-1)
_ = append([]int{}, make([]int, len(s))...)
}