From: Timo Heister Date: Mon, 21 Oct 2019 11:56:39 +0000 (+0200) Subject: avoid 64bit overflow in Partiioner::set_ghost_indices X-Git-Tag: v9.2.0-rc1~961^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F8936%2Fhead;p=dealii.git avoid 64bit overflow in Partiioner::set_ghost_indices We MPI::sum() a 32 bit value of the total number of ghost indices, which might overflow. This is unlikely to be a problem unless you exactly have 2^32 ghost indices, but this is nevertheless a bug. --- diff --git a/source/base/partitioner.cc b/source/base/partitioner.cc index 4a63c4bc81..9d987a1ef1 100644 --- a/source/base/partitioner.cc +++ b/source/base/partitioner.cc @@ -174,7 +174,7 @@ namespace Utilities n_ghost_indices_data = ghost_indices_data.n_elements(); have_ghost_indices = - Utilities::MPI::sum(n_ghost_indices_data, communicator) > 0; + Utilities::MPI::max(n_ghost_indices_data, communicator) > 0; // In the rest of this function, we determine the point-to-point // communication pattern of the partitioner. We make up a list with both