diff options
author | Ted Kremenek <kremenek@apple.com> | 2011-03-15 03:17:01 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2011-03-15 03:17:01 +0000 |
commit | f3f5379f6da7f8f141a53e2945871a5aa5431e02 (patch) | |
tree | 83458af8a20b1a6da651251fa97f1f2c4fbb06ae /test/Sema/uninit-variables.c | |
parent | 853134a0ba349a78e92b8a4a935cb5860fcc3a04 (diff) |
Remove old UninitializedValues analysis.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127656 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/uninit-variables.c')
-rw-r--r-- | test/Sema/uninit-variables.c | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/test/Sema/uninit-variables.c b/test/Sema/uninit-variables.c index 973e504f63..bb29552901 100644 --- a/test/Sema/uninit-variables.c +++ b/test/Sema/uninit-variables.c @@ -260,3 +260,71 @@ int test38(int r, int x, int y) return ((r < 0) || ((r == 0) && (x < y))); } +int test39(int x) { + int y; // expected-note {{variable 'y' is declared here}} expected-note{{add initialization to silence this warning}} + int z = x + y; // expected-warning {{variable 'y' is possibly uninitialized when used here}} + return z; +} + + +int test40(int x) { + int y; // expected-note {{variable 'y' is declared here}} expected-note{{add initialization to silence this warning}} + return x ? 1 : y; // expected-warning {{variable 'y' is possibly uninitialized when used here}} +} + +int test41(int x) { + int y; // expected-note {{variable 'y' is declared here}} expected-note{{add initialization to silence this warning}} + if (x) y = 1; // no-warning + return y; // expected-warning {{variable 'y' is possibly uninitialized when used here}} +} + +void test42() { + int a; + a = 30; // no-warning +} + +void test43_aux(int x); +void test43(int i) { + int x; // expected-note {{variable 'x' is declared here}} expected-note{{add initialization to silence this warning}} + for (i = 0 ; i < 10; i++) + test43_aux(x++); // expected-warning {{variable 'x' is possibly uninitialized when used here}} +} + +void test44(int i) { + int x = i; + int y; // expected-note {{variable 'y' is declared here}} expected-note{{add initialization to silence this warning}} + for (i = 0; i < 10; i++ ) { + test43_aux(x++); // no-warning + x += y; // expected-warning {{variable 'y' is possibly uninitialized when used here}} + } +} + +int test45(int j) { + int x = 1, y = x + 1; + if (y) // no-warning + return x; + return y; +} + +void test46() +{ + int i; // expected-note {{variable 'i' is declared here}} expected-note{{add initialization to silence this warning}} + int j = i ? : 1; // expected-warning {{variable 'i' is possibly uninitialized when used here}} +} + +void *test47(int *i) +{ + return i ? : 0; // no-warning +} + +void *test49(int *i) +{ + int a; + return &a ? : i; // no-warning +} + +void test50() +{ + char c[1 ? : 2]; // no-warning +} + |