1 // RUN: %clang_analyze_cc1 -analyzer-checker=optin.mpi.MPI-Checker -analyzer-output=text -verify %s
3 // MPI-Checker test file to test note diagnostics.
7 void doubleNonblocking() {
10 MPI_Isend(&buf
, 1, MPI_DOUBLE
, 0, 0, MPI_COMM_WORLD
, &sendReq
); // expected-note{{Request is previously used by nonblocking call here.}}
11 MPI_Irecv(&buf
, 1, MPI_DOUBLE
, 0, 0, MPI_COMM_WORLD
, &sendReq
); // expected-warning{{Double nonblocking on request 'sendReq'.}} expected-note{{Double nonblocking on request 'sendReq'.}}
12 MPI_Wait(&sendReq
, MPI_STATUS_IGNORE
);
18 MPI_Ireduce(MPI_IN_PLACE
, &buf
, 1, MPI_DOUBLE
, MPI_SUM
, 0, MPI_COMM_WORLD
, &sendReq
); // expected-note{{Request is previously used by nonblocking call here.}}
19 } // expected-warning{{Request 'sendReq' has no matching wait.}} expected-note{{Request 'sendReq' has no matching wait.}}
21 // If more than 2 nonblocking calls are using a request in a sequence, they all
22 // point to the first call as the 'previous' call. This is because the
23 // BugReporterVisitor only checks for differences in state or existence of an
25 void tripleNonblocking() {
28 MPI_Isend(&buf
, 1, MPI_DOUBLE
, 0, 0, MPI_COMM_WORLD
, &sendReq
); // expected-note 2{{Request is previously used by nonblocking call here.}}
29 MPI_Irecv(&buf
, 1, MPI_DOUBLE
, 0, 0, MPI_COMM_WORLD
, &sendReq
); // expected-warning{{Double nonblocking on request 'sendReq'.}} expected-note{{Double nonblocking on request 'sendReq'.}}
31 MPI_Isend(&buf
, 1, MPI_DOUBLE
, 0, 0, MPI_COMM_WORLD
, &sendReq
); // expected-warning{{Double nonblocking on request 'sendReq'.}} expected-note{{Double nonblocking on request 'sendReq'.}}
33 MPI_Wait(&sendReq
, MPI_STATUS_IGNORE
);