From patchwork Wed Apr 26 12:22:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 68302 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 790C23858C3A for ; Wed, 26 Apr 2023 12:22:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 790C23858C3A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1682511751; bh=aE1uFXwuWtWA8qVcTwJr4/l+OPsgWDcbj1LzH8lcmeo=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Help: List-Subscribe:From:Reply-To:From; b=R8JNvw/94tgEjjOAK49rj+dImAfl5Mv1999CPtnljSjbaBuTqlgcRrqPfoM02ITVy Yq0vuhmw749Zuvw34Yan0/NnN9MsypBhW3hSOxewezoChedPSMEEHAZylJ/AduZ61o 6h7AgzJzE4KlGzJQ/JOK6WYLvEF0xXEYlKvBvL6s= X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id DEBAC3858413 for ; Wed, 26 Apr 2023 12:22:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DEBAC3858413 Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-594-4D8ZSRCXOTq_sCT1yOWh0A-1; Wed, 26 Apr 2023 08:22:24 -0400 X-MC-Unique: 4D8ZSRCXOTq_sCT1yOWh0A-1 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-74dfe945c74so462633985a.3 for ; Wed, 26 Apr 2023 05:22:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682511743; x=1685103743; h=mime-version:user-agent:message-id:date:organization:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=aE1uFXwuWtWA8qVcTwJr4/l+OPsgWDcbj1LzH8lcmeo=; b=b2356ZzJXDSc9NhyWzkJyOElEhuKy8qANdCPcRgFb2TD9TdgHVFUpj70IICsQc5dO2 6aL+p0WZercZhVIwNiz6PriRHGuuHpV8n249vk5Ocj4Vfql/E2i778pGbJ0Q5mZa2CR5 2/Pdg+6l72S5Q2PvFHmSw2PMz2WmTpWP4cLYUtYj7J5/N4+jx7jUB7B/IEdSqYbh+nZh gR0RCkNiV+gUtsTqnLXfu5YM4Twtx+51slkjcjEf37TB/NL0nt6QJdRaNBp/6o+YMRLe 6Ch0LjKlBsFDUipheWNUwgwFYH0jE188lTK3MlZoFm239h9ZCuBqDdilParSSB+q9dYN wk/g== X-Gm-Message-State: AAQBX9d1AyS93NmOSfvz/zYJYDJICDGH1GMn1u5GEaFnfTXQDS4kFJ1p IxlVLKEeDF5vLjqluhTUBibekVJ7kXXC/hiBj6cAeBdtUL3caKmDi+Mn3NkJK65/JA+b+zjFp7E FKmU872Fr7s3XVZnNBeWjZZjpltU7OLvQq9RGlKeclQxx8MHHjaIsEok04lROdimvDPPj7RbN6U cr X-Received: by 2002:a05:622a:2d1:b0:3ee:ec64:e540 with SMTP id a17-20020a05622a02d100b003eeec64e540mr34289247qtx.26.1682511743489; Wed, 26 Apr 2023 05:22:23 -0700 (PDT) X-Google-Smtp-Source: AKy350bUd7Ue7NvgaQO55HqdL9/9+L25QsNJ8mORPB95l3BXRUzjLQ1ftAwhnGmbajUcqcDYC78pwg== X-Received: by 2002:a05:622a:2d1:b0:3ee:ec64:e540 with SMTP id a17-20020a05622a02d100b003eeec64e540mr34289205qtx.26.1682511743118; Wed, 26 Apr 2023 05:22:23 -0700 (PDT) Received: from localhost ([88.120.130.27]) by smtp.gmail.com with ESMTPSA id t18-20020a37aa12000000b007456b51ee13sm5130157qke.16.2023.04.26.05.22.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 05:22:22 -0700 (PDT) Received: by localhost (Postfix, from userid 1000) id 2533BB5078; Wed, 26 Apr 2023 14:22:21 +0200 (CEST) To: libabigail@sourceware.org Subject: [PATCH, applied] comparison: Fix index error when interpreting scope comparison Organization: Red Hat / France X-Operating-System: CentOS Stream release 9 X-URL: http://www.redhat.com Date: Wed, 26 Apr 2023 14:22:21 +0200 Message-ID: <871qk696ki.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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-Patchwork-Original-From: Dodji Seketeli via Libabigail From: Dodji Seketeli Reply-To: Dodji Seketeli Errors-To: libabigail-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libabigail" Hello, While looking at something else, I noticed a thinko in the code in scope_diff::ensure_lookup_tables_populated that interprets the result of the diffing algorithm on the decls of a given scope. Fixed thus. * src/abg-comparison.cc (scope_diff::ensure_lookup_tables_populated): Use the proper index to address the deleted decl. Also, use the range-based for syntax in the enclosing for-loop for more clarity. Signed-off-by: Dodji Seketeli --- src/abg-comparison.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/abg-comparison.cc b/src/abg-comparison.cc index 59530a8a..9c580da2 100644 --- a/src/abg-comparison.cc +++ b/src/abg-comparison.cc @@ -6522,10 +6522,9 @@ scope_diff::ensure_lookup_tables_populated() edit_script& e = priv_->member_changes_; // Populate deleted types & decls lookup tables. - for (vector::const_iterator i = e.deletions().begin(); - i != e.deletions().end(); - ++i) + for (const auto& deletion : e.deletions()) { + unsigned i = deletion.index(); decl_base_sptr decl = deleted_member_at(i); string qname = decl->get_qualified_name(); if (is_type(decl))