mirror of
https://github.com/HDFGroup/hdf5.git
synced 2026-09-25 04:09:44 +03:00
Fix segfault in ph5_f90_filtered_writes_no_sel example: swap inverted mem_space_id (#6633)
The Fortran example set sel_type = H5S_BLOCK_F on the branch where a rank
calls H5Sselect_none (no data to contribute) and H5S_ALL_F on the branch
where a rank sets a real hyperslab, which is backwards. The equivalent C
example (ph5_filtered_writes_no_sel.c) does the opposite:
H5Dwrite(..., no_selection ? H5S_ALL : H5S_BLOCK, ...);
i.e. H5S_ALL when there is no selection (mirrors the file dataspace's own
empty selection) and H5S_BLOCK when a hyperslab was set (memory buffer
matches the block shape of the file selection).
With the inversion, H5Dwrite_f feeds a bogus selection into the collective
filtered I/O path, corrupting the element/byte-length accounting in
H5D__mpio_collective_filtered_chunk_update, which segfaults inside
H5D_select_io_mem -> H5VM_memcpyvv on 12 MPI ranks. Reproduces on current
develop; the bug has been present since the example was added in #3916.
This commit is contained in:
@@ -186,7 +186,7 @@ CONTAINS
|
||||
! passed to H5Dwrite.
|
||||
|
||||
CALL H5Sselect_none_f(file_dataspace, status)
|
||||
sel_type = H5S_BLOCK_F
|
||||
sel_type = H5S_ALL_F
|
||||
ELSE
|
||||
!
|
||||
! Even MPI ranks contribute data to
|
||||
@@ -206,7 +206,7 @@ CONTAINS
|
||||
|
||||
CALL H5Sselect_hyperslab_f(file_dataspace, H5S_SELECT_SET_F, start, count, status, stride=stride)
|
||||
|
||||
sel_type = H5S_ALL_F
|
||||
sel_type = H5S_BLOCK_F
|
||||
!
|
||||
! --------------------------------------
|
||||
! Fill data buffer with MPI rank's rank
|
||||
|
||||
Reference in New Issue
Block a user