[PATCH] D64287: [analyzer] Track the right hand side of the last store unconditionally

Kristóf Umann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 6 09:35:12 PDT 2019


Szelethus created this revision.
Szelethus added reviewers: NoQ, xazax.hun, rnkovacs, baloghadamsoftware, Charusso.
Szelethus added a project: clang.
Herald added subscribers: cfe-commits, gamesh411, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, szepet, whisperity.

The following code snippet taken from D64271#1572188 <https://reviews.llvm.org/D64271#1572188> has an issue: namely, because `flag`'s value isn't undef or a concrete int, it isn't being tracked.

  int flag;
  bool coin();
  
  void foo() {
    flag = coin();
  }
  
  void test() {
    int *x = 0;
    int local_flag;
    flag = 1;
  
    foo();
    local_flag = flag;
    if (local_flag)
      x = new int;
  
    foo();
    local_flag = flag;
    if (local_flag)
      *x = 5;
  }

This, in my opinion, makes no sense, other values may be interesting too. Originally added by rC185608 <https://reviews.llvm.org/rC185608>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D64287

Files:
  clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
  clang/test/Analysis/track-control-dependency-conditions.cpp
  clang/test/Analysis/uninit-const.c
  clang/test/Analysis/uninit-const.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64287.208274.patch
Type: text/x-patch
Size: 8643 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190706/32f7cf2d/attachment.bin>


More information about the cfe-commits mailing list