]> granicus.if.org Git - clang/commitdiff
Fix PR 4033: the analyzer shouldn't crash on computed gotos involving symbolic
authorTed Kremenek <kremenek@apple.com>
Thu, 23 Apr 2009 17:49:43 +0000 (17:49 +0000)
committerTed Kremenek <kremenek@apple.com>
Thu, 23 Apr 2009 17:49:43 +0000 (17:49 +0000)
target addresses.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69900 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/GRExprEngine.cpp
test/Analysis/misc-ps.m

index 4db00d2a6b0080edf52d472c81e66c2ca34f3297..5a3f9871f778f75d26d65c0fa62b0d840242ce8e 100644 (file)
@@ -763,8 +763,7 @@ void GRExprEngine::ProcessIndirectGoto(IndirectGotoNodeBuilder& builder) {
   }
   
   // This is really a catch-all.  We don't support symbolics yet.
-  
-  assert (V.isUnknown());
+  // FIXME: Implement dispatch for symbolic pointers.
   
   for (iterator I=builder.begin(), E=builder.end(); I != E; ++I)
     builder.generateNode(I, state);
index ec0e95a465db7a22eceeeef90fd859def29e779d..005109fb734f7afb39bb6ebef6b4d5ce036faef3 100644 (file)
@@ -249,7 +249,6 @@ void rdar_6777003(int x) {
 // regardless of how well the underlying StoreManager reasons about pointer
 // arithmetic.
 // <rdar://problem/6777209>
-
 void rdar_6777209(char *p) {
   if (p == 0)
     return;
@@ -260,3 +259,16 @@ void rdar_6777209(char *p) {
   if (p == 0)
     *p = 'c'; // no-warning
 }
+
+// PR 4033.  A symbolic 'void *' pointer can be used as the address for a
+// computed goto.
+typedef void *Opcode;
+Opcode pr_4033_getOpcode();
+void pr_4033(void) {
+next_opcode:
+  {
+    Opcode op = pr_4033_getOpcode();
+    if (op) goto *op;
+  }
+}
+