• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1.. title:: clang-tidy - mpi-buffer-deref
2
3mpi-buffer-deref
4================
5
6This check verifies if a buffer passed to an MPI (Message Passing Interface)
7function is sufficiently dereferenced. Buffers should be passed as a single
8pointer or array. As MPI function signatures specify ``void *`` for their buffer
9types, insufficiently dereferenced buffers can be passed, like for example as
10double pointers or multidimensional arrays, without a compiler warning emitted.
11
12Examples:
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);
27