[mpich2-dev] [PATCH 1/1] Issue 4120: Fix attr alignment check from MPI_Aint to long alignment - again

Rob Ross rross at mcs.anl.gov
Fri Mar 21 12:45:46 CDT 2008


Reading the email prior to this one, I think I can be safely ignored.  
Sorry for the distraction. -- Rob

On Mar 21, 2008, at 12:44 PM, Rob Ross wrote:

> I'm sort of coming in and out of the conversation, so maybe I'm  
> missing the point, but MPI_Aint has to be signed. Extents can be  
> negative. -- Rob
>
> On Mar 21, 2008, at 11:23 AM, Jeff Parker wrote:
>
>> One more time, Doug pointed out that the cast of the pointer to an  
>> MPI_Aint should be a
>> cast to a long as well.  Also changed to unsigned long.
>>
>> Signed-off-by: Jeff Parker <jjparker at us.ibm.com>
>> ---
>> lib/mpi/mpich2/src/mpi/attr/attr_get.c      |    2 +-
>> lib/mpi/mpich2/src/mpi/attr/comm_get_attr.c |    2 +-
>> lib/mpi/mpich2/src/mpi/attr/type_get_attr.c |    2 +-
>> lib/mpi/mpich2/src/mpi/attr/win_get_attr.c  |    2 +-
>> 4 files changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/lib/mpi/mpich2/src/mpi/attr/attr_get.c b/lib/mpi/ 
>> mpich2/src/mpi/attr/attr_get.c
>> index cc39822..4527ba0 100644
>> --- a/lib/mpi/mpich2/src/mpi/attr/attr_get.c
>> +++ b/lib/mpi/mpich2/src/mpi/attr/attr_get.c
>> @@ -97,7 +97,7 @@ int MPI_Attr_get(MPI_Comm comm, int keyval, void  
>> *attr_value, int *flag)
>>               address sized int, but since this is configurable and  
>> could
>>               be larger than a pointer, we use long for the check,  
>> since
>>               long is expected to be the size of a pointer.*/
>> -	    if (MPI_VOID_PTR_CAST_TO_MPI_AINT attr_value &  
>> (sizeof(long)-1)) {
>> +	    if ( (unsigned long) attr_value & (sizeof(unsigned long)-1)) {
>> 		MPIU_ERR_SET(mpi_errno,MPI_ERR_ARG,"**attrnotptr");
>> 	    }
>> #           endif
>> diff --git a/lib/mpi/mpich2/src/mpi/attr/comm_get_attr.c b/lib/mpi/ 
>> mpich2/src/mpi/attr/comm_get_attr.c
>> index b243968..8e6a88d 100644
>> --- a/lib/mpi/mpich2/src/mpi/attr/comm_get_attr.c
>> +++ b/lib/mpi/mpich2/src/mpi/attr/comm_get_attr.c
>> @@ -89,7 +89,7 @@ int MPI_Comm_get_attr(MPI_Comm comm, int  
>> comm_keyval, void *attribute_val, int *
>>               address sized int, but since this is configurable and  
>> could
>>               be larger than a pointer, we use long for the check,  
>> since
>>               long is expected to be the size of a pointer. */
>> -	    if (MPI_VOID_PTR_CAST_TO_MPI_AINT attribute_val &  
>> (sizeof(long)-1)) {
>> +	    if ( (unsigned long) attribute_val & (sizeof(unsigned  
>> long)-1)) {
>> 		MPIU_ERR_SET(mpi_errno,MPI_ERR_ARG,"**attrnotptr");
>> 	    }
>> #           endif
>> diff --git a/lib/mpi/mpich2/src/mpi/attr/type_get_attr.c b/lib/mpi/ 
>> mpich2/src/mpi/attr/type_get_attr.c
>> index 7a41051..fabfe6a 100644
>> --- a/lib/mpi/mpich2/src/mpi/attr/type_get_attr.c
>> +++ b/lib/mpi/mpich2/src/mpi/attr/type_get_attr.c
>> @@ -91,7 +91,7 @@ int MPI_Type_get_attr(MPI_Datatype type, int  
>> type_keyval, void *attribute_val,
>>               address sized int, but since this is configurable and  
>> could
>>               be larger than a pointer, we use long for the check,  
>> since
>>               long is expected to be the size of a pointer. */
>> -	    if (MPI_VOID_PTR_CAST_TO_MPI_AINT attribute_val &  
>> (sizeof(long)-1)) {
>> +	    if ( (unsigned long) attribute_val & (sizeof(unsigned  
>> long)-1)) {
>> 		MPIU_ERR_SET(mpi_errno,MPI_ERR_ARG,"**attrnotptr");
>> 	    }
>> #           endif
>> diff --git a/lib/mpi/mpich2/src/mpi/attr/win_get_attr.c b/lib/mpi/ 
>> mpich2/src/mpi/attr/win_get_attr.c
>> index 921f018..958d193 100644
>> --- a/lib/mpi/mpich2/src/mpi/attr/win_get_attr.c
>> +++ b/lib/mpi/mpich2/src/mpi/attr/win_get_attr.c
>> @@ -87,7 +87,7 @@ int MPI_Win_get_attr(MPI_Win win, int win_keyval,  
>> void *attribute_val,
>>               address sized int, but since this is configurable and  
>> could
>>               be larger than a pointer, we use long for the check,  
>> since
>>               long is expected to be the size of a pointer. */
>> -	    if (MPI_VOID_PTR_CAST_TO_MPI_AINT attribute_val &  
>> (sizeof(long)-1)) {
>> +	    if ( (unsigned long) attribute_val & (sizeof(unsigned  
>> long)-1)) {
>> 		MPIU_ERR_SET(mpi_errno,MPI_ERR_ARG,"**attrnotptr");
>> 	    }
>> #           endif
>> -- 
>> 1.5.3.7
>>
>




More information about the mpich2-dev mailing list