MPI_Recv overwrites parts of memory it should not access

后端 未结 1 1079
忘了有多久
忘了有多久 2020-11-27 08:40

In the following code the value of xysize gets changed, if I do not declare it as a parameter (which I generally cannot do). It happens only with optimizations

相关标签:
1条回答
  • 2020-11-27 09:09

    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.

    0 讨论(0)
提交回复
热议问题