diff options
author | Artem Dergachev <artem.dergachev@gmail.com> | 2018-07-17 00:42:35 +0000 |
---|---|---|
committer | Artem Dergachev <artem.dergachev@gmail.com> | 2018-07-17 00:42:35 +0000 |
commit | bf89e7dc6e314c1da0a1fd0c1ac732a774873268 (patch) | |
tree | 9c8afe118a633ba4a5f2c83a4c59e1991ffaaa40 /test/Analysis/casts.cpp | |
parent | 7ba800497502025d63e18a62d295af6c7971f492 (diff) | |
download | clang-bf89e7dc6e314c1da0a1fd0c1ac732a774873268.tar.gz |
[analyzer] pr37802: Fix symbolic-pointer-to-boolean casts during load.
The canonical representation of pointer &SymRegion{$x} casted to boolean is
"$x != 0", not "$x". Assertion added in r337227 catches that.
Differential Revision: https://reviews.llvm.org/D48232
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337228 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis/casts.cpp')
-rw-r--r-- | test/Analysis/casts.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/Analysis/casts.cpp b/test/Analysis/casts.cpp index 6499b20a79..757eb6da66 100644 --- a/test/Analysis/casts.cpp +++ b/test/Analysis/casts.cpp @@ -35,3 +35,9 @@ int *&&castToIntPtrRValueRef(char *p) { bool testCastToIntPtrRValueRef(char *p, int *s) { return castToIntPtrRValueRef(p) != s; // no-crash } + +bool retrievePointerFromBoolean(int *p) { + bool q; + *reinterpret_cast<int **>(&q) = p; + return q; +} |