[mpich2-dev] [PATCH 3/4] Issue 4120: Fix cast in gather

Jeff Parker jjparker at us.ibm.com
Sun Mar 30 23:54:11 CDT 2008


When sendbuf or tmp_buf are virtual addresses that exceed 2GB (this can
happen in DUAL or VN modes on BG/P), casting to MPI_Aint must use care
to ensure the sign is not extended when sizeof(MPI_Aint) > sizeof(pointer).

Signed-off-by: Jeff Parker <jjparker at us.ibm.com>
---
 lib/mpi/mpich2/src/mpi/coll/gather.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/mpi/mpich2/src/mpi/coll/gather.c b/lib/mpi/mpich2/src/mpi/coll/gather.c
index 8d8e760..2fd6a2d 100644
--- a/lib/mpi/mpich2/src/mpi/coll/gather.c
+++ b/lib/mpi/mpich2/src/mpi/coll/gather.c
@@ -252,10 +252,10 @@ int MPIR_Gather (
 		}
 		else {
 		    blocks[0] = sendcnt;
-		    struct_displs[0] = (MPI_Aint) sendbuf;
+		    struct_displs[0] = MPI_VOID_PTR_CAST_TO_MPI_AINT sendbuf;
 		    types[0] = sendtype;
 		    blocks[1] = curr_cnt - nbytes;
-		    struct_displs[1] = (MPI_Aint) tmp_buf;
+		    struct_displs[1] = MPI_VOID_PTR_CAST_TO_MPI_AINT tmp_buf;
 		    types[1] = MPI_BYTE;
 
 		    NMPI_Type_create_struct(2, blocks, struct_displs, types, &tmp_type);
-- 
1.5.3.7




More information about the mpich2-dev mailing list