From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::228]) by sourceware.org (Postfix) with ESMTPS id 6C8F23858C50 for ; Sun, 1 Jan 2023 17:34:19 +0000 (GMT) Received: (Authenticated sender: dodji@seketeli.org) by mail.gandi.net (Postfix) with ESMTPSA id 33CB91BF206 for ; Sun, 1 Jan 2023 17:34:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seketeli.org; s=gm1; t=1672594458; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=yvqvvLjsm9EjIDhb3cDgJ7GPZeaZaHTqU3bDsnuP6v4=; b=dtBdZY7rXIqDzOe2AfT5iaKhoAAmvZEOjh41+UCvXiVFNKSXp5KBztQO/Jm+UvU5yFas4a a88jhly7aky6o3CQGxG6ZTUwCR07kItNyiIebRcld3FKD82aeVXo3B1vAQnIlO42809jug dVIrThStKnmaVmrvfonLrV3PmeMEXRN3llVQFj2ZZv/z+ll+9/x177I3rEKWsYDF4zsV2H R7hdg5FBqId1AMbfSdLQG/KOboiiszuDoX+NEezoOAvuzmhcprXYJx+nCYcmRZz549ykNe OODsbfUXmb9Y66r05BNbPJ4vo5uDYv7Qb1e7VZUwd0yhHoDrE7Aotd0ZuKGmNA== Received: by localhost (Postfix, from userid 1000) id AAC9F581C59; Sun, 1 Jan 2023 18:34:17 +0100 (CET) From: Dodji Seketeli To: libabigail@sourceware.org Subject: [PATCH, applied] fix comparing array subrange DIEs Organization: Me, myself and I X-Operating-System: Fedora 38 X-URL: http://www.seketeli.net/~dodji Date: Sun, 01 Jan 2023 18:34:17 +0100 Message-ID: <87edsema5i.fsf@seketeli.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-10.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,JMQ_SPF_NEUTRAL,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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 --- 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