Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/datatype.c
Original file line number Diff line number Diff line change
Expand Up @@ -702,13 +702,19 @@ void jl_compute_field_offsets(jl_datatype_t *st)
// Should never happen
throw_ovf(should_malloc, desc, st, fsz);
desc[i].isptr = 0;

if (jl_is_uniontype(fld)) {
fsz += 1; // selector byte
zeroinit = 1;
// TODO: Some unions could be bits comparable.
isbitsegal = 0;
}
else {
if (fsz > jl_datatype_size(fld)) {
// We have to pad the size to integer size class, but it means this has some padding
isbitsegal = 0;
haspadding = 1;
}
uint32_t fld_npointers = ((jl_datatype_t*)fld)->layout->npointers;
if (((jl_datatype_t*)fld)->layout->flags.haspadding)
haspadding = 1;
Expand Down
6 changes: 6 additions & 0 deletions test/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8534,3 +8534,9 @@ module GlobalBindingMulti
using .M.C
end
@test GlobalBindingMulti.S === GlobalBindingMulti.M.C.S

#58434 bitsegal comparison of oddly sized fields
primitive type ByteString58434 (18 * 8) end

@test Base.datatype_isbitsegal(Tuple{ByteString58434}) == false
@test Base.datatype_haspadding(Tuple{ByteString58434}) == true