Really copy only when recvbuf != sendbuf.

And avoid to call memcpy with overlapping regions.
Use simple arrays, instead of dynars.

Also fix the use of uninitialized values in PMPI_Waitall.
Check return code, and report errors.

Avoids to call MPI_Get_count with an invalid status.