diff options
author | Ted Kremenek <kremenek@apple.com> | 2011-01-18 04:53:25 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2011-01-18 04:53:25 +0000 |
commit | c104e53639de4424b83955acfadc977773b5883d (patch) | |
tree | d8f8af9af06230eba1ff1f990e321ddf5c9a2915 /test/Sema/uninit-variables.c | |
parent | 8691e0ba6c1f4b72d1b65224304773647950c644 (diff) |
Teach UninitializedValuesV2 about "int x = x" and
also properly handle confluence of loops.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123733 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/uninit-variables.c')
-rw-r--r-- | test/Sema/uninit-variables.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/Sema/uninit-variables.c b/test/Sema/uninit-variables.c index c2d98c40fe..51e66759e0 100644 --- a/test/Sema/uninit-variables.c +++ b/test/Sema/uninit-variables.c @@ -85,4 +85,20 @@ int test13() { return i; // no-warning } +// Simply don't crash on this test case. +void test14() { + const char *p = 0; + for (;;) {} +} + +void test15() { + int x = x; // expected-warning{{use of uninitialized variable 'x'}} +} +// Don't warn in the following example; shows dataflow confluence. +char *test16_aux(); +void test16() { + char *p = test16_aux(); + for (unsigned i = 0 ; i < 100 ; i++) + p[i] = 'a'; // no-warning +} |