From f159429152e90c7c821b96a05e18eef8b1213401 Mon Sep 17 00:00:00 2001 From: Nia Weiss Date: Fri, 15 Jan 2021 15:03:05 -0500 Subject: [PATCH] compiler: emit a nil check when slicing an array pointer --- compiler/compiler.go | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler/compiler.go b/compiler/compiler.go index d6c5736c..c5b7be65 100644 --- a/compiler/compiler.go +++ b/compiler/compiler.go @@ -1852,6 +1852,7 @@ func (b *builder) createExpr(expr ssa.Value) (llvm.Value, error) { low, } + b.createNilCheck(expr.X, value, "slice") b.createSliceBoundsCheck(llvmLen, low, high, max, lowType, highType, maxType) // Truncate ints bigger than uintptr. This is after the bounds