]> granicus.if.org Git - clang/commit
[analyzer] LoopUnrolling: check the bitwidth of the used numbers (pr34943)
authorPeter Szecsi <szepet95@gmail.com>
Sat, 28 Oct 2017 12:19:08 +0000 (12:19 +0000)
committerPeter Szecsi <szepet95@gmail.com>
Sat, 28 Oct 2017 12:19:08 +0000 (12:19 +0000)
commit5d548d284e653240a44965a6b3ce891de8435341
treee323e4299bddae96d733365f81c09578ef5e1eee
parent2fd1377b9138ac71f8aca6e8251c655caf549406
[analyzer] LoopUnrolling: check the bitwidth of the used numbers (pr34943)

The loop unrolling feature aims to track the maximum possible steps a loop can
make. In order to implement this, it investigates the initial value of the
counter variable and the bound number. (It has to be known.)
These numbers are used as llvm::APInts, however, it was not checked if their
bitwidths are the same which lead to some crashes.
This revision solves this problem by extending the "shorter" one (to the length
of the "longer" one).
For the detailed bug report, see: https://bugs.llvm.org/show_bug.cgi?id=34943

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316830 91177308-0d34-0410-b5e6-96231b3b80d8
lib/StaticAnalyzer/Core/LoopUnrolling.cpp
test/Analysis/loop-unrolling.cpp