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 A7F5D3858C27 for ; Mon, 11 Apr 2022 15:18:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A7F5D3858C27 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=seketeli.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=seketeli.org Received: (Authenticated sender: dodji@seketeli.org) by mail.gandi.net (Postfix) with ESMTPSA id 9AED91BF210; Mon, 11 Apr 2022 15:18:33 +0000 (UTC) Received: by localhost (Postfix, from userid 1000) id B107D581C31; Mon, 11 Apr 2022 17:18:32 +0200 (CEST) From: Dodji Seketeli To: Giuliano Procida Cc: Thomas Schwinge , libabigail@sourceware.org, Mark Wielaard Subject: Re: 'src/abg-dwarf-reader.cc:compare_dies_string_attribute_value' optimization Organization: Me, myself and I References: <87wnijv616.fsf@dirichlet.schwinge.homeip.net> <87r18oynpn.fsf@euler.schwinge.homeip.net> X-Operating-System: Fedora 36 X-URL: http://www.seketeli.net/~dodji Date: Mon, 11 Apr 2022 17:18:32 +0200 In-Reply-To: (Giuliano Procida's message of "Mon, 31 Jan 2022 15:56:50 +0000") Message-ID: <877d7vhcmv.fsf@seketeli.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Apr 2022 15:18:39 -0000 Hello Thomas and Giuliano, [...] Thomas Schwinge a =C3=A9crit: [...] >> OK. Then: >> >> (gdb) print l_attr.valp && r_attr.valp >> $8 =3D true >> (gdb) print *l_attr.valp =3D=3D *r_attr.valp >> $9 =3D true >> >> This now does 'return true;'! >> >> Given 'unsigned char *valp', what this only checks is that one byte at >> 'l_attr.valp' equals one byte at 'r_attr.valp' -- which evidently isn't >> sufficient to demonstrate that 'l_attr' and 'r_attr' do match. Therefore >> it seems that this optimization is not correct? >> Giuliano Procida a =C3=A9crit: > Looks like you've found one bug. It has compared addresses and moved on to > test data. > > It could do strcmp at this point, assuming these things are null-terminat= ed > strings, which is the case for DW_FORM_strp but is not for other things. > > But there is another bug. I've instrumented the code and found cases (in > the test suite) where the fast path returns false, but the slow path > returns true. Both sides are DW_FORM_strx1. The data are not strings but > indexes and that the same string appears at different indexes. I agree. This is a bug. I tried to fix and indeed, hell did break lose as I realized there were several other issues across the pipeline (including several issues that I have long wanted to address) that needed so that this one fits in correctly. I came up with a patch set that lies in the branch 'fix-dwarf-str-cmp', at https://sourceware.org/git/?p=3Dlibabigail.git;a=3Dshortlog;h=3Drefs/heads/= fix-dwarf-str-cmp. The tip of that patch set addresses this issue specifically: https://sourceware.org/git/?p=3Dlibabigail.git;a=3Dcommit;h=3D3d277a9cc0587= 3cf4aeb97273d585e0b07af917d. But for that fix to be applied, we need the whole patch set that fixes several other issues left and right. Giuliano & Thomas, could you please test that branch on your specific environments? If it works OK, then I can consider posting the patch-set properly to the list. If it doesn't, at least I'd wouldn't have broken the world without notice ;-) Thanks. --=20 Dodji