-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
unexpected error in runtime when printing an Array{undef}[]
#42646
Labels
bug
Indicates an unexpected problem or unintended behavior
compiler:inference
Type inference
regression
Regression in behavior compared to a previous version
Comments
Array{undef}[]
Note that the error only occurs when you try to print the created array. julia> Array{undef}[];
julia> Array{undef}[]
Internal error: encountered unexpected error in runtime:
...
julia> n = Array{undef}[]; typeof(n)
Vector{Array{UndefInitializer(), N} where N} (alias for Array{Array{UndefInitializer(), N} where N, 1})
julia> n
Internal error: encountered unexpected error in runtime:
...
julia> versioninfo()
Julia Version 1.8.0-DEV.709
Commit 1389c2fc4a* (2021-10-12 16:34 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-12.0.1 (ORCJIT, skylake)
|
Both of these work fine. julia> n = Array{undef,0}[]
Array{UndefInitializer(), 0}[]
julia> n = Array{undef,1}[]
Vector{UndefInitializer()}[] |
Array{undef}[]
Array{undef}[]
I've reduced it to the following. julia> Base.show_delim_array(stdout, Array{undef}[], '[', ",", ']', false)
Internal error: encountered unexpected error in runtime:
TypeError(func=:UnionAll, context="", expected=Type, got=UndefInitializer())
ijl_type_error_rt at /cygdrive/c/Users/kittisopikulm/source/repos/julia/src\rtut
ils.c:119
ijl_type_error at /cygdrive/c/Users/kittisopikulm/source/repos/julia/src\rtutils
.c:127
ijl_type_unionall at /cygdrive/c/Users/kittisopikulm/source/repos/julia/src\jlty
pes.c:533
UnionAll at .\boot.jl:255
...
[] Full stack trace on Julia Version 1.8.0-DEV.709 Commit 1389c2fjulia> Base.show_delim_array(stdout, Array{undef}[], '[', ",", ']', false)
Internal error: encountered unexpected error in runtime:
TypeError(func=:UnionAll, context="", expected=Type, got=UndefInitializer())
ijl_type_error_rt at /cygdrive/c/Users/kittisopikulm/source/repos/julia/src\rtut
ils.c:119
ijl_type_error at /cygdrive/c/Users/kittisopikulm/source/repos/julia/src\rtutils
.c:127
ijl_type_unionall at /cygdrive/c/Users/kittisopikulm/source/repos/julia/src\jlty
pes.c:533
UnionAll at .\boot.jl:255
rewrap_unionall at .\essentials.jl:270
arrayref_tfunc at .\compiler\tfuncs.jl:1477
jl_apply at /cygdrive/c/Users/kittisopikulm/source/repos/julia/src\julia.h:1782
[inlined]
do_apply at /cygdrive/c/Users/kittisopikulm/source/repos/julia/src\builtins.c:71
3
builtin_tfunction at .\compiler\tfuncs.jl:1648
abstract_call_builtin at .\compiler\abstractinterpretation.jl:1087
abstract_call_known at .\compiler\abstractinterpretation.jl:1254
abstract_call at .\compiler\abstractinterpretation.jl:1386
abstract_call at .\compiler\abstractinterpretation.jl:1371
abstract_eval_statement at .\compiler\abstractinterpretation.jl:1510
typeinf_local at .\compiler\abstractinterpretation.jl:1895
typeinf_nocycle at .\compiler\abstractinterpretation.jl:1991
_typeinf at .\compiler\typeinfer.jl:226
typeinf at .\compiler\typeinfer.jl:209
typeinf_edge at .\compiler\typeinfer.jl:829 [inlined]
abstract_call_method at .\compiler\abstractinterpretation.jl:504
abstract_call_gf_by_type at .\compiler\abstractinterpretation.jl:105
abstract_call_known at .\compiler\abstractinterpretation.jl:1331
abstract_call at .\compiler\abstractinterpretation.jl:1386
abstract_apply at .\compiler\abstractinterpretation.jl:996
abstract_call_known at .\compiler\abstractinterpretation.jl:1248
abstract_call at .\compiler\abstractinterpretation.jl:1386
abstract_call at .\compiler\abstractinterpretation.jl:1371
abstract_eval_statement at .\compiler\abstractinterpretation.jl:1510
typeinf_local at .\compiler\abstractinterpretation.jl:1895
typeinf_nocycle at .\compiler\abstractinterpretation.jl:1991
_typeinf at .\compiler\typeinfer.jl:226
typeinf at .\compiler\typeinfer.jl:209
typeinf_edge at .\compiler\typeinfer.jl:829 [inlined]
abstract_call_method at .\compiler\abstractinterpretation.jl:504
abstract_call_gf_by_type at .\compiler\abstractinterpretation.jl:105
abstract_call_known at .\compiler\abstractinterpretation.jl:1331
abstract_call at .\compiler\abstractinterpretation.jl:1386
abstract_call at .\compiler\abstractinterpretation.jl:1371
abstract_eval_statement at .\compiler\abstractinterpretation.jl:1510
typeinf_local at .\compiler\abstractinterpretation.jl:1895
typeinf_nocycle at .\compiler\abstractinterpretation.jl:1991
_typeinf at .\compiler\typeinfer.jl:226
typeinf at .\compiler\typeinfer.jl:209
typeinf_edge at .\compiler\typeinfer.jl:829 [inlined]
abstract_call_method at .\compiler\abstractinterpretation.jl:504
abstract_call_gf_by_type at .\compiler\abstractinterpretation.jl:105
abstract_call_known at .\compiler\abstractinterpretation.jl:1331
abstract_call at .\compiler\abstractinterpretation.jl:1386
abstract_call at .\compiler\abstractinterpretation.jl:1371
abstract_eval_statement at .\compiler\abstractinterpretation.jl:1510
typeinf_local at .\compiler\abstractinterpretation.jl:1895
typeinf_nocycle at .\compiler\abstractinterpretation.jl:1991
_typeinf at .\compiler\typeinfer.jl:226
typeinf at .\compiler\typeinfer.jl:209
typeinf_edge at .\compiler\typeinfer.jl:829 [inlined]
abstract_call_method at .\compiler\abstractinterpretation.jl:504
abstract_call_gf_by_type at .\compiler\abstractinterpretation.jl:105
abstract_call_known at .\compiler\abstractinterpretation.jl:1331
abstract_call at .\compiler\abstractinterpretation.jl:1386
abstract_call at .\compiler\abstractinterpretation.jl:1371
abstract_eval_statement at .\compiler\abstractinterpretation.jl:1510
typeinf_local at .\compiler\abstractinterpretation.jl:1895
typeinf_nocycle at .\compiler\abstractinterpretation.jl:1991
_typeinf at .\compiler\typeinfer.jl:226
typeinf at .\compiler\typeinfer.jl:209
typeinf_edge at .\compiler\typeinfer.jl:829 [inlined]
abstract_call_method at .\compiler\abstractinterpretation.jl:504
abstract_call_gf_by_type at .\compiler\abstractinterpretation.jl:105
abstract_call_known at .\compiler\abstractinterpretation.jl:1331
abstract_call at .\compiler\abstractinterpretation.jl:1386
abstract_call at .\compiler\abstractinterpretation.jl:1371
abstract_eval_statement at .\compiler\abstractinterpretation.jl:1510
typeinf_local at .\compiler\abstractinterpretation.jl:1895
typeinf_nocycle at .\compiler\abstractinterpretation.jl:1991
_typeinf at .\compiler\typeinfer.jl:226
typeinf at .\compiler\typeinfer.jl:209
typeinf_edge at .\compiler\typeinfer.jl:829 [inlined]
abstract_call_method at .\compiler\abstractinterpretation.jl:504
abstract_call_gf_by_type at .\compiler\abstractinterpretation.jl:105
abstract_call_known at .\compiler\abstractinterpretation.jl:1331
abstract_call at .\compiler\abstractinterpretation.jl:1386
abstract_call at .\compiler\abstractinterpretation.jl:1371
abstract_eval_statement at .\compiler\abstractinterpretation.jl:1510
typeinf_local at .\compiler\abstractinterpretation.jl:1895
typeinf_nocycle at .\compiler\abstractinterpretation.jl:1991
_typeinf at .\compiler\typeinfer.jl:226
typeinf at .\compiler\typeinfer.jl:209
typeinf_edge at .\compiler\typeinfer.jl:829 [inlined]
abstract_call_method at .\compiler\abstractinterpretation.jl:504
abstract_call_gf_by_type at .\compiler\abstractinterpretation.jl:105
abstract_call_known at .\compiler\abstractinterpretation.jl:1331
abstract_call at .\compiler\abstractinterpretation.jl:1386
abstract_call at .\compiler\abstractinterpretation.jl:1371
abstract_eval_statement at .\compiler\abstractinterpretation.jl:1510
typeinf_local at .\compiler\abstractinterpretation.jl:1895
typeinf_nocycle at .\compiler\abstractinterpretation.jl:1991
_typeinf at .\compiler\typeinfer.jl:226
typeinf at .\compiler\typeinfer.jl:209
typeinf_ext at .\compiler\typeinfer.jl:910
typeinf_ext_toplevel at .\compiler\typeinfer.jl:943
typeinf_ext_toplevel at .\compiler\typeinfer.jl:939
jfptr_typeinf_ext_toplevel_14906 at C:\Users\kittisopikulm\source\repos\julia\us
r\lib\julia\sys.dll (unknown line)
_jl_invoke at /cygdrive/c/Users/kittisopikulm/source/repos/julia/src\gf.c:2253 [
inlined]
jfptr_YY.936_44386 at C:\Users\kittisopikulm\source\repos\julia\usr\lib\julia\sys.dll (unknown line)
jl_apply at /cygdrive/c/Users/kittisopikulm/source/repos/julia/src\julia.h:1782 [inlined]
jl_f__call_latest at /cygdrive/c/Users/kittisopikulm/source/repos/julia/src\builtins.c:757
#invokelatest#2 at .\essentials.jl:718 [inlined]
invokelatest at .\essentials.jl:716 [inlined]
run_main_repl at .\client.jl:379
exec_options at .\client.jl:309
_start at .\client.jl:497
jfptr__start_20006 at C:\Users\kittisopikulm\source\repos\julia\usr\lib\julia\sys.dll (unknown line)
jl_apply at /cygdrive/c/Users/kittisopikulm/source/repos/julia/src\julia.h:1782 [inlined]
true_main at /cygdrive/c/Users/kittisopikulm/source/repos/julia/src\jlapi.c:562
jl_repl_entrypoint at /cygdrive/c/Users/kittisopikulm/source/repos/julia/src\jlapi.c:704
mainCRTStartup at /cygdrive/c/Users/kittisopikulm/source/repos/julia/cli\loader_exe.c:59
BaseThreadInitThunk at C:\WINDOWS\System32\KERNEL32.DLL (unknown line)
RtlUserThreadStart at C:\WINDOWS\SYSTEM32\ntdll.dll (unknown line)
[]
julia> versioninfo()
Julia Version 1.8.0-DEV.709
Commit 1389c2fc4a* (2021-10-12 16:34 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-12.0.1 (ORCJIT, skylake) julia> @code_typed Base.show_delim_array(stdout, Array{undef}[], '[', ",", ']', false)
ERROR: TypeError: in UnionAll, expected Type, got a value of type UndefInitializer
Stacktrace:
[1] UnionAll(v::TypeVar, t::Any)
@ Core .\boot.jl:255 Full stack trace using `@code_typed Base.show_delim_array(...)`julia> @code_typed Base.show_delim_array(stdout, Array{undef}[], '[', ",", ']', false)
ERROR: TypeError: in UnionAll, expected Type, got a value of type UndefInitializer
Stacktrace:
[1] UnionAll(v::TypeVar, t::Any)
@ Core .\boot.jl:255
[2] rewrap_unionall(t::Any, u::Any)
@ Core.Compiler .\essentials.jl:270
[3] arrayref_tfunc(::Any, ::Any, ::Any, ::Vararg{Any})
@ Core.Compiler .\compiler\tfuncs.jl:1477
[4] builtin_tfunction(interp::Core.Compiler.AbstractInterpreter, f::Any, argtypes::Vector{Any}, sv::Union{Nothing, Core.Compiler.InferenceState})
@ Core.Compiler .\compiler\tfuncs.jl:1648
[5] abstract_call_builtin(interp::Core.Compiler.NativeInterpreter, f::Core.Builtin, fargs::Vector{Any}, argtypes::Vector{Any}, sv::Core.Compiler.InferenceState, max_methods::Int64)
@ Core.Compiler .\compiler\abstractinterpretation.jl:1087
[6] abstract_call_known(interp::Core.Compiler.NativeInterpreter, f::Any, fargs::Vector{Any}, argtypes::Vector{Any}, sv::Core.Compiler.InferenceState, max_methods::Int64)
@ Core.Compiler .\compiler\abstractinterpretation.jl:1254
[7] abstract_call(interp::Core.Compiler.NativeInterpreter, fargs::Vector{Any}, argtypes::Vector{Any}, sv::Core.Compiler.InferenceState, max_methods::Int64)
@ Core.Compiler .\compiler\abstractinterpretation.jl:1386
[8] abstract_call(interp::Core.Compiler.NativeInterpreter, fargs::Vector{Any}, argtypes::Vector{Any}, sv::Core.Compiler.InferenceState)
@ Core.Compiler .\compiler\abstractinterpretation.jl:1371
[9] abstract_eval_statement(interp::Core.Compiler.NativeInterpreter, e::Any, vtypes::Vector{Core.Compiler.VarState}, sv::Core.Compiler.InferenceState)
@ Core.Compiler .\compiler\abstractinterpretation.jl:1510
[10] typeinf_local(interp::Core.Compiler.NativeInterpreter, frame::Core.Compiler.InferenceState)
@ Core.Compiler .\compiler\abstractinterpretation.jl:1895
[11] typeinf_nocycle(interp::Core.Compiler.NativeInterpreter, frame::Core.Compiler.InferenceState)
@ Core.Compiler .\compiler\abstractinterpretation.jl:1991
[12] _typeinf(interp::Core.Compiler.NativeInterpreter, frame::Core.Compiler.InferenceState)
@ Core.Compiler .\compiler\typeinfer.jl:226
[13] typeinf(interp::Core.Compiler.NativeInterpreter, frame::Core.Compiler.InferenceState)
@ Core.Compiler .\compiler\typeinfer.jl:209
[14] typeinf_edge
@ .\compiler\typeinfer.jl:829 [inlined]
[15] abstract_call_method(interp::Core.Compiler.NativeInterpreter, method::Method, sig::Any, sparams::Core.SimpleVector, hardlimit::Bool, sv::Core.Compiler.InferenceState)
@ Core.Compiler .\compiler\abstractinterpretation.jl:504
[16] abstract_call_gf_by_type(interp::Core.Compiler.NativeInterpreter, f::Any, fargs::Nothing, argtypes::Vector{Any}, atype::Any, sv::Core.Compiler.InferenceState, max_methods::Int64)
@ Core.Compiler .\compiler\abstractinterpretation.jl:105
[17] abstract_call_known(interp::Core.Compiler.NativeInterpreter, f::Any, fargs::Nothing, argtypes::Vector{Any}, sv::Core.Compiler.InferenceState, max_methods::Int64)
@ Core.Compiler .\compiler\abstractinterpretation.jl:1331
[18] abstract_call(interp::Core.Compiler.NativeInterpreter, fargs::Nothing, argtypes::Vector{Any}, sv::Core.Compiler.InferenceState, max_methods::Int64)
@ Core.Compiler .\compiler\abstractinterpretation.jl:1386
[19] abstract_apply(interp::Core.Compiler.NativeInterpreter, argtypes::Vector{Any}, sv::Core.Compiler.InferenceState, max_methods::Int64)
@ Core.Compiler .\compiler\abstractinterpretation.jl:996
[20] abstract_call_known(interp::Core.Compiler.NativeInterpreter, f::Any, fargs::Vector{Any}, argtypes::Vector{Any}, sv::Core.Compiler.InferenceState, max_methods::Int64)
@ Core.Compiler .\compiler\abstractinterpretation.jl:1248
[21] abstract_call(interp::Core.Compiler.NativeInterpreter, fargs::Vector{Any}, argtypes::Vector{Any}, sv::Core.Compiler.InferenceState, max_methods::Int64)
@ Core.Compiler .\compiler\abstractinterpretation.jl:1386
[22] abstract_call(interp::Core.Compiler.NativeInterpreter, fargs::Vector{Any}, argtypes::Vector{Any}, sv::Core.Compiler.InferenceState)
@ Core.Compiler .\compiler\abstractinterpretation.jl:1371
[23] abstract_eval_statement(interp::Core.Compiler.NativeInterpreter, e::Any, vtypes::Vector{Core.Compiler.VarState}, sv::Core.Compiler.InferenceState)
@ Core.Compiler .\compiler\abstractinterpretation.jl:1510
[24] typeinf_local(interp::Core.Compiler.NativeInterpreter, frame::Core.Compiler.InferenceState)
@ Core.Compiler .\compiler\abstractinterpretation.jl:1895
[25] typeinf_nocycle(interp::Core.Compiler.NativeInterpreter, frame::Core.Compiler.InferenceState)
@ Core.Compiler .\compiler\abstractinterpretation.jl:1991
[26] _typeinf(interp::Core.Compiler.NativeInterpreter, frame::Core.Compiler.InferenceState)
@ Core.Compiler .\compiler\typeinfer.jl:226
[27] typeinf(interp::Core.Compiler.NativeInterpreter, frame::Core.Compiler.InferenceState)
@ Core.Compiler .\compiler\typeinfer.jl:209
[28] typeinf_edge
@ .\compiler\typeinfer.jl:829 [inlined]
[29] abstract_call_method(interp::Core.Compiler.NativeInterpreter, method::Method, sig::Any, sparams::Core.SimpleVector, hardlimit::Bool, sv::Core.Compiler.InferenceState)
@ Core.Compiler .\compiler\abstractinterpretation.jl:504
[30] abstract_call_gf_by_type(interp::Core.Compiler.NativeInterpreter, f::Any, fargs::Vector{Any}, argtypes::Vector{Any}, atype::Any, sv::Core.Compiler.InferenceState, max_methods::Int64)
@ Core.Compiler .\compiler\abstractinterpretation.jl:105
[31] abstract_call_known(interp::Core.Compiler.NativeInterpreter, f::Any, fargs::Vector{Any}, argtypes::Vector{Any}, sv::Core.Compiler.InferenceState, max_methods::Int64)
@ Core.Compiler .\compiler\abstractinterpretation.jl:1331
--- the last 11 lines are repeated 5 more times ---
[87] abstract_call(interp::Core.Compiler.NativeInterpreter, fargs::Vector{Any}, argtypes::Vector{Any}, sv::Core.Compiler.InferenceState, max_methods::Int64)
@ Core.Compiler .\compiler\abstractinterpretation.jl:1386
[88] abstract_call(interp::Core.Compiler.NativeInterpreter, fargs::Vector{Any}, argtypes::Vector{Any}, sv::Core.Compiler.InferenceState)
@ Core.Compiler .\compiler\abstractinterpretation.jl:1371
[89] abstract_eval_statement(interp::Core.Compiler.NativeInterpreter, e::Any, vtypes::Vector{Core.Compiler.VarState}, sv::Core.Compiler.InferenceState)
@ Core.Compiler .\compiler\abstractinterpretation.jl:1510
[90] typeinf_local(interp::Core.Compiler.NativeInterpreter, frame::Core.Compiler.InferenceState)
@ Core.Compiler .\compiler\abstractinterpretation.jl:1895
[91] typeinf_nocycle(interp::Core.Compiler.NativeInterpreter, frame::Core.Compiler.InferenceState)
@ Core.Compiler .\compiler\abstractinterpretation.jl:1991
[92] _typeinf(interp::Core.Compiler.NativeInterpreter, frame::Core.Compiler.InferenceState)
@ Core.Compiler .\compiler\typeinfer.jl:226
[93] typeinf(interp::Core.Compiler.NativeInterpreter, frame::Core.Compiler.InferenceState)
@ Core.Compiler .\compiler\typeinfer.jl:209
[94] typeinf_code(interp::Core.Compiler.NativeInterpreter, method::Method, atypes::Any, sparams::Core.SimpleVector, run_optimizer::Bool)
@ Core.Compiler .\compiler\typeinfer.jl:851
[95] code_typed_by_type(tt::Type; optimize::Bool, debuginfo::Symbol, world::UInt64, interp::Core.Compiler.NativeInterpreter)
@ Base .\reflection.jl:1213
[96] code_typed(f::Any, types::Any; optimize::Bool, debuginfo::Symbol, world::UInt64, interp::Core.Compiler.NativeInterpreter)
@ Base .\reflection.jl:1181
[97] code_typed(f::Any, types::Any)
@ Base .\reflection.jl:1168
julia> versioninfo()
Julia Version 1.8.0-DEV.709
Commit 1389c2fc4a* (2021-10-12 16:34 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-12.0.1 (ORCJIT, skylake)
|
Further reduced: function foo(A)
m = Core.arrayref(0, A, 1)
foo(m)
end
foo(Array{undef}[]) |
vtjnash
added a commit
that referenced
this issue
Oct 18, 2021
Prevent occurrence of v or Type{v} in the type-lattice, where v is not a Type (or TypeVar). Fixes #42646, and similar problems from code-reading.
vtjnash
added a commit
that referenced
this issue
Oct 25, 2021
Prevent occurrence of v or Type{v} in the type-lattice, where v is not a Type (or TypeVar). Fixes #42646, and similar problems from code-reading.
LilithHafner
pushed a commit
to LilithHafner/julia
that referenced
this issue
Feb 22, 2022
Prevent occurrence of v or Type{v} in the type-lattice, where v is not a Type (or TypeVar). Fixes JuliaLang#42646, and similar problems from code-reading.
LilithHafner
pushed a commit
to LilithHafner/julia
that referenced
this issue
Mar 8, 2022
Prevent occurrence of v or Type{v} in the type-lattice, where v is not a Type (or TypeVar). Fixes JuliaLang#42646, and similar problems from code-reading.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
Indicates an unexpected problem or unintended behavior
compiler:inference
Type inference
regression
Regression in behavior compared to a previous version
Happens on 1.8-f8d3bd22f6 (29 days old master, and likely latest), 1.7-rc1, 1.6 and 1.5.0:
It's a regression against 1.4.0 where it works:
The text was updated successfully, but these errors were encountered: