[applied] Bug 29901 - abidiff hangs when comparing libgs.so.10 with itself

Message ID 871qoudr5t.fsf@redhat.com
State New
Headers
Series [applied] Bug 29901 - abidiff hangs when comparing libgs.so.10 with itself |

Commit Message

Dodji Seketeli Dec. 20, 2022, 3:35 p.m. UTC
  Hello,

This is a follow-up patch to this one:
    88c6e080 Bug 29857 - Better detect comparison cycles in type graph

When looking at the type comparison stack, it looks like a type that
is on the left-hand side of the comparison can appear on the
right-hand side later, in the comparison stack.  The cycle detection
algorithm doesn't take that scenario into account and so that cycle in
the graph of types being compared is not detected.

This patch takes that case into account.

	* src/abg-ir-priv.h (environment::priv::comparison_started): Look
	for each operand of the comparison in both the right-hand and
	left-hand operand stacks.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Applied to the master branch of the git repository.
---
 src/abg-ir-priv.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
  

Patch

diff --git a/src/abg-ir-priv.h b/src/abg-ir-priv.h
index ae6fabd7..b216c957 100644
--- a/src/abg-ir-priv.h
+++ b/src/abg-ir-priv.h
@@ -1246,8 +1246,9 @@  struct class_or_union::priv
     const environment& env = first.get_environment();
 
     return (env.priv_->left_classes_being_compared_.count(&first)
-	    ||
-	    env.priv_->right_classes_being_compared_.count(&second));
+	    || env.priv_->right_classes_being_compared_.count(&second)
+	    || env.priv_->right_classes_being_compared_.count(&first)
+	    || env.priv_->left_classes_being_compared_.count(&second));
   }
 
   /// Test if a pair of class_or_union is being currently compared.