Crash in code compilation in Julia 1.7.0-rc1 and master #42645
Closed
Description
The following input leads to a segfault in Julia 1.7.0-rc1 and master; it works fine in 1.6.3
struct A{T}
x::Bool
function A(a::Vector{T}) where T
r = new{T}()
r.x = false
return r
end
end
struct B{T}
y::A{T}
end
function f()
res = B(A([x]))
res.y = A([x])
res.y.x = true
end
f()
This is a reduction from the crash as we observed it in Oscar.jl; upstream issue is oscar-system/Oscar.jl#735
Crash log on macOS 10.14.6 with Julia master:
signal (11): Segmentation fault: 11
in expression starting at REPL[4]:1
load at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/atomic:926 [inlined]
atomic_load_explicit<_jl_value_t *> at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/atomic:1270 [inlined]
jl_atomic_load_explicit<_jl_value_t *> at /Users/mhorn/Projekte/Julia/julia.master/src/./julia_atomics.h:93 [inlined]
jl_svecref at /Users/mhorn/Projekte/Julia/julia.master/src/./julia.h:915 [inlined]
emit_f_opfield at /Users/mhorn/Projekte/Julia/julia.master/src/codegen.cpp:2691
emit_call at /Users/mhorn/Projekte/Julia/julia.master/src/codegen.cpp:3757
emit_expr at /Users/mhorn/Projekte/Julia/julia.master/src/codegen.cpp:4587
emit_ssaval_assign at /Users/mhorn/Projekte/Julia/julia.master/src/codegen.cpp:4229
emit_stmtpos at /Users/mhorn/Projekte/Julia/julia.master/src/codegen.cpp:0 [inlined]
emit_function at /Users/mhorn/Projekte/Julia/julia.master/src/codegen.cpp:7314
jl_emit_code at /Users/mhorn/Projekte/Julia/julia.master/src/codegen.cpp:7676
jl_emit_codeinst at /Users/mhorn/Projekte/Julia/julia.master/src/codegen.cpp:7721
_jl_compile_codeinst at /Users/mhorn/Projekte/Julia/julia.master/src/jitlayers.cpp:110
jl_generate_fptr_impl at /Users/mhorn/Projekte/Julia/julia.master/src/jitlayers.cpp:336
jl_compile_method_internal at /Users/mhorn/Projekte/Julia/julia.master/src/gf.c:1980
_jl_invoke at /Users/mhorn/Projekte/Julia/julia.master/src/gf.c:2245 [inlined]
ijl_apply_generic at /Users/mhorn/Projekte/Julia/julia.master/src/gf.c:2435
jl_apply at /Users/mhorn/Projekte/Julia/julia.master/src/./julia.h:1782 [inlined]
do_call at /Users/mhorn/Projekte/Julia/julia.master/src/interpreter.c:126
eval_stmt_value at /Users/mhorn/Projekte/Julia/julia.master/src/interpreter.c:166 [inlined]
eval_body at /Users/mhorn/Projekte/Julia/julia.master/src/interpreter.c:589
jl_interpret_toplevel_thunk at /Users/mhorn/Projekte/Julia/julia.master/src/interpreter.c:739
jl_toplevel_eval_flex at /Users/mhorn/Projekte/Julia/julia.master/src/toplevel.c:889
jl_toplevel_eval_flex at /Users/mhorn/Projekte/Julia/julia.master/src/toplevel.c:833
ijl_toplevel_eval at /Users/mhorn/Projekte/Julia/julia.master/src/toplevel.c:898 [inlined]
ijl_toplevel_eval_in at /Users/mhorn/Projekte/Julia/julia.master/src/toplevel.c:948
eval at ./boot.jl:368 [inlined]
eval_user_input at /Users/mhorn/Projekte/Julia/julia.master/usr/share/julia/stdlib/v1.8/REPL/src/REPL.jl:151
repl_backend_loop at /Users/mhorn/Projekte/Julia/julia.master/usr/share/julia/stdlib/v1.8/REPL/src/REPL.jl:245
start_repl_backend at /Users/mhorn/Projekte/Julia/julia.master/usr/share/julia/stdlib/v1.8/REPL/src/REPL.jl:230
#run_repl#47 at /Users/mhorn/Projekte/Julia/julia.master/usr/share/julia/stdlib/v1.8/REPL/src/REPL.jl:363
run_repl at /Users/mhorn/Projekte/Julia/julia.master/usr/share/julia/stdlib/v1.8/REPL/src/REPL.jl:350
_jl_invoke at /Users/mhorn/Projekte/Julia/julia.master/src/gf.c:0 [inlined]
ijl_apply_generic at /Users/mhorn/Projekte/Julia/julia.master/src/gf.c:2435
#938 at ./client.jl:394
jfptr_YY.938_22236 at /Users/mhorn/Projekte/Julia/julia.master/usr/lib/julia/sys.dylib (unknown line)
_jl_invoke at /Users/mhorn/Projekte/Julia/julia.master/src/gf.c:0 [inlined]
ijl_apply_generic at /Users/mhorn/Projekte/Julia/julia.master/src/gf.c:2435
jl_apply at /Users/mhorn/Projekte/Julia/julia.master/src/./julia.h:1782 [inlined]
jl_f__call_latest at /Users/mhorn/Projekte/Julia/julia.master/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_22479 at /Users/mhorn/Projekte/Julia/julia.master/usr/lib/julia/sys.dylib (unknown line)
_jl_invoke at /Users/mhorn/Projekte/Julia/julia.master/src/gf.c:0 [inlined]
ijl_apply_generic at /Users/mhorn/Projekte/Julia/julia.master/src/gf.c:2435
jl_apply at /Users/mhorn/Projekte/Julia/julia.master/src/./julia.h:1782 [inlined]
true_main at /Users/mhorn/Projekte/Julia/julia.master/src/jlapi.c:562
jl_repl_entrypoint at /Users/mhorn/Projekte/Julia/julia.master/src/jlapi.c:704
Allocations: 2732 (Pool: 2721; Big: 11); GC: 0
Crash log in Julia 1.7.0-rc1, also on macOS 10.14.6:
signal (11): Segmentation fault: 11
in expression starting at REPL[4]:1
_ZL14emit_f_opfieldR12jl_codectx_tP10jl_cgval_tP11_jl_value_tPKS1_mS6_ at /Users/mhorn/Applications/Julia-1.7.0-rc1.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.dylib (unknown line)
_ZL9emit_callR12jl_codectx_tP9jl_expr_tP11_jl_value_t at /Users/mhorn/Applications/Julia-1.7.0-rc1.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.dylib (unknown line)
_ZL9emit_exprR12jl_codectx_tP11_jl_value_tl at /Users/mhorn/Applications/Julia-1.7.0-rc1.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.dylib (unknown line)
_ZL18emit_ssaval_assignR12jl_codectx_tlP11_jl_value_t at /Users/mhorn/Applications/Julia-1.7.0-rc1.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.dylib (unknown line)
_ZL13emit_functionP21_jl_method_instance_tP15_jl_code_info_tP11_jl_value_tR19jl_codegen_params_tb at /Users/mhorn/Applications/Julia-1.7.0-rc1.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.dylib (unknown line)
_Z12jl_emit_codeP21_jl_method_instance_tP15_jl_code_info_tP11_jl_value_tR19jl_codegen_params_t at /Users/mhorn/Applications/Julia-1.7.0-rc1.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.dylib (unknown line)
_Z16jl_emit_codeinstP19_jl_code_instance_tP15_jl_code_info_tR19jl_codegen_params_t at /Users/mhorn/Applications/Julia-1.7.0-rc1.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.dylib (unknown line)
_ZL20_jl_compile_codeinstP19_jl_code_instance_tP15_jl_code_info_tm at /Users/mhorn/Applications/Julia-1.7.0-rc1.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.dylib (unknown line)
jl_generate_fptr at /Users/mhorn/Applications/Julia-1.7.0-rc1.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.dylib (unknown line)
jl_compile_method_internal at /Users/mhorn/Applications/Julia-1.7.0-rc1.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.dylib (unknown line)
jl_apply_generic at /Users/mhorn/Applications/Julia-1.7.0-rc1.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.dylib (unknown line)
do_call at /Users/mhorn/Applications/Julia-1.7.0-rc1.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.dylib (unknown line)
eval_body at /Users/mhorn/Applications/Julia-1.7.0-rc1.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.dylib (unknown line)
jl_interpret_toplevel_thunk at /Users/mhorn/Applications/Julia-1.7.0-rc1.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.dylib (unknown line)
jl_toplevel_eval_flex at /Users/mhorn/Applications/Julia-1.7.0-rc1.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.dylib (unknown line)
jl_toplevel_eval_flex at /Users/mhorn/Applications/Julia-1.7.0-rc1.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.dylib (unknown line)
jl_toplevel_eval_in at /Users/mhorn/Applications/Julia-1.7.0-rc1.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.dylib (unknown line)
eval at ./boot.jl:373 [inlined]
eval_user_input at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.7/REPL/src/REPL.jl:150
repl_backend_loop at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.7/REPL/src/REPL.jl:244
start_repl_backend at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.7/REPL/src/REPL.jl:229
#run_repl#47 at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.7/REPL/src/REPL.jl:362
run_repl at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.7/REPL/src/REPL.jl:349
jl_apply_generic at /Users/mhorn/Applications/Julia-1.7.0-rc1.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.dylib (unknown line)
#929 at ./client.jl:394
jfptr_YY.929_27089.clone_1 at /Users/mhorn/Applications/Julia-1.7.0-rc1.app/Contents/Resources/julia/lib/julia/sys.dylib (unknown line)
jl_apply_generic at /Users/mhorn/Applications/Julia-1.7.0-rc1.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.dylib (unknown line)
jl_f__call_latest at /Users/mhorn/Applications/Julia-1.7.0-rc1.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.dylib (unknown line)
#invokelatest#2 at ./essentials.jl:716 [inlined]
invokelatest at ./essentials.jl:714 [inlined]
run_main_repl at ./client.jl:379
exec_options at ./client.jl:309
_start at ./client.jl:495
jfptr__start_20975.clone_1 at /Users/mhorn/Applications/Julia-1.7.0-rc1.app/Contents/Resources/julia/lib/julia/sys.dylib (unknown line)
jl_apply_generic at /Users/mhorn/Applications/Julia-1.7.0-rc1.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.dylib (unknown line)
true_main at /Users/mhorn/Applications/Julia-1.7.0-rc1.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.dylib (unknown line)
jl_repl_entrypoint at /Users/mhorn/Applications/Julia-1.7.0-rc1.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.dylib (unknown line)
Allocations: 2720 (Pool: 2710; Big: 10); GC: 0