compiler: fix make([]T, ...) with big integers on 32-bit systems or less

Previously, this would have resulted in a LLVM verification error
because runtime.sliceBoundsCheckMake would not accept 64-bit integers on
these platforms.
This commit is contained in:
Ayke van Laethem
2019-01-10 14:09:04 +01:00
committed by Ron Evans
parent 28987ae061
commit 8e99c3313b
2 changed files with 24 additions and 7 deletions
+7
View File
@@ -62,3 +62,10 @@ func sliceBoundsCheckMake(length, capacity uint) {
runtimePanic("slice size out of range")
}
}
// Check for bounds in *ssa.MakeSlice. Supports 64-bit indexes.
func sliceBoundsCheckMake64(length, capacity uint64) {
if !(0 <= length && length <= capacity) {
runtimePanic("slice size out of range")
}
}