1
0
mirror of https://github.com/golang/go synced 2024-11-26 06:27:58 -07:00

cmd/compile: fix wrong type in SSA generation for OSLICE2ARRPTR

Fixes #46907

Change-Id: I6a2728d2f2159df583b32f40f6100d3e90c34dd7
Reviewed-on: https://go-review.googlesource.com/c/go/+/330672
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
This commit is contained in:
Cuong Manh Le 2021-06-25 01:45:32 +07:00
parent 600a2a4ffb
commit cce621431a
2 changed files with 12 additions and 1 deletions

View File

@ -3174,7 +3174,7 @@ func (s *state) expr(n ir.Node) *ssa.Value {
arrlen := s.constInt(types.Types[types.TINT], n.Type().Elem().NumElem())
cap := s.newValue1(ssa.OpSliceLen, types.Types[types.TINT], v)
s.boundsCheck(arrlen, cap, ssa.BoundsConvert, false)
return s.newValue1(ssa.OpSlicePtrUnchecked, types.Types[types.TINT], v)
return s.newValue1(ssa.OpSlicePtrUnchecked, n.Type(), v)
case ir.OCALLFUNC:
n := n.(*ir.CallExpr)

View File

@ -0,0 +1,11 @@
// compile
// Copyright 2021 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(b []byte) []byte {
return (*[32]byte)(b[:32])[:]
}