[applied] Fix DWARF type DIE canonicalization

Message ID 878s435e5w.fsf@redhat.com
State Committed
Headers
Series [applied] Fix DWARF type DIE canonicalization |

Commit Message

Dodji Seketeli May 25, 2021, 9:57 a.m. UTC
  Hello,

While looking at something else, I noticed that the DWARF type DIE
canonicalization code wasn't taking the type of array elements into
account when comparing arrays.

This patch fixes that.

	* src/abg-dwarf-reader.cc (compare_dies): When comparing array
	type DIEs, take into account the type of the elements of the
	arrays.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>

Applied to master.

---
 src/abg-dwarf-reader.cc | 10 ++++++++++
 1 file changed, 10 insertions(+)
  

Patch

diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc
index dd9d689c..735a4b48 100644
--- a/src/abg-dwarf-reader.cc
+++ b/src/abg-dwarf-reader.cc
@@ -10247,6 +10247,16 @@  compare_dies(const read_context& ctxt,
 	  }
 	if (found_l_child != found_r_child)
 	  result = false;
+	// Compare the types of the elements of the array.
+	Dwarf_Die ltype_die, rtype_die;
+	bool found_ltype = die_die_attribute(l, DW_AT_type, ltype_die);
+	bool found_rtype = die_die_attribute(r, DW_AT_type, rtype_die);
+	ABG_ASSERT(found_ltype && found_rtype);
+
+	if (!compare_dies(ctxt, &ltype_die, &rtype_die,
+			  aggregates_being_compared,
+			  update_canonical_dies_on_the_fly))
+	  return false;
       }
       break;