brintos

brintos / llvm-project-archived public Read only

0
0
Text · 893 B · 9658246 Raw
28 lines · plain
1.. title:: clang-tidy - mpi-buffer-deref2 3mpi-buffer-deref4================5 6This check verifies if a buffer passed to an MPI (Message Passing Interface)7function is sufficiently dereferenced. Buffers should be passed as a single8pointer or array. As MPI function signatures specify ``void *`` for their9buffer types, insufficiently dereferenced buffers can be passed, like for10example as double pointers or multidimensional arrays, without a compiler11warning emitted.12 13Examples:14 15.. code-block:: c++16 17   // A double pointer is passed to the MPI function.18   char *buf;19   MPI_Send(&buf, 1, MPI_CHAR, 0, 0, MPI_COMM_WORLD);20 21   // A multidimensional array is passed to the MPI function.22   short buf[1][1];23   MPI_Send(buf, 1, MPI_SHORT, 0, 0, MPI_COMM_WORLD);24 25   // A pointer to an array is passed to the MPI function.26   short *buf[1];27   MPI_Send(buf, 1, MPI_SHORT, 0, 0, MPI_COMM_WORLD);28