diff options
author | dim <dim@FreeBSD.org> | 2011-07-17 15:40:56 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2011-07-17 15:40:56 +0000 |
commit | 611ba3ea3300b71eb95dc4e45f20eee5dddd32e1 (patch) | |
tree | 2097d084eb235c0b12c0bff3445f4ec7bbaa8a12 /test/Sema/uninit-variables.c | |
parent | c49018d9cce52d8c9f34b44865ec3ba8e89a1488 (diff) | |
download | FreeBSD-src-611ba3ea3300b71eb95dc4e45f20eee5dddd32e1.zip FreeBSD-src-611ba3ea3300b71eb95dc4e45f20eee5dddd32e1.tar.gz |
Vendor import of clang trunk r135360:
http://llvm.org/svn/llvm-project/cfe/trunk@135360
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 b70a295..0caab3d 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}} + } +} |