[all-commits] [llvm/llvm-project] a59d4a: [Analyzer] Hotfix for various crashes in iterator ...

Balogh, Ádám via All-commits all-commits at lists.llvm.org
Thu Jul 16 11:51:01 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: a59d4ae4313c0a961c50d14c0616b49220c5a469
      https://github.com/llvm/llvm-project/commit/a59d4ae4313c0a961c50d14c0616b49220c5a469
  Author: Adam Balogh <adam.balogh at ericsson.com>
  Date:   2020-07-16 (Thu, 16 Jul 2020)

  Changed paths:
    M clang/lib/StaticAnalyzer/Checkers/IteratorModeling.cpp
    M clang/lib/StaticAnalyzer/Checkers/IteratorRangeChecker.cpp
    M clang/test/Analysis/iterator-modeling.cpp
    M clang/test/Analysis/iterator-range.cpp

  Log Message:
  -----------
  [Analyzer] Hotfix for various crashes in iterator checkers

The patch that introduces handling iterators implemented as pointers may
cause crash in some projects because pointer difference is mistakenly
handled as pointer decrement. (Similair case for iterators implemented
as class instances are already handled correctly.) This patch fixes this
issue.

The second case that causes crash is comparison of an iterator
implemented as pointer and a null-pointer. This patch contains a fix for
this issue as well.

The third case which causes crash is that the checker mistakenly
considers all integers as nonloc::ConcreteInt when handling an increment
or decrement of an iterator implemented as pointers. This patch adds a
fix for this too.

The last case where crashes were detected is when checking for success
of an std::advance() operation. Since the modeling of iterators
implemented as pointers is still incomplete this may result in an
assertion. This patch replaces the assertion with an early exit and
adds a FIXME there.

Differential Revision: https://reviews.llvm.org/D83295




More information about the All-commits mailing list