Skip to content

type inference stackoverflow #43050

Closed
Closed

Description

An inference stackoverflow encountered rather deep in some code, so it's hard to provide a minimal example (I can post the full code if necessary, but it's really quite large). This same code errors on 1.6.x, but luckily keeps running on v1.7.0 rc2. There are a number of similar issues, but I didn't find the exact same one.

versioninfo

julia> versioninfo()
Julia Version 1.7.0-rc2
Commit f23fc0d27a (2021-10-20 12:45 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, skylake)
Environment:
  JULIA_NUM_THREADS = 2

stacktrace

Internal error: encountered unexpected error in runtime:
StackOverflowError()
intersect_aside at /home/maarten/julia/src/subtype.c:2131
intersect_var at /home/maarten/julia/src/subtype.c:2284
intersect at /home/maarten/julia/src/subtype.c:3057
intersect_all at /home/maarten/julia/src/subtype.c:3175
intersect_aside at /home/maarten/julia/src/subtype.c:2131
intersect_var at /home/maarten/julia/src/subtype.c:2334
intersect at /home/maarten/julia/src/subtype.c:3057
intersect_all at /home/maarten/julia/src/subtype.c:3175
intersect_aside at /home/maarten/julia/src/subtype.c:2131
intersect_var at /home/maarten/julia/src/subtype.c:2284
intersect at /home/maarten/julia/src/subtype.c:3057
intersect_all at /home/maarten/julia/src/subtype.c:3175
intersect_aside at /home/maarten/julia/src/subtype.c:2131
intersect_var at /home/maarten/julia/src/subtype.c:2334
intersect at /home/maarten/julia/src/subtype.c:3057
intersect_all at /home/maarten/julia/src/subtype.c:3175
intersect_aside at /home/maarten/julia/src/subtype.c:2131
intersect_var at /home/maarten/julia/src/subtype.c:2284
intersect at /home/maarten/julia/src/subtype.c:3057
intersect_all at /home/maarten/julia/src/subtype.c:3175
intersect_aside at /home/maarten/julia/src/subtype.c:2131
intersect_var at /home/maarten/julia/src/subtype.c:2334
intersect at /home/maarten/julia/src/subtype.c:3057
intersect_all at /home/maarten/julia/src/subtype.c:3175
intersect_aside at /home/maarten/julia/src/subtype.c:2131
intersect_var at /home/maarten/julia/src/subtype.c:2284
intersect at /home/maarten/julia/src/subtype.c:3057
...
intersect_all at /home/maarten/julia/src/subtype.c:3175
intersect_aside at /home/maarten/julia/src/subtype.c:2131
intersect_var at /home/maarten/julia/src/subtype.c:2284
intersect at /home/maarten/julia/src/subtype.c:3057
intersect_all at /home/maarten/julia/src/subtype.c:3175
intersect_aside at /home/maarten/julia/src/subtype.c:2131
intersect_var at /home/maarten/julia/src/subtype.c:2334
intersect at /home/maarten/julia/src/subtype.c:3057
intersect_all at /home/maarten/julia/src/subtype.c:3175
intersect_aside at /home/maarten/julia/src/subtype.c:2131
intersect_var at /home/maarten/julia/src/subtype.c:2334
intersect at /home/maarten/julia/src/subtype.c:3057
intersect_union at /home/maarten/julia/src/subtype.c:2154
intersect at /home/maarten/julia/src/subtype.c:3073
intersect_unionall_ at /home/maarten/julia/src/subtype.c:2578
intersect_unionall at /home/maarten/julia/src/subtype.c:2623
intersect at /home/maarten/julia/src/subtype.c:3106
intersect_all at /home/maarten/julia/src/subtype.c:3175
intersect_aside at /home/maarten/julia/src/subtype.c:2131
var_lt at /home/maarten/julia/src/subtype.c:623
subtype at /home/maarten/julia/src/subtype.c:1231
forall_exists_equal at /home/maarten/julia/src/subtype.c:1383
subtype at /home/maarten/julia/src/subtype.c:1306
subtype_unionall at /home/maarten/julia/src/subtype.c:807
subtype at /home/maarten/julia/src/subtype.c:1257
subtype_unionall at /home/maarten/julia/src/subtype.c:807
subtype at /home/maarten/julia/src/subtype.c:1257
exists_subtype at /home/maarten/julia/src/subtype.c:1395 [inlined]
forall_exists_subtype at /home/maarten/julia/src/subtype.c:1423
subtype_ccheck at /home/maarten/julia/src/subtype.c:555
var_lt at /home/maarten/julia/src/subtype.c:618
subtype at /home/maarten/julia/src/subtype.c:1231
exists_subtype at /home/maarten/julia/src/subtype.c:1395 [inlined]
forall_exists_subtype at /home/maarten/julia/src/subtype.c:1423
subtype_in_env_ at /home/maarten/julia/src/subtype.c:1899
subtype_bounds_in_env at /home/maarten/julia/src/subtype.c:1909 [inlined]
subtype_in_env_existential at /home/maarten/julia/src/subtype.c:2241
intersect_invariant at /home/maarten/julia/src/subtype.c:2889
intersect at /home/maarten/julia/src/subtype.c:3130
intersect_tuple at /home/maarten/julia/src/subtype.c:2770 [inlined]
intersect at /home/maarten/julia/src/subtype.c:3124
intersect_unionall_ at /home/maarten/julia/src/subtype.c:2574
intersect_unionall at /home/maarten/julia/src/subtype.c:2623
intersect at /home/maarten/julia/src/subtype.c:3109
intersect_unionall_ at /home/maarten/julia/src/subtype.c:2574
intersect_unionall at /home/maarten/julia/src/subtype.c:2623
intersect at /home/maarten/julia/src/subtype.c:3109
intersect_unionall_ at /home/maarten/julia/src/subtype.c:2578
intersect_unionall at /home/maarten/julia/src/subtype.c:2623
intersect at /home/maarten/julia/src/subtype.c:3083
intersect_all at /home/maarten/julia/src/subtype.c:3175
jl_type_intersection_env_s at /home/maarten/julia/src/subtype.c:3417
jl_type_intersection2 at /home/maarten/julia/src/gf.c:1609 [inlined]
ml_matches at /home/maarten/julia/src/gf.c:2959
jl_matching_methods at /home/maarten/julia/src/gf.c:1895
_methods_by_ftype at ./reflection.jl:908 [inlined]
#findall#246 at ./compiler/methodtable.jl:68 [inlined]
findall##kw at ./compiler/methodtable.jl:65
jfptr_findallYY.YY.kw_8814 at /home/maarten/julia/usr/lib/julia/sys.so (unknown line)
_jl_invoke at /home/maarten/julia/src/gf.c:2247 [inlined]
jl_apply_generic at /home/maarten/julia/src/gf.c:2429
#249 at ./compiler/methodtable.jl:97
get! at ./iddict.jl:178 [inlined]
#findall#248 at ./compiler/methodtable.jl:96 [inlined]
findall##kw at ./compiler/methodtable.jl:95
jfptr_findallYY.YY.kw_8807 at /home/maarten/julia/usr/lib/julia/sys.so (unknown line)
_jl_invoke at /home/maarten/julia/src/gf.c:2247 [inlined]
jl_apply_generic at /home/maarten/julia/src/gf.c:2429
find_matching_methods at ./compiler/abstractinterpretation.jl:308
abstract_call_gf_by_type at ./compiler/abstractinterpretation.jl:39
abstract_call_known at ./compiler/abstractinterpretation.jl:1319
abstract_call at ./compiler/abstractinterpretation.jl:1374
abstract_call at ./compiler/abstractinterpretation.jl:1359
abstract_eval_statement at ./compiler/abstractinterpretation.jl:1514
typeinf_local at ./compiler/abstractinterpretation.jl:1897
typeinf_nocycle at ./compiler/abstractinterpretation.jl:1993
_typeinf at ./compiler/typeinfer.jl:226
typeinf at ./compiler/typeinfer.jl:209
typeinf_edge at ./compiler/typeinfer.jl:823 [inlined]
abstract_call_method at ./compiler/abstractinterpretation.jl:504
abstract_call_gf_by_type at ./compiler/abstractinterpretation.jl:105
abstract_call at ./compiler/abstractinterpretation.jl:1372
abstract_call at ./compiler/abstractinterpretation.jl:1359
abstract_eval_statement at ./compiler/abstractinterpretation.jl:1514
typeinf_local at ./compiler/abstractinterpretation.jl:1897
typeinf_nocycle at ./compiler/abstractinterpretation.jl:1993
_typeinf at ./compiler/typeinfer.jl:226
typeinf at ./compiler/typeinfer.jl:209
typeinf_edge at ./compiler/typeinfer.jl:823 [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:1319
abstract_call at ./compiler/abstractinterpretation.jl:1374
abstract_call at ./compiler/abstractinterpretation.jl:1359
abstract_eval_statement at ./compiler/abstractinterpretation.jl:1514
typeinf_local at ./compiler/abstractinterpretation.jl:1897
typeinf_nocycle at ./compiler/abstractinterpretation.jl:1993
_typeinf at ./compiler/typeinfer.jl:226
typeinf at ./compiler/typeinfer.jl:209
typeinf_edge at ./compiler/typeinfer.jl:823 [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:1319
abstract_call at ./compiler/abstractinterpretation.jl:1374
abstract_call at ./compiler/abstractinterpretation.jl:1359
abstract_eval_statement at ./compiler/abstractinterpretation.jl:1514
typeinf_local at ./compiler/abstractinterpretation.jl:1879
typeinf_nocycle at ./compiler/abstractinterpretation.jl:1993
_typeinf at ./compiler/typeinfer.jl:226
typeinf at ./compiler/typeinfer.jl:209
typeinf_edge at ./compiler/typeinfer.jl:823 [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:1319
abstract_call at ./compiler/abstractinterpretation.jl:1374
abstract_call at ./compiler/abstractinterpretation.jl:1359
abstract_eval_statement at ./compiler/abstractinterpretation.jl:1514
typeinf_local at ./compiler/abstractinterpretation.jl:1897
typeinf_nocycle at ./compiler/abstractinterpretation.jl:1993
_typeinf at ./compiler/typeinfer.jl:226
typeinf at ./compiler/typeinfer.jl:209
typeinf_edge at ./compiler/typeinfer.jl:823 [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:1319
abstract_call at ./compiler/abstractinterpretation.jl:1374
abstract_call at ./compiler/abstractinterpretation.jl:1359
abstract_eval_statement at ./compiler/abstractinterpretation.jl:1514
typeinf_local at ./compiler/abstractinterpretation.jl:1897
typeinf_nocycle at ./compiler/abstractinterpretation.jl:1993
_typeinf at ./compiler/typeinfer.jl:226
typeinf at ./compiler/typeinfer.jl:209
typeinf_edge at ./compiler/typeinfer.jl:823 [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:1319
abstract_call at ./compiler/abstractinterpretation.jl:1374
abstract_call at ./compiler/abstractinterpretation.jl:1359
abstract_eval_statement at ./compiler/abstractinterpretation.jl:1514
typeinf_local at ./compiler/abstractinterpretation.jl:1879
typeinf_nocycle at ./compiler/abstractinterpretation.jl:1993
_typeinf at ./compiler/typeinfer.jl:226
typeinf at ./compiler/typeinfer.jl:209
typeinf_ext at ./compiler/typeinfer.jl:909
typeinf_ext_toplevel at ./compiler/typeinfer.jl:942
typeinf_ext_toplevel at ./compiler/typeinfer.jl:938
jfptr_typeinf_ext_toplevel_9135 at /home/maarten/julia/usr/lib/julia/sys.so (unknown line)
_jl_invoke at /home/maarten/julia/src/gf.c:2247 [inlined]
jl_apply_generic at /home/maarten/julia/src/gf.c:2429
jl_apply at /home/maarten/julia/src/julia.h:1790 [inlined]
jl_type_infer at /home/maarten/julia/src/gf.c:295
jl_generate_fptr at /home/maarten/julia/src/jitlayers.cpp:338
jl_compile_method_internal at /home/maarten/julia/src/gf.c:1980
jl_compile_method_internal at /home/maarten/julia/src/gf.c:2246 [inlined]
_jl_invoke at /home/maarten/julia/src/gf.c:2239 [inlined]
jl_apply_generic at /home/maarten/julia/src/gf.c:2429
jl_apply at /home/maarten/julia/src/julia.h:1790 [inlined]
start_task at /home/maarten/julia/src/task.c:875
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviorcompiler:inferenceType inference

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions