title: C: Signal code: Address not mapped (1) mpirecv
body: <p>I have the following code written in C with MPI:</p>
  
  <pre><code>#include &lt;mpi.h&gt;
  #include &lt;stdio.h&gt;
  
  int main(int argc, char *argv[])
  {
      int size, rank;
      MPI_Status status;
      int buf[1000];
  
      MPI_Init(&amp;argc, &amp;argv);
      MPI_Comm_size(MPI_COMM_WORLD, &amp;size);
      MPI_Comm_rank(MPI_COMM_WORLD, &amp;rank);
  
      if (rank == 0) {
          int i = 0;
  
          while (i != 1000) {
              buf[i] = i;
              i++;
          }
  
          MPI_Send(buf, 999, MPI_INT, 1, 1, MPI_COMM_WORLD);
          printf("msg has been sent\n");
      }
  
      if (rank == 1) {
          int sz = sizeof(buf);
          int lst = buf[sz-1];
  
          MPI_Recv(buf, 999, MPI_INT, 0, 1, MPI_COMM_WORLD, &amp;status);
          printf("la taille du buf %d et dernier %d", sz, lst);
      }
  
      MPI_Finalize();
  }
  </code></pre>
  
  <p>And after run it it gives this message:</p>
  
  <pre><code>msg has been sente
  [blitzkrieg-TravelMate-P253:03395] *** Process received signal ***
  [blitzkrieg-TravelMate-P253:03395] Signal: Segmentation fault (11)
  [blitzkrieg-TravelMate-P253:03395] Signal code: Address not mapped (1)
  [blitzkrieg-TravelMate-P253:03395] Failing at address: 0xbfee8574
  [blitzkrieg-TravelMate-P253:03395] [0] [0xb772d40c]
  [blitzkrieg-TravelMate-P253:03395] [1] mpii(main+0x12f) [0x8048883]
  [blitzkrieg-TravelMate-P253:03395] [2] /lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xf3) [0xb74c84d3]
  [blitzkrieg-TravelMate-P253:03395] [3] mpii() [0x80486c1]
  [blitzkrieg-TravelMate-P253:03395] *** End of error message ***
  </code></pre>
  
  <hr>
  
  <p>mpirun noticed that process rank 1 with PID 3395 on node blitzkrieg-</p>
  
  <p>TravelMate-P253 exited on signal 11 (Segmentation fault).</p>
  
  <p>Any suggestion will help thnx.</p>