compiler: fix MakeSlice bounds check and casting

This commit is contained in:
Ayke van Laethem
2019-04-05 16:55:34 +02:00
committed by Ron Evans
parent 3a76a49ddf
commit 6a2a587dff
3 changed files with 15 additions and 48 deletions
-14
View File
@@ -49,17 +49,3 @@ func lookuppanic() {
func slicepanic() {
runtimePanic("slice out of range")
}
// Check for bounds in *ssa.MakeSlice.
func sliceBoundsCheckMake(length, capacity uintptr, max uintptr) {
if length > capacity || capacity > max {
runtimePanic("slice size out of range")
}
}
// Check for bounds in *ssa.MakeSlice. Supports 64-bit indexes.
func sliceBoundsCheckMake64(length, capacity uint64, max uintptr) {
if length > capacity || capacity > uint64(max) {
runtimePanic("slice size out of range")
}
}