summaryrefslogtreecommitdiffstats
path: root/test/Analysis/svalbuilder-rearrange-comparisons.c
diff options
context:
space:
mode:
authorAdam Balogh <adam.balogh@ericsson.com>2018-12-05 13:17:50 +0000
committerAdam Balogh <adam.balogh@ericsson.com>2018-12-05 13:17:50 +0000
commitc0efe26a537310ec8db3660402d47cb87485b2d9 (patch)
tree9cefc2198bc33cc7eab8d09d2b8ed888a165f942 /test/Analysis/svalbuilder-rearrange-comparisons.c
parente44b4e4240e03c24f5479f81235519493823c27b (diff)
[Analyzer] [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/branches/release_70@348362 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis/svalbuilder-rearrange-comparisons.c')
-rw-r--r--test/Analysis/svalbuilder-rearrange-comparisons.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/Analysis/svalbuilder-rearrange-comparisons.c b/test/Analysis/svalbuilder-rearrange-comparisons.c
index ac186120fe..ca2099cf7f 100644
--- a/test/Analysis/svalbuilder-rearrange-comparisons.c
+++ b/test/Analysis/svalbuilder-rearrange-comparisons.c
@@ -934,3 +934,17 @@ int mixed_integer_types(int x, int y) {
short a = x - 1U;
return a - y;
}
+
+unsigned gu();
+unsigned fu() {
+ unsigned x = gu();
+ // Assert that no overflows occur in this test file.
+ // Assuming that concrete integers are also within that range.
+ assert(x <= ((unsigned)UINT_MAX / 4));
+ return x;
+}
+
+void unsigned_concrete_int_no_crash() {
+ unsigned x = fu() + 1U, y = fu() + 1U;
+ clang_analyzer_dump(x == y); // expected-warning {{((conj_$2{unsigned int}) + 1U) == ((conj_$7{unsigned int}) + 1U)}}
+}