summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/misc-ps.c
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/Analysis/misc-ps.c')
-rw-r--r--clang/test/Analysis/misc-ps.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/test/Analysis/misc-ps.c b/clang/test/Analysis/misc-ps.c
index 8a36efb9950..f81b0ddc68d 100644
--- a/clang/test/Analysis/misc-ps.c
+++ b/clang/test/Analysis/misc-ps.c
@@ -111,3 +111,18 @@ struct rdar10385775 {
void RDar10385775(struct rdar10385775* p) {
p->name = L"a";
}
+
+// Test double loop of array and array literals. Previously this
+// resulted in a false positive uninitailized value warning.
+void rdar10686586() {
+ int array1[] = { 1, 2, 3, 0 };
+ int array2[] = { 1, 2, 3, 0 };
+ int *array[] = { array1, array2 };
+ int sum = 0;
+ for (int i = 0; i < 2; i++) {
+ for (int j = 0; j < 4; j++) {
+ sum += array[i][j]; // no-warning
+ }
+ }
+}
+
OpenPOWER on IntegriCloud