Skip to content

Commit

Permalink
typerep/yaksa: fix use of builtin_element_size
Browse files Browse the repository at this point in the history
If the datatype is from a flatted type, builtin_element_size can be
garbage because the field is not copied in struct flatten_hdr.

Obtain the builtin_element_size from basic_type instead.
  • Loading branch information
hzhou committed Jan 5, 2022
1 parent 15cc059 commit a338d6a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/mpi/datatype/typerep/src/typerep_yaksa_pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,10 @@ static int typerep_do_pack(const void *inbuf, MPI_Aint incount, MPI_Datatype dat
MPIR_Datatype *dtp;
MPIR_Datatype_get_ptr(datatype, dtp);
is_contig = dtp->is_contig;
element_size = dtp->builtin_element_size;
/* NOTE: dtp->element_size may not be set if dtp is from a flattened type */
if (dtp->basic_type != MPI_DATATYPE_NULL) {
element_size = MPIR_Datatype_get_basic_size(datatype);
}
inbuf_ptr = MPIR_get_contig_ptr(inbuf, dtp->true_lb);
total_size = incount * dtp->size;
}
Expand Down

0 comments on commit a338d6a

Please sign in to comment.