[cfe-commits] r113953 - in /cfe/trunk: lib/Analysis/CFG.cpp test/Analysis/misc-ps.m
Ted Kremenek
kremenek at apple.com
Wed Sep 15 00:01:21 PDT 2010
Author: kremenek
Date: Wed Sep 15 02:01:20 2010
New Revision: 113953
URL: http://llvm.org/viewvc/llvm-project?rev=113953&view=rev
Log:
Relax assertion in CFG builder when processing ForStmts. This fixes an assertion failure
on code containing GNU statement expressions reported in PR 8141.
Modified:
cfe/trunk/lib/Analysis/CFG.cpp
cfe/trunk/test/Analysis/misc-ps.m
Modified: cfe/trunk/lib/Analysis/CFG.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFG.cpp?rev=113953&r1=113952&r2=113953&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/CFG.cpp (original)
+++ cfe/trunk/lib/Analysis/CFG.cpp Wed Sep 15 02:01:20 2010
@@ -991,7 +991,8 @@
if (Stmt* C = F->getCond()) {
Block = ExitConditionBlock;
EntryConditionBlock = addStmt(C);
- assert(Block == EntryConditionBlock);
+ assert(Block == EntryConditionBlock ||
+ (Block == 0 && EntryConditionBlock == Succ));
// If this block contains a condition variable, add both the condition
// variable and initializer to the CFG.
Modified: cfe/trunk/test/Analysis/misc-ps.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/misc-ps.m?rev=113953&r1=113952&r2=113953&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/misc-ps.m (original)
+++ cfe/trunk/test/Analysis/misc-ps.m Wed Sep 15 02:01:20 2010
@@ -1129,3 +1129,9 @@
}
@end
+// PR 8149 - GNU statement expression in condition of ForStmt.
+// This previously triggered an assertion failure in CFGBuilder.
+void pr8149(void) {
+ for (; ({ do { } while (0); 0; });) { }
+}
+
More information about the cfe-commits
mailing list