[cfe-commits] r95048 - in /cfe/trunk: lib/Checker/GRExprEngine.cpp test/Analysis/misc-ps.m

Ted Kremenek kremenek at apple.com
Mon Feb 1 18:01:51 PST 2010


Author: kremenek
Date: Mon Feb  1 20:01:51 2010
New Revision: 95048

URL: http://llvm.org/viewvc/llvm-project?rev=95048&view=rev
Log:
Fix bug in GRExprEngine::VisitSizeOfAlignOfExpr() where we do not add
'Pred' to 'Dst' for cases we currently don't handle.  This fixes
<rdar://problem/7593875>.

Modified:
    cfe/trunk/lib/Checker/GRExprEngine.cpp
    cfe/trunk/test/Analysis/misc-ps.m

Modified: cfe/trunk/lib/Checker/GRExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/GRExprEngine.cpp?rev=95048&r1=95047&r2=95048&view=diff

==============================================================================
--- cfe/trunk/lib/Checker/GRExprEngine.cpp (original)
+++ cfe/trunk/lib/Checker/GRExprEngine.cpp Mon Feb  1 20:01:51 2010
@@ -2461,12 +2461,14 @@
     }
     else if (!T.getTypePtr()->isConstantSizeType()) {
       // FIXME: Add support for VLAs.
+      Dst.Add(Pred);
       return;
     }
     else if (T->isObjCInterfaceType()) {
       // Some code tries to take the sizeof an ObjCInterfaceType, relying that
       // the compiler has laid out its representation.  Just report Unknown
       // for these.
+      Dst.Add(Pred);
       return;
     }
     else {

Modified: cfe/trunk/test/Analysis/misc-ps.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/misc-ps.m?rev=95048&r1=95047&r2=95048&view=diff

==============================================================================
--- cfe/trunk/test/Analysis/misc-ps.m (original)
+++ cfe/trunk/test/Analysis/misc-ps.m Mon Feb  1 20:01:51 2010
@@ -837,3 +837,17 @@
   d = delta[c = (end+=d)[-1]]; // no-warning
   trie = next[c];
 }
+
+//===----------------------------------------------------------------------===//
+// <rdar://problem/7593875> When handling sizeof(VLA) it leads to a hole in
+// the ExplodedGraph (causing a false positive)
+//===----------------------------------------------------------------------===//
+
+int rdar_7593875_aux(int x);
+int rdar_7593875(int n) {
+  int z[n > 10 ? 10 : n]; // VLA.
+  int v;
+  v = rdar_7593875_aux(sizeof(z));
+  // Previously we got a false positive about 'v' being uninitialized.
+  return v; // no-warning
+}





More information about the cfe-commits mailing list