Skip to content

Commit da81858

Browse files
KristofferCtkelman
authored andcommitted
check that reinterp on vector of tuples doesnt segfault
(cherry picked from commit 53ea47e) ref #22066
1 parent 8520a55 commit da81858

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/inference.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,18 @@ function break_21369()
778778
end
779779
@test_throws ErrorException break_21369() # not TypeError
780780

781+
# issue #20847
782+
function segfaultfunction_20847{N, T}(A::Vector{NTuple{N, T}})
783+
B = reinterpret(T, A, (N, length(A)))
784+
return nothing
785+
end
786+
787+
tuplevec_20847 = Tuple{Float64, Float64}[(0.0,0.0), (1.0,0.0)]
788+
789+
for A in (1,)
790+
@test segfaultfunction_20847(tuplevec_20847) == nothing
791+
end
792+
781793
# issue #21848
782794
@test Core.Inference.limit_type_depth(Ref{Complex{T} where T}, Core.Inference.MAX_TYPE_DEPTH) == Ref
783795
let T = Tuple{Tuple{Int64, Void},

0 commit comments

Comments
 (0)