]> https://gitweb.dealii.org/ - dealii.git/commitdiff
fix test: invalid memory access 17485/head
authorTimo Heister <timo.heister@gmail.com>
Tue, 13 Aug 2024 03:45:59 +0000 (23:45 -0400)
committerTimo Heister <timo.heister@gmail.com>
Tue, 13 Aug 2024 03:53:42 +0000 (23:53 -0400)
tests/mpi/periodicity_03.cc
tests/mpi/renumber_cuthill_mckee.cc

index 59d2f4b6e735aee5327ff1ea6890d28a1d338c61..6a58d9128271ad0d1187cbd4b2a408af94f17dce 100644 (file)
@@ -606,7 +606,9 @@ namespace Step22
         displacements[i] = displacements[i - 1] + n_elements[i - 1];
 
       global_quad_points_first.resize(displacements[n_processes]);
-      MPI_Allgatherv(&local_quad_points_first[0],
+      MPI_Allgatherv((local_quad_points_first.size() > 0) ?
+                       (&local_quad_points_first[0]) :
+                       nullptr,
                      n_my_elements,
                      MPI_DOUBLE,
                      &global_quad_points_first[0],
@@ -635,7 +637,9 @@ namespace Step22
         displacements[i] = displacements[i - 1] + n_elements[i - 1];
 
       global_quad_points_second.resize(displacements[n_processes]);
-      MPI_Allgatherv(&local_quad_points_second[0],
+      MPI_Allgatherv((local_quad_points_second.size() > 0) ?
+                       (&local_quad_points_second[0]) :
+                       nullptr,
                      n_my_elements,
                      MPI_DOUBLE,
                      &global_quad_points_second[0],
index f2435523ffcf8de3e5c1ab056aed40e157bcd94e..37c2ffd2d8b8dbb7a3daa51f480eb0a5cb1629b2 100644 (file)
@@ -116,7 +116,7 @@ test()
       for (unsigned int i = 1; i < nprocs; ++i)
         {
           if (myid == i)
-            MPI_Send(&renumbering[0],
+            MPI_Send((renumbering.size() > 0) ? (&renumbering[0]) : nullptr,
                      renumbering.size(),
                      Utilities::MPI::mpi_type_id_for_type<
                        decltype(complete_renumbering[0])>,
@@ -124,7 +124,9 @@ test()
                      i,
                      MPI_COMM_WORLD);
           else if (myid == 0)
-            MPI_Recv(&complete_renumbering[offset],
+            MPI_Recv((dofs_per_proc[i].n_elements() > 0) ?
+                       (&complete_renumbering[offset]) :
+                       nullptr,
                      dofs_per_proc[i].n_elements(),
                      Utilities::MPI::mpi_type_id_for_type<
                        decltype(complete_renumbering[0])>,

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.