[PATCH] D50256: [Analyzer] [WIP] Basic support for multiplication and division in the constraint manager (for == and != only)

Balogh, Ádám via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 3 08:12:12 PDT 2018


baloghadamsoftware created this revision.
baloghadamsoftware added a reviewer: NoQ.
Herald added subscribers: mikhail.ramalho, a.sidorin, dkrupp, rnkovacs, szepet, whisperity.
Herald added a reviewer: george.karpenkov.

Currently, the default (range-based) constrain manager supports symbolic expressions of the format "symbol + integer" or "symbol - integer" to compare them to another integer. However, multiplication and division is not supported yet.

An example where multiplication (and division) could be useful is the checking whether a pointer operation or an array index is out of the bounds of the memory region. The index is often a first-degree expression of the format a*x+b (e.g. for special sparse such as triangular matrices).

In this patch we only support multiplication and division for two kinds of symbolic comparisons: the `==` and the `!=` operators. The rest is to follow in a subsequent patch. Negative multipliers and divisors are not supported yet.


https://reviews.llvm.org/D50256

Files:
  include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h
  lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
  lib/StaticAnalyzer/Core/RangedConstraintManager.cpp
  test/Analysis/multiplicative-folding.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50256.159011.patch
Type: text/x-patch
Size: 35754 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180803/83d24341/attachment-0001.bin>


More information about the cfe-commits mailing list