[PATCH] D158813: [analyzer] MPIChecker: MPI_Waitall should respect count arg

Ding Fei via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 25 09:39:37 PDT 2023


danix800 added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIChecker.cpp:185-188
+    CharUnits ElemSizeInChars = ASTCtx.getTypeSizeInChars(ElemType);
+    int64_t ElemSizeInBits =
+        (ElemSizeInChars.isZero() ? 1 : ElemSizeInChars.getQuantity()) *
+        ASTCtx.getCharWidth();
----------------
steakhal wrote:
> How can `ElemSizeInChar` be zero?
> If it can be zero, could you demonstrate it by a test?
Type in the wild does not have to be of non-zero size. MPI vendors might choose whatever implementation as they want.
We are doing division so non-zero checking is necessary.

https://reviews.llvm.org/D158707 added a few general testcases for zero-sized type processing on dynamic extent.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158813/new/

https://reviews.llvm.org/D158813



More information about the cfe-commits mailing list