]> granicus.if.org Git - clang/commitdiff
r141345 also fixed a -Wuninitialized bug where loop conditions were not always flagge...
authorTed Kremenek <kremenek@apple.com>
Fri, 7 Oct 2011 00:52:56 +0000 (00:52 +0000)
committerTed Kremenek <kremenek@apple.com>
Fri, 7 Oct 2011 00:52:56 +0000 (00:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141346 91177308-0d34-0410-b5e6-96231b3b80d8

test/Sema/uninit-variables.c

index bcffbd6a3d503075843b52a7fe4d91214dcba38c..f716124bcbbb86d1da519a728c6ec2f9b158c7ef 100644 (file)
@@ -404,4 +404,10 @@ void PR11069(int a, int b) {
   }
 }
 
+// Test uninitialized value used in loop condition.
+void rdar9432305(float *P) {
+  int i; // expected-note {{initialize the variable 'i' to silence this warning}}
+  for (; i < 10000; ++i) // expected-warning {{variable 'i' is uninitialized when used here}}
+    P[i] = 0.0f;
+}