public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
From: Dodji Seketeli <dodji@redhat.com>
To: libabigail@sourceware.org
Subject: [PATCH, applied] Bug 29977 - dwarf-reader: Fix canonical DIE propagation canceling
Date: Mon, 13 Mar 2023 18:04:10 +0100	[thread overview]
Message-ID: <87h6uooa5x.fsf@redhat.com> (raw)

Hello,

When canceling canonical DIE propagation, we wrongly assume that the
pair of DIEs being compared yield a COMPARE_RESULT_UNKNOWN result.
The reality is that it can also yield a COMPARE_RESULT_DIFFERENT
result, especially when we are looking at the first sub-type that
compares different and that triggered the canonical DIE propagation
canceling to begin with.

This can be reproduced by the command:

$ fedabipkgdiff --self-compare -a --from fc37 xorg-x11-server-Xvfb

Fixed thus.

	* src/abg-dwarf-reader.cc
	(offset_pairs_stack_type::cancel_canonical_propagated_type): The
	result of comparing the canonical-propagated types being canceled
	is either COMPARISON_RESULT_UNKNOWN or
	COMPARISON_RESULT_DIFFERENT.  Also, do not forget to update the
	cached value for the comparison of the depend types too.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
---
 src/abg-dwarf-reader.cc | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc
index 4fdd4390..113dbdcb 100644
--- a/src/abg-dwarf-reader.cc
+++ b/src/abg-dwarf-reader.cc
@@ -5702,12 +5702,23 @@ struct offset_pairs_stack_type
 	  }
 	// Update the cached result.  We know the comparison result
 	// must now be different.
-	auto comp_result_it = rdr_.die_comparison_results_.find(p);
+	auto comp_result_it = rdr_.die_comparison_results_.find(dependant_type);
 	if (comp_result_it != rdr_.die_comparison_results_.end())
-	  {
-	    ABG_ASSERT(comp_result_it->second == COMPARISON_RESULT_UNKNOWN);
-	    comp_result_it->second= COMPARISON_RESULT_DIFFERENT;
-	  }
+	  comp_result_it->second= COMPARISON_RESULT_DIFFERENT;
+      }
+
+    // Update the cached result of the root type to cancel too.
+    auto comp_result_it = rdr_.die_comparison_results_.find(p);
+    if (comp_result_it != rdr_.die_comparison_results_.end())
+      {
+	// At this point, the result of p is either
+	// COMPARISON_RESULT_UNKNOWN (if we cache comparison
+	// results of that kind) or COMPARISON_RESULT_DIFFERENT.
+	// Make sure it's the cached result is now
+	// COMPARISON_RESULT_DIFFERENT.
+	if (comp_result_it->second == COMPARISON_RESULT_UNKNOWN)
+	  comp_result_it->second= COMPARISON_RESULT_DIFFERENT;
+	ABG_ASSERT(comp_result_it->second == COMPARISON_RESULT_DIFFERENT);
       }
 
     if (rdr_.propagated_types_.find(p) != rdr_.propagated_types_.end())
-- 
2.39.2


-- 
		Dodji


                 reply	other threads:[~2023-03-13 17:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h6uooa5x.fsf@redhat.com \
    --to=dodji@redhat.com \
    --cc=libabigail@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).