for (CFGBlock::const_pred_iterator I = CB->pred_begin(); I != CB->pred_end();
++I) {
// Recurse over all unreachable blocks
- if (!reachable.count((*I)->getBlockID())
- && !visited.count((*I)->getBlockID())) {
- FindUnreachableEntryPoints(*I);
+ if (!reachable.count((*I)->getBlockID())) {
+ // At least one predeccessor was unreachable
allPredecessorsReachable = false;
+
+ // Only visit the block once
+ if (!visited.count((*I)->getBlockID()))
+ FindUnreachableEntryPoints(*I);
}
}
a = 5;
}
+// Check for bugs where multiple statements are reported
+void test9(unsigned a) {
+ switch (a) {
+ if (a) // expected-warning{{never executed}}
+ foo(a + 5); // no-warning
+ else // no-warning
+ foo(a); // no-warning
+ case 1:
+ case 2:
+ break;
+ default:
+ break;
+ }
+}