[PATCH] D97183: [analyzer] Add NoteTag for smart-ptr get()

Balázs Benics via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 19 06:52:04 PDT 2021


steakhal added a comment.

I did not follow the discussion closely but we (CodeChecker team) might have a similar problem.
Consider this: https://godbolt.org/z/835P38

  int do_bifurcation(int p) { return p < 0; }
  
  int b(int x, int y) {
    int tmp = 13 / y;  // y can't be 0.
    (void)tmp;
  
    int p0 = do_bifurcation(x);  // There is a path where p0 is 0.
  
    int div = p0 * y; // So, div also becomes 0 on that path.
    return 1 / div;
  }

However, the bugreport tells us that you do a division by zero, which was initialized a line above.

Do you think it is a related issue @NoQ?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97183



More information about the cfe-commits mailing list