From 3dce2ea873a2568d8d63ce5c3029c28012dfbc50 Mon Sep 17 00:00:00 2001 From: Tobias Melson Date: Fri, 25 Feb 2022 14:39:16 +0100 Subject: [PATCH] Avoid integer overflow when calculating length It may happen that the product of the two 4-byte integers overflows before assigning to the 8-byte integer. We need to explicitly convert to 8 bytes first before multiplying. --- lib/mpifx_win.fpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mpifx_win.fpp b/lib/mpifx_win.fpp index 1bd2d63..f54efd2 100644 --- a/lib/mpifx_win.fpp +++ b/lib/mpifx_win.fpp @@ -69,7 +69,7 @@ contains local_length = 0 if (mycomm%lead) then - local_length = length * disp_unit + local_length = int(length, kind=MPI_ADDRESS_KIND) * disp_unit end if call mpi_win_allocate_shared(local_length, disp_unit, MPI_INFO_NULL, mycomm%id, baseptr, self%id, error0)