In src/mpi/comm/intercomm_create.c from lines 58, the calculation of maxi seems to be incorrect when maxlpid is a multiple of 32.

    /* Compute the max index and zero the pids array */
    maxi = (maxlpid + 31) / 32;

    if (maxi >= MAX_LPID32_ARRAY) {
MPIU_CHKLMEM_MALLOC(lpidmask,int32_t*,maxi*sizeof(int32_t),
    mpi_errno,"lpidmask");
    }
    else {
lpidmask = lpidmaskPrealloc;
    }
    
    for (i=0; i<maxi; i++) lpidmask[i] = 0;