-
-
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
Spurious segfault related to similar with struct containing Union with Missing #38224
Comments
Yeah, doesn't look like this TODO ever got implemented (and the computation seems wrong): $ grep -RI zeroinit src/
src/array.c: if (tot > 0 && (!isunboxed || hasptr || isunion)) // TODO: check for zeroinit
src/array.c: if (tot > 0 && (!isunboxed || hasptr || isunion)) // TODO: check for zeroinit
src/array.c: if (a->flags.ptrarray || a->flags.hasptr) { // TODO: check for zeroinit
src/array.c: if (a->flags.ptrarray || a->flags.hasptr) { // TODO: check for zeroinit
src/dump.c: | (dt->zeroinit << 4)
src/dump.c: dt->zeroinit = (memflags >> 4) & 1;
src/jltypes.c: "zeroinit",
src/datatype.c: t->zeroinit = 0;
src/datatype.c: st->zeroinit = 0;
src/datatype.c: st->zeroinit = w->zeroinit;
src/datatype.c: int zeroinit = 0;
src/datatype.c: zeroinit = 1;
src/datatype.c: if (!zeroinit)
src/datatype.c: zeroinit = ((jl_datatype_t*)fld)->zeroinit;
src/datatype.c: zeroinit = 1;
src/julia.h: uint8_t zeroinit; // if one or more fields requires zero-initialization
$ ./julia -q
julia> struct Foo
i::Union{Int,Missing}
end
julia> Foo.zeroinit
false |
For the uneducated among us, what does the |
That's weird. If you have |
IIUC correctly, the problem here is that It looks like diff --git a/src/datatype.c b/src/datatype.c
index 3428e7479e..2a78cd098c 100644
--- a/src/datatype.c
+++ b/src/datatype.c
@@ -544,6 +544,7 @@ void jl_compute_field_offsets(jl_datatype_t *st)
if (npointers)
free(pointers);
}
+ st->zeroinit = zeroinit;
}
// now finish deciding if this instantiation qualifies for special properties
assert(!isbitstype || st->layout->npointers == 0); // the definition of isbits To fix these TODOs, would there need to be an additional field in |
Note: I'm not sure if this is already fixed on the current nightly or not (see below).
Running this on Julia v1.5.2 (Linux x86_64)
Julia segfaults:
So the segfault seems related to the REPL-display of the result, not the array creation itself.
System info:
I can reproduce this reliably using the official Julia binary in a CentOS-7 Singularity container on an Ubuntu 20.04 host. It doesn't seem to occur when running Julia v1.5.2 natively on Ubuntu 20.04, though - but then, given the fickle nature of segfaults that doesn't mean there's no issue, of course. I also can't reproduce the segfault using Julia v1.6.0-DEV.1354, neither inside nor outside of the container. But then segfaults don't always get triggered, or course, so I don't know if that means the
underlying issue is already fixed or not. So I'm reporting this in case it's still relevant.
The text was updated successfully, but these errors were encountered: