[PATCH] D77062: [analyzer] Improved zero assumption in CStringChecke::assumeZero

Denys Petrov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 24 06:27:10 PDT 2020


ASDenysPetrov updated this revision to Diff 272997.
ASDenysPetrov added a comment.

@NoQ thanks for the approval. But I'm afraid we should return the check for `!V.getAs<nonloc::LazyCompoundVal>()` back in `CStringChecker::assumeZero`.

Look, I paid attention to the fix for https://llvm.org/PR24951 and related commit rG480a0c00ca51d909a925120737b71289cbb79eda <https://reviews.llvm.org/rG480a0c00ca51d909a925120737b71289cbb79eda>. I saw that @dcoughlin added a check for `V.getAs<nonloc::LazyCompoundVal>()` to fix and the old code used it implicitly. My patch returns this issue back. That's why we need to add the check for `LazyCompoundVal` as well.

Another big question is why `LazyCompoundVal` can be possible here at all. As I see according to the graph below the answer is somewhere deep in the core. Thus I'd propose to apply this patch in scope of fix https://llvm.org/PR37503.
F11723847: tmp63ucwe5i.html <https://reviews.llvm.org/F11723847>

I updated the patch. I've also added a //FIXME// caveat.


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

https://reviews.llvm.org/D77062

Files:
  clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
  clang/test/Analysis/string.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77062.272997.patch
Type: text/x-patch
Size: 6260 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200624/38010d06/attachment-0001.bin>


More information about the cfe-commits mailing list