diff --git a/src/parallel_io.c b/src/parallel_io.c
index f360277fe0fbaf806bd60bad775f3d79dae13bb8..1ec43bce6b131ef7a657420876d27aa03c2e9085 100644
--- a/src/parallel_io.c
+++ b/src/parallel_io.c
@@ -347,7 +347,7 @@ void writeArray(struct engine* e, hid_t grp, char* fileName, FILE* xmfFile,
   }
 
   /* Make sure the chunks are not larger than the dataset */
-  if (chunk_shape[0] > N_total) chunk_shape[0] = N_total;
+  if (chunk_shape[0] > (hsize_t) N_total) chunk_shape[0] = N_total;
 
   /* Create the space in the file */
   hid_t h_filespace = H5Screate(H5S_SIMPLE);