Issue 208107
Summary [Analyzer] MPI_Checker: doesn't classify some functions, causing false positives
Labels
Assignees
Reporter SuperSamus
    The file [MPIFunctionClassifier.cpp](https://github.com/llvm/llvm-project/blob/main/clang/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIFunctionClassifier.cpp) classifies many of MPI's functions, but not all of them.

For instance, `MPI_Iscatterv` is completely missing, and thus:
```c
#include <mpi.h>

int main(int argc, char **argv) {
  MPI_Init(&argc, &argv);

 MPI_Request request = MPI_REQUEST_NULL;
  MPI_Iscatterv(NULL, NULL, NULL, MPI_DATATYPE_NULL, NULL, 0, MPI_DATATYPE_NULL,
                0, MPI_COMM_WORLD, &request);
  MPI_Wait(&request, MPI_STATUS_IGNORE);

 MPI_Finalize();
}
```

The analyzer complains with a false positive:
```
test.c:10:3: warning: Request 'request' has no matching nonblocking call.  [clang-analyzer-optin.mpi.MPI-Checker]
    6 | MPI_Request request = MPI_REQUEST_NULL;
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    7 |   // Ignore the pointlessness of this.
    8 |   MPI_Iscatterv(NULL, NULL, NULL, MPI_DATATYPE_NULL, NULL, 0, MPI_DATATYPE_NULL,
    9 |                 0, MPI_COMM_WORLD, &request);
   10 |   MPI_Wait(&request, MPI_STATUS_IGNORE);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test.c:10:3: note: Request 'request' has no matching nonblocking call.
    6 |   MPI_Request request = MPI_REQUEST_NULL;
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    7 | // Ignore the pointlessness of this.
    8 |   MPI_Iscatterv(NULL, NULL, NULL, MPI_DATATYPE_NULL, NULL, 0, MPI_DATATYPE_NULL,
    9 | 0, MPI_COMM_WORLD, &request);
   10 |   MPI_Wait(&request, MPI_STATUS_IGNORE);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

While there is no false positive with, for instance, `MPI_Iscatter`.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to