compiler: add *ssa.MakeSlice bounds tests

There are some bugs in it. This commit adds the tests, so that the next
commit can show what changed.
This commit is contained in:
Ayke van Laethem
2021-08-15 02:03:45 +02:00
committed by Ron Evans
parent 59d53182bb
commit a2cc5715ba
2 changed files with 94 additions and 0 deletions
+18
View File
@@ -23,3 +23,21 @@ func sliceAppendSlice(ints, added []int) []int {
func sliceCopy(dst, src []int) int {
return copy(dst, src)
}
// Test bounds checking in *ssa.MakeSlice instruction.
func makeByteSlice(len int) []byte {
return make([]byte, len)
}
func makeInt16Slice(len int) []int16 {
return make([]int16, len)
}
func makeArraySlice(len int) [][3]byte {
return make([][3]byte, len) // slice with element size of 3
}
func makeInt32Slice(len int) []int32 {
return make([]int32, len)
}