diff --git a/src/distributed_io.c b/src/distributed_io.c
index 8363ab5cf1077be61daf48c9ebee2cc8a5ef0e3c..b531a3295712b1d1543ecf2bcc63e1bd1b5b78ef 100644
--- a/src/distributed_io.c
+++ b/src/distributed_io.c
@@ -955,7 +955,7 @@ void write_output_distributed(struct engine* e,
   }
 
   /* Compute offset in the file and total number of particles */
-  const long long N[swift_type_count] = {
+  long long N[swift_type_count] = {
       Ngas_written,   Ndm_written,         Ndm_background, Nsinks_written,
       Nstars_written, Nblackholes_written, Ndm_neutrino};
 
diff --git a/src/engine.c b/src/engine.c
index f3802439661fb4200cbbea050a3303789f249e31..7a335c957373d70ff379ca566f411ef980f855cd 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -326,7 +326,7 @@ void engine_repartition_trigger(struct engine *e) {
           e->usertime_last_step, e->systime_last_step, (double)resident,
           e->local_deadtime / (e->nr_threads * e->wallclock_time)};
       double timemems[e->nr_nodes * 4];
-      MPI_Gather(&timemem, 4, MPI_DOUBLE, timemems, 4, MPI_DOUBLE, 0,
+      MPI_Gather(timemem, 4, MPI_DOUBLE, timemems, 4, MPI_DOUBLE, 0,
                  MPI_COMM_WORLD);
       if (e->nodeID == 0) {
 
@@ -1285,7 +1285,7 @@ void engine_rebuild(struct engine *e, const int repartitioned,
                 MPI_COMM_WORLD);
   MPI_Allreduce(MPI_IN_PLACE, &e->s->max_softening, 1, MPI_FLOAT, MPI_MAX,
                 MPI_COMM_WORLD);
-  MPI_Allreduce(MPI_IN_PLACE, &e->s->max_mpole_power,
+  MPI_Allreduce(MPI_IN_PLACE, e->s->max_mpole_power,
                 SELF_GRAVITY_MULTIPOLE_ORDER + 1, MPI_FLOAT, MPI_MAX,
                 MPI_COMM_WORLD);
 #endif
diff --git a/src/fof.c b/src/fof.c
index 177a41edca84792c44192db32d79396f60025653..2fe8cb9c930acd99cd443aaafb6f35ba6f41c9e2 100644
--- a/src/fof.c
+++ b/src/fof.c
@@ -4146,7 +4146,7 @@ void fof_compute_group_props(struct fof_props *props,
   /* Dump group data. */
   if (dump_results) {
 #ifdef HAVE_HDF5
-    write_fof_hdf5_catalogue(props, num_groups_local, s->e);
+    write_fof_hdf5_catalogue(props, (long long)num_groups_local, s->e);
 #else
     error("Can't dump hdf5 catalogues with hdf5 switched off!");
 #endif
diff --git a/src/fof_catalogue_io.c b/src/fof_catalogue_io.c
index b0168f388ab3bd044c23368970de86adab00e7fa..bc9060097efa45e890693d73f4d5739d3aaed258 100644
--- a/src/fof_catalogue_io.c
+++ b/src/fof_catalogue_io.c
@@ -506,7 +506,7 @@ void write_fof_hdf5_array(
 }
 
 void write_fof_hdf5_catalogue(const struct fof_props* props,
-                              const size_t num_groups, const struct engine* e) {
+                              long long num_groups, const struct engine* e) {
 
   char file_name[512];
 #ifdef WITH_MPI
diff --git a/src/fof_catalogue_io.h b/src/fof_catalogue_io.h
index 8162a52a596af37a9f582a28c01a95901ea1deb6..5050511bb0b97de21a60603801493afe630e6938 100644
--- a/src/fof_catalogue_io.h
+++ b/src/fof_catalogue_io.h
@@ -25,7 +25,7 @@
 #ifdef WITH_FOF
 
 void write_fof_hdf5_catalogue(const struct fof_props *props,
-                              const size_t num_groups, const struct engine *e);
+                              long long num_groups, const struct engine *e);
 
 #endif /* WITH_FOF */
 
diff --git a/src/neutrino/Default/neutrino.c b/src/neutrino/Default/neutrino.c
index 5b6e35ca0069034618d22a60f90ddb703f9cab1d..35e6b7697c22daed65dec0a6a3279df1a2c110fb 100644
--- a/src/neutrino/Default/neutrino.c
+++ b/src/neutrino/Default/neutrino.c
@@ -215,7 +215,7 @@ void compute_neutrino_diagnostics(
                     ppi_sum, mass_sum, weight2_sum};
   double total_sums[7];
 
-  MPI_Reduce(&sums, &total_sums, 7, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD);
+  MPI_Reduce(sums, total_sums, 7, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD);
 
   double total_p = total_sums[0];
   double total_p2 = total_sums[1];
diff --git a/src/parallel_io.c b/src/parallel_io.c
index 457cdfbf6fd02a7307d65ab34c7fee914fb9a02c..5bdb126342255c3cf903bd9b0f3aa07624345e41 100644
--- a/src/parallel_io.c
+++ b/src/parallel_io.c
@@ -1610,7 +1610,7 @@ void write_output_parallel(struct engine* e,
   }
 
   /* Compute offset in the file and total number of particles */
-  size_t N[swift_type_count] = {
+  long long N[swift_type_count] = {
       Ngas_written,   Ndm_written,         Ndm_background, Nsinks_written,
       Nstars_written, Nblackholes_written, Ndm_neutrino};
   long long N_total[swift_type_count] = {0};
diff --git a/src/space.c b/src/space.c
index f5cf36fb4e436e0a3f90385cd631ae3a5bd5aa06..4e4fa1fc0b9d203b29888aa82fd813745e7392e3 100644
--- a/src/space.c
+++ b/src/space.c
@@ -1664,8 +1664,8 @@ void space_remap_ids(struct space *s, int nr_nodes, int verbose) {
 
   if (verbose) message("Remapping all the IDs");
 
-  size_t local_nr_dm_background = 0;
-  size_t local_nr_nuparts = 0;
+  long long local_nr_dm_background = 0;
+  long long local_nr_nuparts = 0;
   for (size_t i = 0; i < s->nr_gparts; ++i) {
     if (s->gparts[i].type == swift_type_neutrino)
       local_nr_nuparts++;
@@ -1674,17 +1674,17 @@ void space_remap_ids(struct space *s, int nr_nodes, int verbose) {
   }
 
   /* Get the current local number of particles */
-  const size_t local_nr_parts = s->nr_parts;
-  const size_t local_nr_sinks = s->nr_sinks;
-  const size_t local_nr_gparts = s->nr_gparts;
-  const size_t local_nr_sparts = s->nr_sparts;
-  const size_t local_nr_bparts = s->nr_bparts;
-  const size_t local_nr_baryons =
+  long long local_nr_parts = s->nr_parts;
+  long long local_nr_sinks = s->nr_sinks;
+  long long local_nr_gparts = s->nr_gparts;
+  long long local_nr_sparts = s->nr_sparts;
+  long long local_nr_bparts = s->nr_bparts;
+  long long local_nr_baryons =
       local_nr_parts + local_nr_sinks + local_nr_sparts + local_nr_bparts;
-  const size_t local_nr_dm = local_nr_gparts > 0
-                                 ? local_nr_gparts - local_nr_baryons -
-                                       local_nr_nuparts - local_nr_dm_background
-                                 : 0;
+  long long local_nr_dm = local_nr_gparts > 0
+                              ? local_nr_gparts - local_nr_baryons -
+                                    local_nr_nuparts - local_nr_dm_background
+                              : 0;
 
   /* Get the global offsets */
   long long offset_parts = 0;
@@ -1750,21 +1750,21 @@ void space_remap_ids(struct space *s, int nr_nodes, int verbose) {
                 total_bparts + total_nuparts);
 
   /* We can now remap the IDs in the range [offset offset + local_nr] */
-  for (size_t i = 0; i < local_nr_parts; ++i) {
+  for (long long i = 0; i < local_nr_parts; ++i) {
     s->parts[i].id = offset_parts + i;
   }
-  for (size_t i = 0; i < local_nr_sinks; ++i) {
+  for (long long i = 0; i < local_nr_sinks; ++i) {
     s->sinks[i].id = offset_sinks + i;
   }
-  for (size_t i = 0; i < local_nr_sparts; ++i) {
+  for (long long i = 0; i < local_nr_sparts; ++i) {
     s->sparts[i].id = offset_sparts + i;
   }
-  for (size_t i = 0; i < local_nr_bparts; ++i) {
+  for (long long i = 0; i < local_nr_bparts; ++i) {
     s->bparts[i].id = offset_bparts + i;
   }
-  size_t count_dm = 0;
-  size_t count_dm_background = 0;
-  size_t count_nu = 0;
+  long long count_dm = 0;
+  long long count_dm_background = 0;
+  long long count_nu = 0;
   for (size_t i = 0; i < s->nr_gparts; ++i) {
     if (s->gparts[i].type == swift_type_dark_matter) {
       s->gparts[i].id_or_neg_offset = offset_dm + count_dm;
diff --git a/src/space_unique_id.c b/src/space_unique_id.c
index 137eb7189bc50bc5054265441691e42503abe0b2..bfcb733cc6daa698e2744251d7f76b5dc93068e0 100644
--- a/src/space_unique_id.c
+++ b/src/space_unique_id.c
@@ -48,7 +48,7 @@ void space_update_unique_id(struct space *s) {
     return;
   }
 
-  const int require_new_batch = s->unique_id.next_batch.current == 0;
+  int require_new_batch = s->unique_id.next_batch.current == 0;
 
 #ifdef WITH_MPI
   const struct engine *e = s->e;
diff --git a/src/task.c b/src/task.c
index 3b6ae49f48c60900e2e983a077c393fcda844cef..fa9ceb9b5ee6f08c2f07d41676191dd781a80b26 100644
--- a/src/task.c
+++ b/src/task.c
@@ -1575,32 +1575,33 @@ void task_dump_stats(const char *dumpfile, struct engine *e,
     /* Get these from all ranks for output from rank 0. Could wrap these into a
      * single operation. */
     size_t size = task_type_count * task_subtype_count;
-    int res = MPI_Reduce((engine_rank == 0 ? MPI_IN_PLACE : sum), sum, size,
-                         MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD);
+    int res =
+        MPI_Reduce((engine_rank == 0 ? MPI_IN_PLACE : &sum[0][0]), &sum[0][0],
+                   size, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD);
     if (res != MPI_SUCCESS) mpi_error(res, "Failed to reduce task sums");
 
-    res = MPI_Reduce((engine_rank == 0 ? MPI_IN_PLACE : tsum), tsum, size,
-                     MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD);
+    res = MPI_Reduce((engine_rank == 0 ? MPI_IN_PLACE : &tsum[0][0]),
+                     &tsum[0][0], size, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD);
     if (res != MPI_SUCCESS) mpi_error(res, "Failed to reduce task tsums");
 
-    res = MPI_Reduce((engine_rank == 0 ? MPI_IN_PLACE : count), count, size,
-                     MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD);
+    res = MPI_Reduce((engine_rank == 0 ? MPI_IN_PLACE : &count[0][0]),
+                     &count[0][0], size, MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD);
     if (res != MPI_SUCCESS) mpi_error(res, "Failed to reduce task counts");
 
-    res = MPI_Reduce((engine_rank == 0 ? MPI_IN_PLACE : min), min, size,
-                     MPI_DOUBLE, MPI_MIN, 0, MPI_COMM_WORLD);
+    res = MPI_Reduce((engine_rank == 0 ? MPI_IN_PLACE : &min[0][0]), &min[0][0],
+                     size, MPI_DOUBLE, MPI_MIN, 0, MPI_COMM_WORLD);
     if (res != MPI_SUCCESS) mpi_error(res, "Failed to reduce task minima");
 
-    res = MPI_Reduce((engine_rank == 0 ? MPI_IN_PLACE : tmin), tmin, size,
-                     MPI_DOUBLE, MPI_MIN, 0, MPI_COMM_WORLD);
+    res = MPI_Reduce((engine_rank == 0 ? MPI_IN_PLACE : &tmin[0][0]),
+                     &tmin[0][0], size, MPI_DOUBLE, MPI_MIN, 0, MPI_COMM_WORLD);
     if (res != MPI_SUCCESS) mpi_error(res, "Failed to reduce task minima");
 
-    res = MPI_Reduce((engine_rank == 0 ? MPI_IN_PLACE : max), max, size,
-                     MPI_DOUBLE, MPI_MAX, 0, MPI_COMM_WORLD);
+    res = MPI_Reduce((engine_rank == 0 ? MPI_IN_PLACE : &max[0][0]), &max[0][0],
+                     size, MPI_DOUBLE, MPI_MAX, 0, MPI_COMM_WORLD);
     if (res != MPI_SUCCESS) mpi_error(res, "Failed to reduce task maxima");
 
-    res = MPI_Reduce((engine_rank == 0 ? MPI_IN_PLACE : tmax), tmax, size,
-                     MPI_DOUBLE, MPI_MAX, 0, MPI_COMM_WORLD);
+    res = MPI_Reduce((engine_rank == 0 ? MPI_IN_PLACE : &tmax[0][0]),
+                     &tmax[0][0], size, MPI_DOUBLE, MPI_MAX, 0, MPI_COMM_WORLD);
     if (res != MPI_SUCCESS) mpi_error(res, "Failed to reduce task maxima");
 
     res = MPI_Reduce((engine_rank == 0 ? MPI_IN_PLACE : total), total, 1,
diff --git a/swift.c b/swift.c
index 34760a34e7606fa8077bc65cef59baae0e34a6e9..36a739ed5db799cdd042a2443c95c6a3786ad5a6 100644
--- a/swift.c
+++ b/swift.c
@@ -1321,7 +1321,7 @@ int main(int argc, char *argv[]) {
     N_long[swift_type_dark_matter] =
         with_gravity ? Ngpart - Ngpart_background - Nbaryons - Nnupart : 0;
 
-    MPI_Allreduce(&N_long, &N_total, swift_type_count + 1, MPI_LONG_LONG_INT,
+    MPI_Allreduce(N_long, N_total, swift_type_count + 1, MPI_LONG_LONG_INT,
                   MPI_SUM, MPI_COMM_WORLD);
 #else
     N_total[swift_type_gas] = Ngas;
@@ -1446,7 +1446,7 @@ int main(int argc, char *argv[]) {
     N_long[swift_type_sink] = s.nr_sinks;
     N_long[swift_type_black_hole] = s.nr_bparts;
     N_long[swift_type_neutrino] = s.nr_nuparts;
-    MPI_Allreduce(&N_long, &N_total, swift_type_count + 1, MPI_LONG_LONG_INT,
+    MPI_Allreduce(N_long, N_total, swift_type_count + 1, MPI_LONG_LONG_INT,
                   MPI_SUM, MPI_COMM_WORLD);
 #else
     N_total[swift_type_gas] = s.nr_parts;
diff --git a/swift_fof.c b/swift_fof.c
index e767a0790c212f1e3bfbbc4f4f942a944b5fe917..521eb5b8418ebee88a7c1f826fbf5133ad4b7452 100644
--- a/swift_fof.c
+++ b/swift_fof.c
@@ -525,7 +525,7 @@ int main(int argc, char *argv[]) {
   N_long[swift_type_black_hole] = Nbpart;
   N_long[swift_type_neutrino] = Nnupart;
   N_long[swift_type_count] = Ngpart;
-  MPI_Allreduce(&N_long, &N_total, swift_type_count + 1, MPI_LONG_LONG_INT,
+  MPI_Allreduce(N_long, N_total, swift_type_count + 1, MPI_LONG_LONG_INT,
                 MPI_SUM, MPI_COMM_WORLD);
 #else
   N_total[swift_type_gas] = Ngas;
@@ -613,7 +613,7 @@ int main(int argc, char *argv[]) {
   N_long[swift_type_stars] = s.nr_sparts;
   N_long[swift_type_black_hole] = s.nr_bparts;
   N_long[swift_type_neutrino] = s.nr_nuparts;
-  MPI_Allreduce(&N_long, &N_total, swift_type_count + 1, MPI_LONG_LONG_INT,
+  MPI_Allreduce(N_long, N_total, swift_type_count + 1, MPI_LONG_LONG_INT,
                 MPI_SUM, MPI_COMM_WORLD);
 #else
   N_total[swift_type_gas] = s.nr_parts;