Bug 29901 - abidiff hangs when comparing libgs.so.10 with itself
authorDodji Seketeli <dodji@redhat.com>
Tue, 20 Dec 2022 15:06:33 +0000 (16:06 +0100)
committerDodji Seketeli <dodji@redhat.com>
Tue, 20 Dec 2022 15:30:52 +0000 (16:30 +0100)
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>
src/abg-ir-priv.h

index ae6fabd762e77f4e7fe16c335d325666f5de0f9b..b216c957e3cb61242a04c9dec406642c708b21df 100644 (file)
@@ -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.