aboutsummaryrefslogtreecommitdiff
path: root/test/Analysis/unreachable-code-path.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/Analysis/unreachable-code-path.c')
-rw-r--r--test/Analysis/unreachable-code-path.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/test/Analysis/unreachable-code-path.c b/test/Analysis/unreachable-code-path.c
index 071532739cbe..52e6d3df2c01 100644
--- a/test/Analysis/unreachable-code-path.c
+++ b/test/Analysis/unreachable-code-path.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-experimental-checks -analyzer-check-objc-mem -analyzer-check-dead-stores -verify -analyzer-opt-analyze-nested-blocks %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental.UnreachableCode -analyzer-check-objc-mem -analyzer-checker=core.DeadStores -verify -analyzer-opt-analyze-nested-blocks -Wno-unused-value %s
extern void foo(int a);
@@ -93,8 +93,8 @@ void test9(unsigned a) {
switch (a) {
if (a) // expected-warning{{never executed}}
foo(a + 5); // no-warning
- else // no-warning
- foo(a); // no-warning
+ else // no-warning
+ foo(a); // no-warning
case 1:
case 2:
break;
@@ -102,3 +102,23 @@ void test9(unsigned a) {
break;
}
}
+
+// Tests from flow-sensitive version
+void test10() {
+ goto c;
+ d:
+ goto e; // expected-warning {{never executed}}
+ c: ;
+ int i;
+ return;
+ goto b; // expected-warning {{never executed}}
+ goto a; // expected-warning {{never executed}}
+ b:
+ i = 1; // no-warning
+ a:
+ i = 2; // no-warning
+ goto f;
+ e:
+ goto d;
+ f: ;
+}