From f45b7069722e61ba4ddec1e7eae490ffe1a61ea5 Mon Sep 17 00:00:00 2001 From: Andrea Gussoni Date: Tue, 17 Jun 2025 11:02:51 +0200 Subject: [PATCH] RestructureCFG: fail when retreating not to head Introduce decompilation failure when not all the retreatings of a `Region` point to the elected head node. --- lib/RestructureCFG/RestructureCFG.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/RestructureCFG/RestructureCFG.cpp b/lib/RestructureCFG/RestructureCFG.cpp index dd78a54b9..d3fcdfca5 100644 --- a/lib/RestructureCFG/RestructureCFG.cpp +++ b/lib/RestructureCFG/RestructureCFG.cpp @@ -773,7 +773,13 @@ bool restructureCFG(Function &F, ASTTree &AST) { // retreating edges in the `ContinueBackedges` set, checking that they // point to the `Entry` node for (EdgeDescriptor R : Retreatings) { - revng_assert(R.second == Entry); + + // The following should be an assert, but since the backend is in + // maintenance mode, we have an early return to propagate an early + // failure + if (not(R.second == Entry)) + return false; + ContinueBackedges.push_back(R); } }