From 644b9d96cdf648c55c67f00e68024a24be39bc05 Mon Sep 17 00:00:00 2001 From: Cheng Gong Date: Thu, 26 Oct 2023 19:26:34 -0500 Subject: [PATCH] Fix make_zero on undef arrays (#1112) --- src/compiler.jl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/compiler.jl b/src/compiler.jl index 3c7961a12f..c4ab585680 100644 --- a/src/compiler.jl +++ b/src/compiler.jl @@ -2108,8 +2108,10 @@ end newa = RT(undef, size(prev)) seen[prev] = newa for I in eachindex(prev) - pv = prev[I] - @inbounds newa[I] = make_zero(Core.Typeof(pv), seen, pv, Val(copy_if_inactive)) + if isassigned(prev, I) + pv = prev[I] + @inbounds newa[I] = make_zero(Core.Typeof(pv), seen, pv, Val(copy_if_inactive)) + end end return newa end