Skip to content

Runtime crash with unreachable reached #55206

@AaronGhost

Description

@AaronGhost

Hi, thanks for developing Julia!

I encountered a runtime crash on 1.10.4 while including the script below. The runtime crash still exists in 1.11.0rc1 and nightly. I tried to reduce it to the best of my ability:

  • A StructB contains a StructA and an additional array
  • Both StructA and StructB have a "parameter" version (AParams and BParams)
  • a StructA/B can be with buildA/B and A/BParams
  • Calling buildB triggers a crash, only when using a boolean array (which does not depend on T).
abstract type AbstractA{T <: AbstractFloat} end
const UnionT{T, N} = Union{Array{T, N}, Array{Bool, N}}

struct StructA{T} <: AbstractA{T}
    x::T
end

struct AParams
    x
end

function buildA(params::AParams)
    return StructA(params.x)
end

struct StructB{T, DIM, S <: AbstractA{T}, SMT<: UnionT{T, DIM}}
    StructB(::S, arr::SMT) where {T, DIM, S <: AbstractA{T}, SMT <: UnionT{T, DIM}} = new{T, DIM, S, SMT}()
end

struct BParams{T}
    arr::UnionT{T}
    op::AParams
end

function buildB(objparams::BParams)
    op = buildA(objparams.op)
    return StructB(op, objparams.arr)
end

opparams = AParams(1.0f0)
objparams = BParams(ones(Bool, (10,10)), opparams)
obj = buildB(objparams)
Please find below the crash log

Unreachable reached at 0000023570eb17ff

Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ILLEGAL_INSTRUCTION at 0x23570eb17ff -- buildB at D:\Documents\Julia\reproduceissue.jl:27
in expression starting at D:\Documents\Julia\reproduceissue.jl:32
buildB at D:\Documents\Julia\reproduceissue.jl:27
unknown function (ip: 0000023570eb183b)
jl_apply at C:/workdir/src\julia.h:1982 [inlined]
do_call at C:/workdir/src\interpreter.c:126
eval_value at C:/workdir/src\interpreter.c:223
eval_stmt_value at C:/workdir/src\interpreter.c:174 [inlined]
eval_body at C:/workdir/src\interpreter.c:635
jl_interpret_toplevel_thunk at C:/workdir/src\interpreter.c:775
jl_toplevel_eval_flex at C:/workdir/src\toplevel.c:934
jl_toplevel_eval_flex at C:/workdir/src\toplevel.c:877
ijl_toplevel_eval at C:/workdir/src\toplevel.c:943 [inlined]
ijl_toplevel_eval_in at C:/workdir/src\toplevel.c:985
eval at .\boot.jl:385 [inlined]
include_string at .\loading.jl:2076
_include at .\loading.jl:2136
include at .\client.jl:489
unknown function (ip: 0000023570eb052b)
jl_apply at C:/workdir/src\julia.h:1982 [inlined]
do_call at C:/workdir/src\interpreter.c:126
eval_value at C:/workdir/src\interpreter.c:223
eval_stmt_value at C:/workdir/src\interpreter.c:174 [inlined]
eval_body at C:/workdir/src\interpreter.c:635
jl_interpret_toplevel_thunk at C:/workdir/src\interpreter.c:775
jl_toplevel_eval_flex at C:/workdir/src\toplevel.c:934
jl_toplevel_eval_flex at C:/workdir/src\toplevel.c:877
ijl_toplevel_eval at C:/workdir/src\toplevel.c:943 [inlined]
ijl_toplevel_eval_in at C:/workdir/src\toplevel.c:985
eval at .\boot.jl:385 [inlined]
eval_user_input at C:\workdir\usr\share\julia\stdlib\v1.10\REPL\src\REPL.jl:150
repl_backend_loop at C:\workdir\usr\share\julia\stdlib\v1.10\REPL\src\REPL.jl:246
#start_repl_backend#46 at C:\workdir\usr\share\julia\stdlib\v1.10\REPL\src\REPL.jl:231
#run_repl#59 at C:\workdir\usr\share\julia\stdlib\v1.10\REPL\src\REPL.jl:389
jfptr_run_repl_95791.1 at C:\Users\anon\AppData\Local\Programs\Julia-1.10.4\lib\julia\sys.dll (unknown line)
#1013 at .\client.jl:432
jfptr_YY.1013_86566.1 at C:\Users\anon\AppData\Local\Programs\Julia-1.10.4\lib\julia\sys.dll (unknown line)
jl_apply at C:/workdir/src\julia.h:1982 [inlined]
jl_f__call_latest at C:/workdir/src\builtins.c:812
#invokelatest#2 at .\essentials.jl:892 [inlined]
invokelatest at .\essentials.jl:889 [inlined]
run_main_repl at .\client.jl:416
exec_options at .\client.jl:333
_start at .\client.jl:552
jfptr__start_86591.1 at C:\Users\anon\AppData\Local\Programs\Julia-1.10.4\lib\julia\sys.dll (unknown line)
jl_apply at C:/workdir/src\julia.h:1982 [inlined]
true_main at C:/workdir/src\jlapi.c:582
jl_repl_entrypoint at C:/workdir/src\jlapi.c:731
mainCRTStartup at C:/workdir/cli\loader_exe.c:58
BaseThreadInitThunk at C:\Windows\System32\KERNEL32.DLL (unknown line)
RtlUserThreadStart at C:\Windows\SYSTEM32\ntdll.dll (unknown line)
Allocations: 2908 (Pool: 2900; Big: 8); GC: 0

Output from versioninfo:

Julia Version 1.10.4
Commit 48d4fd4843 (2024-06-04 10:41 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 16 × 11th Gen Intel(R) Core(TM) i9-11900K @ 3.50GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, rocketlake)
Threads: 1 default, 0 interactive, 1 GC (on 16 virtual cores)

Metadata

Metadata

Assignees

Labels

bugIndicates an unexpected problem or unintended behaviorregression 1.10Regression in the 1.10 releaseregression 1.11Regression in the 1.11 releaseregression 1.12Regression in the 1.12 releasetypes and dispatchTypes, subtyping and method dispatch

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions