Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 5 additions & 0 deletions src/datatype.c
Original file line number Diff line number Diff line change
Expand Up @@ -577,12 +577,17 @@ 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)) {
haspadding = 1;
fsz += 1; // selector byte
zeroinit = 1;
}
else {
if (fsz > jl_datatype_size(fld)) {
// We have to pad the size to integer size class, but it means this has some padding
haspadding = 1;
}
uint32_t fld_npointers = ((jl_datatype_t*)fld)->layout->npointers;
if (((jl_datatype_t*)fld)->layout->haspadding)
haspadding = 1;
Expand Down
5 changes: 5 additions & 0 deletions test/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8085,3 +8085,8 @@ let widen_diagonal(x::UnionAll) = Base.rewrap_unionall(Base.widen_diagonal(Base.
@test Tuple === widen_diagonal(Union{Tuple{Vararg{S}}, Tuple{Vararg{T}}} where {S, T})
@test Tuple{Vararg{Val{<:Set}}} == widen_diagonal(Tuple{Vararg{T}} where T<:Val{<:Set})
end

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

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