forked from OSchip/llvm-project
[analyzer] Fix PR11282 - an assert in markAsSink
This is another fallout from the refactoring. We were calling MarkAsSink on a cached out node. (Fixes radar://10376675) llvm-svn: 143516
This commit is contained in:
parent
bfb3520fc5
commit
9e82c62222
|
@ -393,7 +393,7 @@ public:
|
|||
const CFGBlock *dstT, const CFGBlock *dstF)
|
||||
: NodeBuilder(SrcNode, DstSet, C), DstT(dstT), DstF(dstF),
|
||||
InFeasibleTrue(!DstT), InFeasibleFalse(!DstF) {
|
||||
// The Banch node builder does not generate autotransitions.
|
||||
// The branch node builder does not generate autotransitions.
|
||||
// If there are no successors it means that both branches are infeasible.
|
||||
takeNodes(SrcNode);
|
||||
}
|
||||
|
|
|
@ -389,6 +389,7 @@ public:
|
|||
|
||||
void clear() { Impl.clear(); }
|
||||
void insert(const ExplodedNodeSet &S) {
|
||||
assert(&S != this);
|
||||
if (empty())
|
||||
Impl = S.Impl;
|
||||
else
|
||||
|
|
|
@ -546,14 +546,17 @@ ExplodedNode* NodeBuilder::generateNodeImpl(const ProgramPoint &Loc,
|
|||
ExplodedNode *N = C.Eng.G->getNode(Loc, State, &IsNew);
|
||||
N->addPredecessor(FromN, *C.Eng.G);
|
||||
Frontier.erase(FromN);
|
||||
assert(IsNew || N->isSink() == MarkAsSink);
|
||||
|
||||
if (!IsNew)
|
||||
return 0;
|
||||
|
||||
if (MarkAsSink)
|
||||
N->markAsSink();
|
||||
|
||||
if (IsNew && !MarkAsSink)
|
||||
else
|
||||
Frontier.Add(N);
|
||||
|
||||
return (IsNew ? N : 0);
|
||||
return N;
|
||||
}
|
||||
|
||||
StmtNodeBuilder::~StmtNodeBuilder() {
|
||||
|
|
|
@ -106,3 +106,17 @@ static int radar10367606(int t) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Caching out on a sink node. */
|
||||
extern int fooR10376675();
|
||||
extern int* bazR10376675();
|
||||
extern int nR10376675;
|
||||
void barR10376675(int *x) {
|
||||
int *pm;
|
||||
if (nR10376675 * 2) {
|
||||
int *pk = bazR10376675();
|
||||
pm = pk; //expected-warning {{never read}}
|
||||
}
|
||||
do {
|
||||
*x = fooR10376675();
|
||||
} while (0);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue