xref: /llvm-project/clang/test/Analysis/no-exit-cfg.c (revision d937836ead34030f4ac016a8eb8a179bd5be10f3)
1 // RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.core -verify %s
2 // RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.core -analyzer-config cfg-scopes=true -verify %s
3 // expected-no-diagnostics
4 
5 // This is a test case for the issue reported in PR 2819:
6 //  http://llvm.org/bugs/show_bug.cgi?id=2819
7 // The flow-sensitive dataflow solver should work even when no block in
8 // the CFG reaches the exit block.
9 
10 int g(int x);
11 void h(int x);
12 
f(int x)13 int f(int x)
14 {
15 out_err:
16   if (g(x)) {
17     h(x);
18   }
19   goto out_err;
20 }
21