[mpich-discuss] Segfault with MPICH 3.2+Clang but not GCC

Andreas Noack andreasnoackjensen at gmail.com
Tue Jul 26 10:17:05 CDT 2016

On my El Capitan macbook I get a segfault when running the program below
with more than a single process but only when MPICH has been compiled with

I don't get that good debug info but here is some of what I got

(lldb) c
Process 61129 resuming
Process 61129 stopped
* thread #1: tid = 0x32c438, 0x00000003119d0432
libpmpi.12.dylib`MPID_Request_create + 244, queue =
'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
    frame #0: 0x00000003119d0432 libpmpi.12.dylib`MPID_Request_create + 244
->  0x3119d0432 <+244>: movaps %xmm0, 0x230(%rax)
    0x3119d0439 <+251>: movq   $0x0, 0x240(%rax)
    0x3119d0444 <+262>: movl   %ecx, 0x210(%rax)
    0x3119d044a <+268>: popq   %rbp

My version of Clang is

Apple LLVM version 7.3.0 (clang-703.0.31)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

and the bug has been confirmed by my colleague who is running Linux and
compiling with Clang 3.8. The program runs fine with OpenMPI+Clang.

#include <mpi.h>
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
    MPI_Init(&argc, &argv);

    MPI_Comm comm = MPI_COMM_WORLD;
    uint64_t *A, *C;
    int rnk;

    MPI_Comm_rank(comm, &rnk);
    A = calloc(1, sizeof(uint64_t));
    C = calloc(2, sizeof(uint64_t));
    A[0] = rnk + 1;

    MPI_Allgather(A, 1, MPI_UINT64_T, C, 1, MPI_UINT64_T, comm);

    return 0;

Best regards

Andreas Noack
Postdoctoral Associate
Computer Science and Artificial Intelligence Laboratory
Massachusetts Institute of Technology
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mpich.org/pipermail/discuss/attachments/20160726/27eff56b/attachment.html>
-------------- next part --------------
discuss mailing list     discuss at mpich.org
To manage subscription options or unsubscribe:

More information about the discuss mailing list