diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2011-07-17 15:40:56 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2011-07-17 15:40:56 +0000 |
commit | 180abc3db9ae3b4fc63cd65b15697e6ffcc8a657 (patch) | |
tree | 2097d084eb235c0b12c0bff3445f4ec7bbaa8a12 /test/Sema/uninit-variables.c | |
parent | 29cafa66ad3878dbb9f82615f19fa0bded2e443c (diff) |
Notes
Diffstat (limited to 'test/Sema/uninit-variables.c')
-rw-r--r-- | test/Sema/uninit-variables.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/Sema/uninit-variables.c b/test/Sema/uninit-variables.c index b70a29519c411..0caab3df18c04 100644 --- a/test/Sema/uninit-variables.c +++ b/test/Sema/uninit-variables.c @@ -352,3 +352,18 @@ int test52(int a, int b) { } return x; // expected-warning {{variable 'x' may be uninitialized when used here}} } + +// This CFG caused the uninitialized values warning to inf-loop. +extern int PR10379_g(); +void PR10379_f(int *len) { + int new_len; // expected-note {{variable 'new_len' is declared here}} expected-note{{add initialization to silence this warning}} + for (int i = 0; i < 42 && PR10379_g() == 0; i++) { + if (PR10379_g() == 1) + continue; + if (PR10379_g() == 2) + PR10379_f(&new_len); + else if (PR10379_g() == 3) + PR10379_f(&new_len); + *len += new_len; // expected-warning {{variable 'new_len' may be uninitialized when used here}} + } +} |