public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
From: Dodji Seketeli <dodji@redhat.com>
To: gprocida@gmail.com
Cc: libabigail@sourceware.org
Subject: [PATCH 2/2, RFC] dwarf-reader: Don't propagate canonical type upon aggregate redundancy
Date: Mon, 28 Feb 2022 10:40:39 +0100	[thread overview]
Message-ID: <87sfs3jpm0.fsf@redhat.com> (raw)

Hello Giuliano,

This comes from trying to fix
https://sourceware.org/bugzilla/show_bug.cgi?id=26646.

During DIE comparison for the purpose of DIE canonicalization, we need
to detect a loop due to a recurring aggregate comparison.  Thus, the
compare_dies function returns true in when it detects that it's
comparing two aggregate that are already being compared.  In that
situation of "detected aggregate redundancy", even though the
comparison seemingly succeeds, no canonical type propagation should
happen.

This patch prevents canonical type propagation when compare_dies
return true to signal aggregate redundancy detection.

This addresses https://sourceware.org/bugzilla/show_bug.cgi?id=26646#c21.

	* src/abg-dwarf-reader.cc (compare_dies): Do not propagate
	canonical type when aggregate redundancy is detected.

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

diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc
index 05a7e4d6..58f0607e 100644
--- a/src/abg-dwarf-reader.cc
+++ b/src/abg-dwarf-reader.cc
@@ -10240,6 +10240,7 @@ compare_dies(const read_context& ctxt,
     return l_canonical_die_offset == r_canonical_die_offset;
 
   bool result = true;
+  bool aggregate_redundancy_detected = false;
 
   switch (l_tag)
     {
@@ -10353,7 +10354,11 @@ compare_dies(const read_context& ctxt,
       {
 	if (has_offset_pair(aggregates_being_compared,
 			    die_offset(l), die_offset(r)))
-	  result = true;
+	  {
+	    result = true;
+	    aggregate_redundancy_detected = true;
+	    break;
+	  }
 	else if (!compare_as_decl_dies(l, r) || !compare_as_type_dies(l, r))
 	  result = false;
 	else
@@ -10481,6 +10486,7 @@ compare_dies(const read_context& ctxt,
 			    die_offset(r)))
 	  {
 	    result = true;
+	    aggregate_redundancy_detected = true;
 	    break;
 	  }
 	else if (l_tag == DW_TAG_subroutine_type)
@@ -10676,6 +10682,7 @@ compare_dies(const read_context& ctxt,
     }
 
   if (result == true
+      && !aggregate_redundancy_detected
       && update_canonical_dies_on_the_fly
       && is_canonicalizeable_type_tag(l_tag))
     {
-- 
2.35.0.rc2


-- 
		Dodji


             reply	other threads:[~2022-02-28  9:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-28  9:40 Dodji Seketeli [this message]
2022-03-04 10:53 ` Dodji Seketeli

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=87sfs3jpm0.fsf@redhat.com \
    --to=dodji@redhat.com \
    --cc=gprocida@gmail.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).