From: Dodji Seketeli <dodji@seketeli.org>
To: libabigail@sourceware.org
Subject: [PATCH, applied] fix comparing array subrange DIEs
Date: Sun, 01 Jan 2023 18:34:17 +0100 [thread overview]
Message-ID: <87edsema5i.fsf@seketeli.org> (raw)
Hello,
When looking at something else in the DWARF reader, I noticed that the
DIE comparison algorithm for DW_TAG_subprogram DIEs was not taking
into account non-set DW_AT_upper_bound attributes.
Fixed thus.
* src/abg-dwarf-reader.cc (compare_dies): For DW_TAG_subprogram,
non-set DW_AT_{lower,upper}_bound is not the same as when they are
set to zero.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
---
src/abg-dwarf-reader.cc | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc
index d2848a30..e3a1348d 100644
--- a/src/abg-dwarf-reader.cc
+++ b/src/abg-dwarf-reader.cc
@@ -10933,8 +10933,14 @@ compare_dies(const reader& rdr,
{
uint64_t l_lower_bound = 0, r_lower_bound = 0,
l_upper_bound = 0, r_upper_bound = 0;
- die_unsigned_constant_attribute(l, DW_AT_lower_bound, l_lower_bound);
- die_unsigned_constant_attribute(r, DW_AT_lower_bound, r_lower_bound);
+ bool l_lower_bound_set = false, r_lower_bound_set = false,
+ l_upper_bound_set = false, r_upper_bound_set = false;
+
+ l_lower_bound_set =
+ die_unsigned_constant_attribute(l, DW_AT_lower_bound, l_lower_bound);
+ r_lower_bound_set =
+ die_unsigned_constant_attribute(r, DW_AT_lower_bound, r_lower_bound);
+
if (!die_unsigned_constant_attribute(l, DW_AT_upper_bound,
l_upper_bound))
{
@@ -10942,10 +10948,14 @@ compare_dies(const reader& rdr,
if (die_unsigned_constant_attribute(l, DW_AT_count, l_count))
{
l_upper_bound = l_lower_bound + l_count;
+ l_upper_bound_set = true;
if (l_upper_bound)
--l_upper_bound;
}
}
+ else
+ l_upper_bound_set = true;
+
if (!die_unsigned_constant_attribute(r, DW_AT_upper_bound,
r_upper_bound))
{
@@ -10953,12 +10963,17 @@ compare_dies(const reader& rdr,
if (die_unsigned_constant_attribute(l, DW_AT_count, r_count))
{
r_upper_bound = r_lower_bound + r_count;
+ r_upper_bound_set = true;
if (r_upper_bound)
--r_upper_bound;
}
}
+ else
+ r_upper_bound_set = true;
- if ((l_lower_bound != r_lower_bound)
+ if ((l_lower_bound_set != r_lower_bound_set)
+ || (l_upper_bound_set != r_upper_bound_set)
+ || (l_lower_bound != r_lower_bound)
|| (l_upper_bound != r_upper_bound))
SET_RESULT_TO_FALSE(result, l, r);
}
--
2.39.0
--
Dodji
reply other threads:[~2023-01-01 17:34 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=87edsema5i.fsf@seketeli.org \
--to=dodji@seketeli.org \
--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).