Skip to content

Commit

Permalink
Initialize padding in datatype layout (#47640)
Browse files Browse the repository at this point in the history
We use that memory for hashing it, so we need to ensure it is set to zero.
  • Loading branch information
gbaraldi authored Nov 19, 2022
1 parent 185b583 commit 90934ff
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/datatype.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ static jl_datatype_layout_t *jl_get_layout(uint32_t sz,
flddesc->alignment = alignment;
flddesc->haspadding = haspadding;
flddesc->fielddesc_type = fielddesc_type;
flddesc->padding = 0;
flddesc->npointers = npointers;
flddesc->first_ptr = (npointers > 0 ? pointers[0] : -1);

Expand Down Expand Up @@ -815,6 +816,7 @@ JL_DLLEXPORT jl_datatype_t * jl_new_foreign_type(jl_sym_t *name,
layout->haspadding = 1;
layout->npointers = haspointers;
layout->fielddesc_type = 3;
layout->padding = 0;
jl_fielddescdyn_t * desc =
(jl_fielddescdyn_t *) ((char *)layout + sizeof(*layout));
desc->markfunc = markfunc;
Expand Down
1 change: 1 addition & 0 deletions src/julia.h
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,7 @@ typedef struct {
uint16_t alignment; // strictest alignment over all fields
uint16_t haspadding : 1; // has internal undefined bytes
uint16_t fielddesc_type : 2; // 0 -> 8, 1 -> 16, 2 -> 32, 3 -> foreign type
uint16_t padding : 13;
// union {
// jl_fielddesc8_t field8[nfields];
// jl_fielddesc16_t field16[nfields];
Expand Down

2 comments on commit 90934ff

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily package evaluation, I will reply here when finished:

@nanosoldier runtests(ALL, isdaily = true, configuration=(rr=true,))

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your package evaluation job has completed - possible new issues were detected. A full report can be found here.

Please sign in to comment.