[PATCH] D64271: [analyzer] Don't track the right hand side of the last store for conditions

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 5 22:07:59 PDT 2019


NoQ added a comment.

Consider:

  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;
  }

I'd rather track `flag` when i reach `local_flag`. I believe that we must track the RHS, but only as long as it's an overwrite on its own (or it's the value that participated in the collapse).

This is why the heuristic that i suggested was "track normally until the *last* out-of-frame overwrite point or until the collapse point".


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64271





More information about the cfe-commits mailing list