Skip to content

Commit 977289e

Browse files
authored
[clang][dataflow] Remove buggy assertion. (#67311)
The assertion fails on the test TransferTest.EvaluateBlockWithUnreachablePreds (which I think, ironically, was introuced in the same patch as the assertion). This just wasn't obvious because the assertion is inside an `LLVM_DEBUG` block and is thus only executed if the command-line flag `-debug` is passed. We don't have any CI builds that do this, so it's almost guaranteed that assertions like this will start failing over time (if they ever passed in the first place -- which I'm not sure about here). It's not clear to me whether there's _some_ assertion we might be able to make here -- I've looked at this for a while but haven't been able to come up with anything obvious. For the time being, I think it's best to simply delete the assertion.
1 parent 2fda200 commit 977289e

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

clang/lib/Analysis/FlowSensitive/Transfer.cpp

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,8 @@ const Environment *StmtToEnvMap::getEnvironment(const Stmt &S) const {
4343
if (!CFCtx.isBlockReachable(*BlockIt->getSecond()))
4444
return nullptr;
4545
const auto &State = BlockToState[BlockIt->getSecond()->getBlockID()];
46-
if (!(State)) {
47-
LLVM_DEBUG({
48-
// State can be null when this block is unreachable from the block that
49-
// called this method.
50-
bool hasUnreachableEdgeFromPred = false;
51-
for (auto B : BlockIt->getSecond()->preds())
52-
if (!B) {
53-
hasUnreachableEdgeFromPred = true;
54-
break;
55-
}
56-
assert(hasUnreachableEdgeFromPred);
57-
});
46+
if (!(State))
5847
return nullptr;
59-
}
6048
return &State->Env;
6149
}
6250

0 commit comments

Comments
 (0)