From: Ted Kremenek Date: Fri, 7 Sep 2012 19:09:51 +0000 (+0000) Subject: Add test case for , which recently got fixed by changes... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c957319941e93db2bc399efa7a9d1425bc609ba9;p=clang Add test case for , which recently got fixed by changes to RegionStore. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163406 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/Analysis/misc-ps.c b/test/Analysis/misc-ps.c index 8ff710b12f..ef89321fff 100644 --- a/test/Analysis/misc-ps.c +++ b/test/Analysis/misc-ps.c @@ -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; +} +