public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 2/2, RFC] dwarf-reader: Don't propagate canonical type upon aggregate redundancy
@ 2022-02-28  9:40 Dodji Seketeli
  2022-03-04 10:53 ` Dodji Seketeli
  0 siblings, 1 reply; 2+ messages in thread
From: Dodji Seketeli @ 2022-02-28  9:40 UTC (permalink / raw)
  To: gprocida; +Cc: libabigail

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/2, RFC] dwarf-reader: Don't propagate canonical type upon aggregate redundancy
  2022-02-28  9:40 [PATCH 2/2, RFC] dwarf-reader: Don't propagate canonical type upon aggregate redundancy Dodji Seketeli
@ 2022-03-04 10:53 ` Dodji Seketeli
  0 siblings, 0 replies; 2+ messages in thread
From: Dodji Seketeli @ 2022-03-04 10:53 UTC (permalink / raw)
  To: Dodji Seketeli via Libabigail; +Cc: gprocida, Dodji Seketeli

Dodji Seketeli via Libabigail <libabigail@sourceware.org> a écrit:

[...]

> 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>

Applied to master for now.

I'll work on a more global solution, similarly to what's done in the IR
canonicalizer soon.

Cheers,

-- 
		Dodji

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-03-04 10:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-28  9:40 [PATCH 2/2, RFC] dwarf-reader: Don't propagate canonical type upon aggregate redundancy Dodji Seketeli
2022-03-04 10:53 ` Dodji Seketeli

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).