From d97854b0699a0c99ae6fc7f4950084fede00fefc Mon Sep 17 00:00:00 2001 From: bjjwwang Date: Sun, 26 Jan 2025 21:53:28 +1100 Subject: [PATCH] fix asan bug --- svf/include/Graphs/BasicBlockG.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/svf/include/Graphs/BasicBlockG.h b/svf/include/Graphs/BasicBlockG.h index d655e3dd2..ef203f950 100644 --- a/svf/include/Graphs/BasicBlockG.h +++ b/svf/include/Graphs/BasicBlockG.h @@ -138,6 +138,12 @@ class SVFBasicBlock : public GenericBasicBlockNodeTy inline void addSuccBasicBlock(const SVFBasicBlock* succ2) { + // check if the edge already exists + for (auto edge: this->getOutEdges()) { + if (edge->getDstNode() == succ2) + return; + } + SVFBasicBlock* succ = const_cast(succ2); BasicBlockEdge* edge = new BasicBlockEdge(this, succ); this->addOutgoingEdge(edge); @@ -148,6 +154,11 @@ class SVFBasicBlock : public GenericBasicBlockNodeTy inline void addPredBasicBlock(const SVFBasicBlock* pred2) { + // check if the edge already exists + for (auto edge: this->getInEdges()) { + if (edge->getSrcNode() == pred2) + return; + } SVFBasicBlock* pred = const_cast(pred2); BasicBlockEdge* edge = new BasicBlockEdge(pred, this); this->addIncomingEdge(edge);