]> granicus.if.org Git - clang/commit
[analyzer] Conjure a symbol to ensure we can identify pointer arithmetic
authorAnna Zaks <ganna@apple.com>
Thu, 3 May 2012 02:13:56 +0000 (02:13 +0000)
committerAnna Zaks <ganna@apple.com>
Thu, 3 May 2012 02:13:56 +0000 (02:13 +0000)
commite55a14a025c38800d07f1ab0db7dbbe4a2fe1605
tree20b0fffd25d47c5636f9cd8c39911820ffcb59bd
parentda3960347a5d563d6746cb363b25466282a09ce3
[analyzer] Conjure a symbol to ensure we can identify pointer arithmetic

We need to identify the value of ptr as
ElementRegion (result of pointer arithmetic) in the following code.
However, before this commit '(2-x)' evaluated to Unknown value, and as
the result, 'p + (2-x)' evaluated to Unknown value as well.

int *p = malloc(sizeof(int));
ptr = p + (2-x);

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156052 91177308-0d34-0410-b5e6-96231b3b80d8
lib/StaticAnalyzer/Core/ExprEngineC.cpp
test/Analysis/malloc.c