Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core._apply segfaults on svec(#undef) #46784

Closed
vtjnash opened this issue Sep 15, 2022 · 0 comments · Fixed by #46975
Closed

Core._apply segfaults on svec(#undef) #46784

vtjnash opened this issue Sep 15, 2022 · 0 comments · Fixed by #46975

Comments

@vtjnash
Copy link
Member

vtjnash commented Sep 15, 2022

Is svec(#undef) supposed to be visible in Julia? Right now we have a case where typeintersect might fail to fill in type-parameters, leading to a segfault when we splat the result into an apply_type call:

julia> const RO38{B<:Val, M<:AbstractMatrix} =
           Tuple{
           <:Union{B, <:Val{<:B}},
           M,
           Union{AbstractMatrix{B}, AbstractMatrix{<:Vector{<:B}}}}
Tuple{var"#s1", M, Union{AbstractMatrix{B}, AbstractMatrix{<:Vector{<:B}}}} where {B<:Val, M<:(AbstractMatrix), var"#s1"<:(Union{B, var"#s2"} where var"#s2"<:(Val{<:B}))}

julia> typeintersect(RO38{T,S} where {T,S}, RO38)
Tuple{Union{var"#s1", var"#s11"}, 
[3247358] signal (11): Segmentation fault
in expression starting at none:0
ijl_isa at /data/vtjnash/julia/src/subtype.c:2075
sig_match_simple at /data/vtjnash/julia/src/typemap.c:239 [inlined]
...
Segmentation fault

with additional MWEs:

julia> T = ccall(:jl_new_structv, Any, (Any, Ptr{Cvoid}, UInt32), Union, [S, S], 2) where S<:AbstractMatrix;

julia> (ti, env) = ccall(:jl_type_intersection_with_env, Any, (Any, Any), T, AbstractMatrix); env
svec(#undef)

julia> identity(env...)
Segmentation fault

Originally posted by @vtjnash in #46735 (comment)

vtjnash added a commit that referenced this issue Sep 29, 2022
This was not supported, and almost never used, so audit all places it could happen and avoid it at the source.

Fix #46784
vtjnash added a commit that referenced this issue Sep 29, 2022
This was not supported, and almost never used, so audit all places it
could happen and avoid it at the source.

Fix #46784
vtjnash added a commit that referenced this issue Sep 29, 2022
This was not supported, and almost never used, so audit all places it
could happen and avoid it at the source.

Fix #46784
N5N3 added a commit to N5N3/julia that referenced this issue Sep 29, 2022
DilumAluthge pushed a commit to N5N3/julia that referenced this issue Oct 1, 2022
N5N3 added a commit to N5N3/julia that referenced this issue Oct 2, 2022
@vtjnash vtjnash closed this as completed in 33afb81 Oct 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant