summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Analysis/range_casts.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/clang/test/Analysis/range_casts.c b/clang/test/Analysis/range_casts.c
index f056cb85a33..682369cce66 100644
--- a/clang/test/Analysis/range_casts.c
+++ b/clang/test/Analysis/range_casts.c
@@ -73,6 +73,16 @@ void f7(long foo)
clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}}
}
+void f8(long foo)
+{
+ unsigned index = -1;
+ if (index < foo) index = foo;
+ if (index + 1L == 0L)
+ clang_analyzer_warnIfReached(); // no-warning
+ else
+ clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}}
+}
+
void f9(long foo)
{
unsigned index = -1;
@@ -93,6 +103,16 @@ void f10(long foo)
clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}}
}
+void f11(long foo)
+{
+ unsigned index = -1;
+ if (index < foo) index = foo;
+ if (index + 1UL == 0L)
+ clang_analyzer_warnIfReached(); // no-warning
+ else
+ clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}}
+}
+
void f12(long foo)
{
unsigned index = -1;
@@ -103,6 +123,16 @@ void f12(long foo)
clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}}
}
+void f13(int foo)
+{
+ unsigned short index = -1;
+ if (index < foo) index = foo;
+ if (index + 1 == 0)
+ clang_analyzer_warnIfReached(); // no-warning
+ else
+ clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}}
+}
+
void f14(long foo)
{
unsigned index = -1;
OpenPOWER on IntegriCloud