MPI_Recv overwrites parts of memory it should not access

For the sake of future visitors, I suppose I’ll answer this even though it’s all answered in the comments above.

As far as I’m aware, if your program is behaving properly, you cannot change the value of that parameter (“count”) in a call to MPI_Recv.

Your argument status is too small, it should be an array status(MPI_STATUS_SIZE), and you’re getting a buffer overflow — This often results in a segmentation fault, but at times (depending on how the compiler packed the variables in memory), it can result in funny behavior like this.

Leave a Comment