From f598df61137b16d4b84f413fbad0fd767d73668d Mon Sep 17 00:00:00 2001 From: Pietro Fezzardi Date: Thu, 18 Jan 2024 14:54:22 +0100 Subject: [PATCH] DLA: fix moveEdgeTargetWithoutSumming Before this commit, the method could partly fail in moving the edge target even in legitimate scenarios, because of a bug in how it fixed up the Successors link in the edge source. This commit fixes the bug. --- lib/DataLayoutAnalysis/DLATypeSystem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/DataLayoutAnalysis/DLATypeSystem.cpp b/lib/DataLayoutAnalysis/DLATypeSystem.cpp index 2424e3ebe..9e2c0c4ed 100644 --- a/lib/DataLayoutAnalysis/DLATypeSystem.cpp +++ b/lib/DataLayoutAnalysis/DLATypeSystem.cpp @@ -355,7 +355,7 @@ static void moveEdgeTargetWithoutSumming(LayoutTypeSystemNode *OldTgt, // First, move the successor from OldTgt to NewTgt LayoutTypeSystemNode *Src = InverseEdgeIt->first; - auto SuccHandle = Src->Successors.extract({ Src, InverseEdgeIt->second }); + auto SuccHandle = Src->Successors.extract({ OldTgt, InverseEdgeIt->second }); revng_assert(not SuccHandle.empty()); SuccHandle.value().first = NewTgt; Src->Successors.insert(std::move(SuccHandle));