-
-
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
Packing an empty NamedTuple into a struct with other elements causes UndefRefError: access to undefined reference
(Julia 1.7)
#43783
Labels
regression
Regression in behavior compared to a previous version
Milestone
Comments
alex-lew
changed the title
Packing two NamedTuples into a struct causes
Packing one empty and one non-empty NamedTuple into a struct causes Jan 12, 2022
UndefRefError: access to undefined reference
(Julia 1.7)UndefRefError: access to undefined reference
(Julia 1.7)
alex-lew
changed the title
Packing one empty and one non-empty NamedTuple into a struct causes
Packing an empty NamedTuple into a struct with other elements causes Jan 12, 2022
UndefRefError: access to undefined reference
(Julia 1.7)UndefRefError: access to undefined reference
(Julia 1.7)
Here's an additional yikes: julia> struct BadStruct{R,S}
named_tuple::NamedTuple{R,S}
n::Int
end
julia> hasfield(BadStruct(NamedTuple(), 5), :named_tuple)
ERROR:
signal (11): Segmentation fault
in expression starting at none:0
sig_match_simple at /buildworker/worker/package_linux64/build/src/typemap.c:194 [inlined]
jl_typemap_entry_assoc_exact at /buildworker/worker/package_linux64/build/src/typemap.c:959
jl_typemap_assoc_exact at /buildworker/worker/package_linux64/build/src/julia_internal.h:1267 [inlined]
jl_lookup_generic_ at /buildworker/worker/package_linux64/build/src/gf.c:2369 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2425
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1788 [inlined]
do_apply at /buildworker/worker/package_linux64/build/src/builtins.c:713
showerror at ./errorshow.jl:222
#showerror#813 at ./errorshow.jl:88
showerror##kw at ./errorshow.jl:87
jfptr_showerrorYY.YY.kw_32910.clone_1 at /home/ubuntu/julia-1.7.0/lib/julia/sys.so (unknown line)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
show_exception_stack at ./errorshow.jl:866
display_error at ./client.jl:104
jfptr_display_error_34726.clone_1 at /home/ubuntu/julia-1.7.0/lib/julia/sys.so (unknown line)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1788 [inlined]
jl_f__call_latest at /buildworker/worker/package_linux64/build/src/builtins.c:757
#invokelatest#2 at ./essentials.jl:716 [inlined]
invokelatest at ./essentials.jl:714 [inlined]
print_response at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.7/REPL/src/REPL.jl:286
#45 at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.7/REPL/src/REPL.jl:275
jfptr_YY.45_48142.clone_1 at /home/ubuntu/julia-1.7.0/lib/julia/sys.so (unknown line)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
with_repl_linfo at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.7/REPL/src/REPL.jl:508
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
print_response at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.7/REPL/src/REPL.jl:273
do_respond at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.7/REPL/src/REPL.jl:844
jfptr_do_respond_46689.clone_1 at /home/ubuntu/julia-1.7.0/lib/julia/sys.so (unknown line)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1788 [inlined]
jl_f__call_latest at /buildworker/worker/package_linux64/build/src/builtins.c:757
#invokelatest#2 at ./essentials.jl:716 [inlined]
invokelatest at ./essentials.jl:714 [inlined]
run_interface at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.7/REPL/src/LineEdit.jl:2493
jfptr_run_interface_47484.clone_1 at /home/ubuntu/julia-1.7.0/lib/julia/sys.so (unknown line)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
run_frontend at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.7/REPL/src/REPL.jl:1230
#49 at ./task.jl:423
jfptr_YY.49_48145.clone_1 at /home/ubuntu/julia-1.7.0/lib/julia/sys.so (unknown line)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1788 [inlined]
start_task at /buildworker/worker/package_linux64/build/src/task.c:877
Allocations: 2721 (Pool: 2713; Big: 8); GC: 0
[1] 4190442 segmentation fault (core dumped) julia |
vtjnash
added
the
regression
Regression in behavior compared to a previous version
label
Jan 12, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The following code fails with an
UndefRefError
on Julia 1.7:It also exits the REPL.
I'm not sure what's going on here, but here are some observations:
let x = BadStruct(NamedTuple{}(), 0); x.n end
works. Butlet x = BadStruct(NamedTuple{}(), 0); x.named_tuple end
raises the UndefRefError, this time in Base.getproperty. So it seems the struct is being constructed, but thenamed_tuple
field is not getting initialized properly? Note this example gives an error but does not kill the REPL.My
versioninfo()
isbut @femtomc has reproduced the error, with
This issue came up because Gen.jl's
StaticChoiceMap
datatype is similar to theBadStruct
above, and we noticed crashes when upgrading to Julia 1.7. (https://github.com/probcomp/Gen.jl/blob/44f5f1408caf05ff95932bb58d9f57907c5084e3/src/choice_map.jl#L350).The code works fine on my machine on Julia 1.6.3.
Thanks!
The text was updated successfully, but these errors were encountered: