[llvm-branch-commits] [cfe-branch] r119414 - in /cfe/branches/Apple/whitney: lib/Analysis/CFG.cpp test/Analysis/misc-ps.m
Daniel Dunbar
daniel at zuster.org
Tue Nov 16 16:23:22 PST 2010
Author: ddunbar
Date: Tue Nov 16 18:23:21 2010
New Revision: 119414
URL: http://llvm.org/viewvc/llvm-project?rev=119414&view=rev
Log:
Merge r119284:
--
Author: Ted Kremenek <kremenek at apple.com>
Date: Mon Nov 15 22:59:22 2010 +0000
Remove invalid assertion from CFG builder. When building the CFG pieces for a ternary '?' expression,
it is possible for the confluence block to only have a single predecessor due to calls to 'noreturn'
functions. Fixes assertion failure reported in PR 8619.
Modified:
cfe/branches/Apple/whitney/lib/Analysis/CFG.cpp
cfe/branches/Apple/whitney/test/Analysis/misc-ps.m
Modified: cfe/branches/Apple/whitney/lib/Analysis/CFG.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/Analysis/CFG.cpp?rev=119414&r1=119413&r2=119414&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/Analysis/CFG.cpp (original)
+++ cfe/branches/Apple/whitney/lib/Analysis/CFG.cpp Tue Nov 16 18:23:21 2010
@@ -1149,7 +1149,8 @@
// want the first predecessor to the the block containing the expression
// for the case when the ternary expression evaluates to true.
AddSuccessor(Block, ConfluenceBlock);
- assert(ConfluenceBlock->pred_size() == 2);
+ // Note that there can possibly only be one predecessor if one of the
+ // subexpressions resulted in calling a noreturn function.
std::reverse(ConfluenceBlock->pred_begin(),
ConfluenceBlock->pred_end());
}
Modified: cfe/branches/Apple/whitney/test/Analysis/misc-ps.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/test/Analysis/misc-ps.m?rev=119414&r1=119413&r2=119414&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/test/Analysis/misc-ps.m (original)
+++ cfe/branches/Apple/whitney/test/Analysis/misc-ps.m Tue Nov 16 18:23:21 2010
@@ -1203,3 +1203,12 @@
return func();
}
+// PR 8619 - Handle ternary expressions with a call to a noreturn function.
+// This previously resulted in a crash.
+void pr8619_noreturn(int x) __attribute__((noreturn));
+
+void pr8619(int a, int b, int c) {
+ a ?: pr8619_noreturn(b || c);
+}
+
+
More information about the llvm-branch-commits
mailing list