From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 8AA893858401 for ; Mon, 28 Feb 2022 09:40:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8AA893858401 Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-187-7cyGhRygP7GuZCbL9GwQGg-1; Mon, 28 Feb 2022 04:40:49 -0500 X-MC-Unique: 7cyGhRygP7GuZCbL9GwQGg-1 Received: by mail-wr1-f72.google.com with SMTP id a11-20020adffb8b000000b001efe754a488so355083wrr.13 for ; Mon, 28 Feb 2022 01:40:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:organization:date:message-id :user-agent:mime-version; bh=7nHS6lVHnK9ZC2FIOhmnvRc4Zr6srfkkuh96nMhGRwA=; b=7iBKDhfywUwiFL5TLkwxrjS27++YxU4emEyZwX7pAye1GNsW4qJeXxA8nBmPPf2zyg UAUjyfiAzkVoC5uMp+EG+GX0uiJKLuSUgVnaj7OyT/IxTBSZmv6nJFoaMySXDZg4Qep0 K4XPDZifROn4dugsRvD72NI11Iz9GTz9tGxFcQxO34XBmD+03Ld2+I106n/xEfIp/Wrd fsEIdlhyKtMnlxpR67l2K7DlvuToOcN7oMo3b1tSg8+T/idSWpSQDQgtytE/TNp6dYNn 7rtlttg3VpUrD12SYcOvevHNNyxf7mRYMmWi2j6B6rU4yFdrgb/fWdnuUCm1QUdxjfq8 YqhQ== X-Gm-Message-State: AOAM5336awZsJZyS7F/dm+L5oFazcRyv6XJv63sNfkKlCacTHA4qN5vj 8FfEZN0VK9gJ2BqUEyBu5023tB89Jr/RRW1ZFoqJwHseDUIqgKr4jHV4IVSCTz4ThJgWjY7LX3B PxEctydzpM8A/NgD9I0lU X-Received: by 2002:a05:600c:27cb:b0:381:400d:3bba with SMTP id l11-20020a05600c27cb00b00381400d3bbamr11179435wmb.60.1646041247759; Mon, 28 Feb 2022 01:40:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJxLPUwZ06OCo2w1Iz+n4+BQOIhOf/s1zb27E2SmQwJKGihyoZSZ8tzhzyJBMgLuSAubXTaBYw== X-Received: by 2002:a05:600c:27cb:b0:381:400d:3bba with SMTP id l11-20020a05600c27cb00b00381400d3bbamr11179422wmb.60.1646041247559; Mon, 28 Feb 2022 01:40:47 -0800 (PST) Received: from localhost ([88.120.130.27]) by smtp.gmail.com with ESMTPSA id k7-20020adfb347000000b001e595adb6d9sm10447457wrd.79.2022.02.28.01.40.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Feb 2022 01:40:47 -0800 (PST) Received: by localhost (Postfix, from userid 1000) id EAFFC5802BD; Mon, 28 Feb 2022 10:40:39 +0100 (CET) From: Dodji Seketeli To: gprocida@gmail.com Cc: libabigail@sourceware.org Subject: [PATCH 2/2, RFC] dwarf-reader: Don't propagate canonical type upon aggregate redundancy Organization: Red Hat / France X-Operating-System: Fedora 36 X-URL: http://www.redhat.com Date: Mon, 28 Feb 2022 10:40:39 +0100 Message-ID: <87sfs3jpm0.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-12.2 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_LOW, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham 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, 28 Feb 2022 09:40:55 -0000 Hello Giuliano, This comes from trying to fix https://sourceware.org/bugzilla/show_bug.cgi?id=26646. During DIE comparison for the purpose of DIE canonicalization, we need to detect a loop due to a recurring aggregate comparison. Thus, the compare_dies function returns true in when it detects that it's comparing two aggregate that are already being compared. In that situation of "detected aggregate redundancy", even though the comparison seemingly succeeds, no canonical type propagation should happen. This patch prevents canonical type propagation when compare_dies return true to signal aggregate redundancy detection. This addresses https://sourceware.org/bugzilla/show_bug.cgi?id=26646#c21. * src/abg-dwarf-reader.cc (compare_dies): Do not propagate canonical type when aggregate redundancy is detected. Signed-off-by: Dodji Seketeli --- src/abg-dwarf-reader.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc index 05a7e4d6..58f0607e 100644 --- a/src/abg-dwarf-reader.cc +++ b/src/abg-dwarf-reader.cc @@ -10240,6 +10240,7 @@ compare_dies(const read_context& ctxt, return l_canonical_die_offset == r_canonical_die_offset; bool result = true; + bool aggregate_redundancy_detected = false; switch (l_tag) { @@ -10353,7 +10354,11 @@ compare_dies(const read_context& ctxt, { if (has_offset_pair(aggregates_being_compared, die_offset(l), die_offset(r))) - result = true; + { + result = true; + aggregate_redundancy_detected = true; + break; + } else if (!compare_as_decl_dies(l, r) || !compare_as_type_dies(l, r)) result = false; else @@ -10481,6 +10486,7 @@ compare_dies(const read_context& ctxt, die_offset(r))) { result = true; + aggregate_redundancy_detected = true; break; } else if (l_tag == DW_TAG_subroutine_type) @@ -10676,6 +10682,7 @@ compare_dies(const read_context& ctxt, } if (result == true + && !aggregate_redundancy_detected && update_canonical_dies_on_the_fly && is_canonicalizeable_type_tag(l_tag)) { -- 2.35.0.rc2 -- Dodji