summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAdam Balogh <adam.balogh@ericsson.com>2018-11-30 10:37:44 +0000
committerAdam Balogh <adam.balogh@ericsson.com>2018-11-30 10:37:44 +0000
commit1fe45f93473d64e67e056f3eab1de59fd3e6886a (patch)
treea7505f1c8c3d570400495d08efe83ce44f93b589 /lib
parent0eeda76b8325ae183af3ff739b194755a53c7a78 (diff)
downloadclang-1fe45f93473d64e67e056f3eab1de59fd3e6886a.tar.gz
lyzer] [HOTFIX!] SValBuilder crash when `aggressive-binary-operation-simplification` enabled
During the review of D41938 a condition check with an early exit accidentally slipped into a branch, leaving the other branch unprotected. This may result in an assertion later on. This hotfix moves this contition check outside of the branch. Differential Revision: https://reviews.llvm.org/D55051 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@347981 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp b/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
index 5cd9320d65..19d71253eb 100644
--- a/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
+++ b/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
@@ -475,9 +475,6 @@ static Optional<NonLoc> tryRearrange(ProgramStateRef State,
SingleTy = ResultTy;
if (LSym->getType() != SingleTy)
return None;
- // Substracting unsigned integers is a nightmare.
- if (!SingleTy->isSignedIntegerOrEnumerationType())
- return None;
} else {
// Don't rearrange other operations.
return None;
@@ -485,6 +482,10 @@ static Optional<NonLoc> tryRearrange(ProgramStateRef State,
assert(!SingleTy.isNull() && "We should have figured out the type by now!");
+ // Rearrange signed symbolic expressions only
+ if (!SingleTy->isSignedIntegerOrEnumerationType())
+ return None;
+
SymbolRef RSym = Rhs.getAsSymbol();
if (!RSym || RSym->getType() != SingleTy)
return None;