[cfe-commits] r74743 - in /cfe/trunk: lib/AST/CFG.cpp test/Analysis/misc-ps.m

Ted Kremenek kremenek at apple.com
Thu Jul 2 17:10:50 PDT 2009


Author: kremenek
Date: Thu Jul  2 19:10:50 2009
New Revision: 74743

URL: http://llvm.org/viewvc/llvm-project?rev=74743&view=rev
Log:
Fix a horrible CFG bug reported in <rdar://problem/7027684>. The wrong successor
block would get hooked up in some cases when processing empty compound
statements.

Modified:
    cfe/trunk/lib/AST/CFG.cpp
    cfe/trunk/test/Analysis/misc-ps.m

Modified: cfe/trunk/lib/AST/CFG.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/CFG.cpp?rev=74743&r1=74742&r2=74743&view=diff

==============================================================================
--- cfe/trunk/lib/AST/CFG.cpp (original)
+++ cfe/trunk/lib/AST/CFG.cpp Thu Jul  2 19:10:50 2009
@@ -556,7 +556,7 @@
 
 CFGBlock* CFGBuilder::VisitCompoundStmt(CompoundStmt* C) {
   
-  CFGBlock* LastBlock = NULL;
+  CFGBlock* LastBlock = Block;
 
   for (CompoundStmt::reverse_body_iterator I=C->body_rbegin(), E=C->body_rend();
                                                                I != E; ++I ) {

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

==============================================================================
--- cfe/trunk/test/Analysis/misc-ps.m (original)
+++ cfe/trunk/test/Analysis/misc-ps.m Thu Jul  2 19:10:50 2009
@@ -284,3 +284,15 @@
   return 0;  
 }
 
+// Test for <rdar://problem/7027684>.  This just tests that the CFG is
+// constructed correctly.  Previously, the successor block of the entrance
+// was the block containing the merge for '?', which would trigger an
+// assertion failure.
+int rdar_7027684_aux();
+int rdar_7027684_aux_2() __attribute__((noreturn));
+void rdar_7027684(int x, int y) {
+  {}; // this empty compound statement is critical.
+  (rdar_7027684_aux() ? rdar_7027684_aux_2() : (void) 0);
+}
+
+





More information about the cfe-commits mailing list