Repository navigation
Closed
Description
Credit to @MasonProtter for finding this.
julia> using MutatePlainDataArray
julia> struct TAN
x::Int
s::String
TAN(x) = new(x)
TAN(x, y) = new(x, y)
end
julia> v6 = [TAN(1, "a"), TAN(2, "b")];
julia> aref(v6)[1].x[] = 3
3
julia> v6
2-element Vector{TAN}:
[3211216] signal 11 (1): Segmentation fault
in expression starting at REPL[8]:1
sig_match_fast at /cache/build/tester-amdci4-14/julialang/julia-release-1-dot-12/src/gf.c:4041 [inlined]
sig_match_fast at /cache/build/tester-amdci4-14/julialang/julia-release-1-dot-12/src/gf.c:4032 [inlined]
jl_lookup_generic_ at /cache/build/tester-amdci4-14/julialang/julia-release-1-dot-12/src/gf.c:4121 [inlined]
ijl_apply_generic at /cache/build/tester-amdci4-14/julialang/julia-release-1-dot-12/src/gf.c:4206
alignment at ./arrayshow.jl:69
_print_matrix at ./arrayshow.jl:207
print_matrix at ./arrayshow.jl:171
print_matrix at ./arrayshow.jl:171 [inlined]
print_array at ./arrayshow.jl:358 [inlined]
show at ./arrayshow.jl:399
unknown function (ip: 0x7e03bf306746) at (unknown file)
show_repl at /cache/build/tester-amdci4-14/julialang/julia-release-1-dot-12/usr/share/julia/stdlib/v1.12/REPL/src/REPL.jl:548
show_limited at /cache/build/tester-amdci4-14/julialang/julia-release-1-dot-12/usr/share/julia/stdlib/v1.12/REPL/src/REPL.jl:517
#display##0 at /cache/build/tester-amdci4-14/julialang/julia-release-1-dot-12/usr/share/julia/stdlib/v1.12/REPL/src/REPL.jl:540
jfptr_YY.displayYY.YY.0_17913.1 at /home/nathan/.julia/juliaup/julia-1.12.1+0.x64.linux.gnu/share/julia/compiled/v1.12/REPL/u0gqU_UDl4g.so (unknown line)
with_repl_linfo at /cache/build/tester-amdci4-14/julialang/julia-release-1-dot-12/usr/share/julia/stdlib/v1.12/REPL/src/REPL.jl:833
jfptr_with_repl_linfo_18268.1 at /home/nathan/.julia/juliaup/julia-1.12.1+0.x64.linux.gnu/share/julia/compiled/v1.12/REPL/u0gqU_UDl4g.so (unknown line)
display at /cache/build/tester-amdci4-14/julialang/julia-release-1-dot-12/usr/share/julia/stdlib/v1.12/REPL/src/REPL.jl:526
display at /cache/build/tester-amdci4-14/julialang/julia-release-1-dot-12/usr/share/julia/stdlib/v1.12/REPL/src/REPL.jl:546 [inlined]
display at ./multimedia.jl:340
jfptr_display_15030.1 at /home/nathan/.julia/juliaup/julia-1.12.1+0.x64.linux.gnu/share/julia/compiled/v1.12/REPL/u0gqU_UDl4g.so (unknown line)
jl_apply at /cache/build/tester-amdci4-14/julialang/julia-release-1-dot-12/src/julia.h:2391 [inlined]
jl_f_invokelatest at /cache/build/tester-amdci4-14/julialang/julia-release-1-dot-12/src/builtins.c:881
#print_response##2 at /cache/build/tester-amdci4-14/julialang/julia-release-1-dot-12/usr/share/julia/stdlib/v1.12/REPL/src/REPL.jl:590
jfptr_YY.print_responseYY.YY.2_19847.1 at /home/nathan/.julia/juliaup/julia-1.12.1+0.x64.linux.gnu/share/julia/compiled/v1.12/REPL/u0gqU_UDl4g.so (unknown line)
repl_backend_loop at /cache/build/tester-amdci4-14/julialang/julia-release-1-dot-12/usr/share/julia/stdlib/v1.12/REPL/src/REPL.jl:445
#start_repl_backend#41 at /cache/build/tester-amdci4-14/julialang/julia-release-1-dot-12/usr/share/julia/stdlib/v1.12/REPL/src/REPL.jl:427
start_repl_backend at /cache/build/tester-amdci4-14/julialang/julia-release-1-dot-12/usr/share/julia/stdlib/v1.12/REPL/src/REPL.jl:424 [inlined]
#run_repl#50 at /cache/build/tester-amdci4-14/julialang/julia-release-1-dot-12/usr/share/julia/stdlib/v1.12/REPL/src/REPL.jl:653
run_repl at /cache/build/tester-amdci4-14/julialang/julia-release-1-dot-12/usr/share/julia/stdlib/v1.12/REPL/src/REPL.jl:639
jfptr_run_repl_18594.1 at /home/nathan/.julia/juliaup/julia-1.12.1+0.x64.linux.gnu/share/julia/compiled/v1.12/REPL/u0gqU_UDl4g.so (unknown line)
run_std_repl at ./client.jl:478
jfptr_run_std_repl_62877.1 at /home/nathan/.julia/juliaup/julia-1.12.1+0.x64.linux.gnu/lib/julia/sys.so (unknown line)
jl_apply at /cache/build/tester-amdci4-14/julialang/julia-release-1-dot-12/src/julia.h:2391 [inlined]
jl_f_invokelatest at /cache/build/tester-amdci4-14/julialang/julia-release-1-dot-12/src/builtins.c:881
run_main_repl at ./client.jl:499
repl_main at ./client.jl:586 [inlined]
_start at ./client.jl:561
jfptr__start_31204.1 at /home/nathan/.julia/juliaup/julia-1.12.1+0.x64.linux.gnu/lib/julia/sys.so (unknown line)
jl_apply at /cache/build/tester-amdci4-14/julialang/julia-release-1-dot-12/src/julia.h:2391 [inlined]
true_main at /cache/build/tester-amdci4-14/julialang/julia-release-1-dot-12/src/jlapi.c:971
jl_repl_entrypoint at /cache/build/tester-amdci4-14/julialang/julia-release-1-dot-12/src/jlapi.c:1139
main at /cache/build/tester-amdci4-14/julialang/julia-release-1-dot-12/cli/loader_exe.c:58
unknown function (ip: 0x7e03d522a1c9) at /lib/x86_64-linux-gnu/libc.so.6
__libc_start_main at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
unknown function (ip: 0x4010b8) at /workspace/srcdir/glibc-2.17/csu/../sysdeps/x86_64/start.S
Allocations: 3841775 (Pool: 3841712; Big: 63); GC: 5
Segmentation fault (core dumped)Metadata
Metadata
Assignees
Labels
No labels
Activity
MasonProtter commentedon Nov 21, 2025
Oh interesting, I didn't know this package existed or I might not have made FieldViews.jl, oops!
Here's how I fixed the corresponding version of this segfault in FieldViews: MasonProtter/FieldViews.jl#9
it's a pretty easy fix, so there should be a straightforward way to make the same fix here.
nhz2 commentedon Dec 5, 2025
Looking into this more, that solution won't work here because
Base.allocatedinlinedoesn't have documented behavior right now.One place this is documented is https://docs.julialang.org/en/v1/manual/calling-c-and-fortran-code/#Struct-Type-Correspondences
From that, it would seem that only
isbitstypes are inlined, but that doesn't make sense either.MasonProtter commentedon Dec 6, 2025
I've tried to provide it with a docstring here: JuliaLang/julia#60159 and make it a public API, but I'm not sure it'll happen. I'll try and push for this on the next triage call I'm able to attend.
That documentation is just straight up incorrect. It's observably false with
isbitsuniontypes for example. However,isbitsuniontypes don't have a stable C-style ABI, so that's likely what the author meant.allocatedinlineis the right function here as far as I can tell, if you look at how julia uses it internally, it's used all over the place to see if they're supposed to do pointer-access or direct field access. I think the language devs just aren't comfortable with it being a public API because they don't like promising these sorts of things.nhz2 commentedon Dec 7, 2025
I'm going to fix this by requiring strided arrays of isbits in #8, as that seems like something that is more likely to work.
BREAKING: Fix memory safety bug by only supporting strided arrays of …