| 1 |
.. title:: clang-tidy - mpi-buffer-deref |
| 2 |
|
| 3 |
mpi-buffer-deref |
| 4 |
================ |
| 5 |
|
| 6 |
This check verifies if a buffer passed to an MPI (Message Passing Interface) |
| 7 |
function is sufficiently dereferenced. Buffers should be passed as a single |
| 8 |
pointer or array. As MPI function signatures specify ``void *`` for their buffer |
| 9 |
types, insufficiently dereferenced buffers can be passed, like for example as |
| 10 |
double pointers or multidimensional arrays, without a compiler warning emitted. |
| 11 |
|
| 12 |
Examples: |
| 13 |
|
| 14 |
.. code-block:: c++ |
| 15 |
|
| 16 |
// A double pointer is passed to the MPI function. |
| 17 |
char *buf; |
| 18 |
MPI_Send(&buf, 1, MPI_CHAR, 0, 0, MPI_COMM_WORLD); |
| 19 |
|
| 20 |
// A multidimensional array is passed to the MPI function. |
| 21 |
short buf[1][1]; |
| 22 |
MPI_Send(buf, 1, MPI_SHORT, 0, 0, MPI_COMM_WORLD); |
| 23 |
|
| 24 |
// A pointer to an array is passed to the MPI function. |
| 25 |
short *buf[1]; |
| 26 |
MPI_Send(buf, 1, MPI_SHORT, 0, 0, MPI_COMM_WORLD); |