Skip to content

Commit 2dc59b4

Browse files
committed
Compile warning from -Wstringop-overread
ncmpio_filetype.c: In function 'type_create_subarray64.constprop': ncmpio_filetype.c:154:21: warning: 'MPI_Type_create_subarray' reading 4 bytes from a region of size 0 [-Wstringop-overread] 154 | mpireturn = MPI_Type_create_subarray(ndims, sizes, subsizes, starts, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 155 | order, oldtype, newtype); | ~~~~~~~~~~~~~~~~~~~~~~~~ ncmpio_filetype.c:154:21: note: referencing argument 3 of type 'const int *' ncmpio_filetype.c:154:21: warning: 'MPI_Type_create_subarray' reading 4 bytes from a region of size 0 [-Wstringop-overread] ncmpio_filetype.c:154:21: note: referencing argument 4 of type 'const int *' In file included from ncmpio_filetype.c:18: /opt/cray/pe/mpich/8.1.25/ofi/gnu/9.1/include/mpi.h:1362:5: note: in a call to function 'MPI_Type_create_subarray' 1362 | int MPI_Type_create_subarray(int ndims, const int array_of_sizes[], | ^~~~~~~~~~~~~~~~~~~~~~~~
1 parent 2e85789 commit 2dc59b4

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

src/drivers/ncmpio/ncmpio_filetype.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,10 @@ type_create_subarray64(int ndims,
137137
}
138138

139139
if (tag == 0) {
140-
int gsizes[24], *sizes, *subsizes, *starts;
140+
int *sizes, *subsizes, *starts;
141141
/* none of dimensions > 2^31-1, we can safely use
142142
* MPI_Type_create_subarray */
143-
if (ndims <= 8) /* avoid malloc */
144-
sizes = gsizes;
145-
else
146-
sizes = (int*) NCI_Malloc((size_t)ndims * 3 * SIZEOF_INT);
143+
sizes = (int*) NCI_Malloc((size_t)ndims * 3 * SIZEOF_INT);
147144
subsizes = sizes + ndims;
148145
starts = subsizes + ndims;
149146
for (i=0; i<ndims; i++) {
@@ -156,7 +153,7 @@ type_create_subarray64(int ndims,
156153
if (mpireturn != MPI_SUCCESS)
157154
err = ncmpii_error_mpi2nc(mpireturn, "MPI_Type_create_subarray");
158155

159-
if (ndims > 8) NCI_Free(sizes);
156+
NCI_Free(sizes);
160157
return err;
161158
}
162159

0 commit comments

Comments
 (0)