]> granicus.if.org Git - clang/commitdiff
Add test case for <rdar://problem/12075238>, which recently got fixed by changes...
authorTed Kremenek <kremenek@apple.com>
Fri, 7 Sep 2012 19:09:51 +0000 (19:09 +0000)
committerTed Kremenek <kremenek@apple.com>
Fri, 7 Sep 2012 19:09:51 +0000 (19:09 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163406 91177308-0d34-0410-b5e6-96231b3b80d8

test/Analysis/misc-ps.c

index 8ff710b12f56f38239778f815d84b4ac5a8c26d9..ef89321fff6ccce7981f92b2693721ed16f63309 100644 (file)
@@ -133,3 +133,21 @@ int isctype(char c, unsigned long f)
   return (c < 1 || c > 10) ? 0 : !!(c & f);
 }
 
+// Test that symbolic array offsets are modeled conservatively.
+// This was triggering a false "use of uninitialized value" warning.
+void rdar_12075238__aux(unsigned long y);
+int rdar_12075238_(unsigned long count) {
+  if ((count < 3) || (count > 6))
+    return 0;
+       
+  unsigned long array[6];
+  unsigned long i = 0;
+  for (; i <= count - 2; i++)
+  {
+         array[i] = i;
+  }
+  array[count - 1] = i;
+  rdar_12075238__aux(array[2]); // no-warning
+  return 0;
+}
+