From: Timo Heister Date: Tue, 13 Aug 2024 03:45:59 +0000 (-0400) Subject: fix test: invalid memory access X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fbd38e8d02859ea7ac61ef9c8274c726622a0d49;p=dealii.git fix test: invalid memory access --- diff --git a/tests/mpi/periodicity_03.cc b/tests/mpi/periodicity_03.cc index 59d2f4b6e7..6a58d91282 100644 --- a/tests/mpi/periodicity_03.cc +++ b/tests/mpi/periodicity_03.cc @@ -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], diff --git a/tests/mpi/renumber_cuthill_mckee.cc b/tests/mpi/renumber_cuthill_mckee.cc index f2435523ff..37c2ffd2d8 100644 --- a/tests/mpi/renumber_cuthill_mckee.cc +++ b/tests/mpi/renumber_cuthill_mckee.cc @@ -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])>,