createSliceToArrayPointerCheck adds a check for slice-to-array pointer conversions. This conversion was added in Go 1.17. For details, see: https://tip.golang.org/ref/spec#Conversions_from_slice_to_array_pointer
(sliceLen llvm.Value, arrayLen int64)
| 81 | // conversions. This conversion was added in Go 1.17. For details, see: |
| 82 | // https://tip.golang.org/ref/spec#Conversions_from_slice_to_array_pointer |
| 83 | func (b *builder) createSliceToArrayPointerCheck(sliceLen llvm.Value, arrayLen int64) { |
| 84 | // From the spec: |
| 85 | // > If the length of the slice is less than the length of the array, a |
| 86 | // > run-time panic occurs. |
| 87 | arrayLenValue := llvm.ConstInt(b.uintptrType, uint64(arrayLen), false) |
| 88 | isLess := b.CreateICmp(llvm.IntULT, sliceLen, arrayLenValue, "") |
| 89 | b.createRuntimeAssert(isLess, "slicetoarray", "sliceToArrayPointerPanic") |
| 90 | } |
| 91 | |
| 92 | // createUnsafeSliceStringCheck inserts a runtime check used for unsafe.Slice |
| 93 | // and unsafe.String. This function must panic if the ptr/len parameters are |
no test coverage detected