[mpich-discuss] Incorrect error checking?

Raffenetti, Kenneth J. raffenet at mcs.anl.gov
Wed Jun 19 09:27:44 CDT 2019


Nick,

I agree this check looks like nonsense. IMO, we can just delete it and 
the others like it. I will create a PR.

Ken

On 6/18/19 5:25 PM, Nick Radcliffe via discuss wrote:
> I recently noticed that a parameter check in MPII_Win_get_attr looks a 
> bit off:
> 
> 
>              /* A common user error is to pass the address of a 4-byte
>               * int when the address of a pointer (or an address-sized int)
>               * should have been used.  We can test for this specific
>               * case.  Note that this code assumes sizeof(intptr_t) is
>               * a power of 2. */
>              if ((intptr_t) attribute_val & (sizeof(intptr_t) - 1)) {
>                  MPIR_ERR_SETANDSTMT(mpi_errno, MPI_ERR_ARG, goto 
> fn_fail, "**attrnotptr");
>              }
> 
> 
> The comment indicates that the check is testing "attribute_val" to see 
> if a pointer to int was passed in, rather than a double pointer or 
> pointer to an integer that can store an address. But the check seems to 
> only be testing for 8 byte alignment (and failing if not aligned). Am I 
> missing something here?
> 
> 
> 
> Nick Radcliffe  Software Engineer| Cray Inc.
> 
> 2131 Lindau Ln #1000 | Bloomington, MN55425
> 
> +1-651-605-8864  nradclif at cray.com <mailto:email at cray.com>  www.cray.com 
> <http://www.cray.com>
> 
> 
> _______________________________________________
> discuss mailing list     discuss at mpich.org
> To manage subscription options or unsubscribe:
> https://lists.mpich.org/mailman/listinfo/discuss
> 


More information about the discuss mailing list