From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id 8E3BC3834408 for ; Thu, 18 Feb 2021 13:04:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8E3BC3834408 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tdevries@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 9E276ACE5; Thu, 18 Feb 2021 13:04:20 +0000 (UTC) Subject: [committed] Add assert in partition_found_dups From: Tom de Vries To: dwz@sourceware.org, jakub@redhat.com, mark@klomp.org References: <20210216091146.GA32276@delia> Message-ID: <37c5db79-d36e-cbaa-c02e-1afe79f073aa@suse.de> Date: Thu, 18 Feb 2021 14:04:19 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: <20210216091146.GA32276@delia> Content-Type: multipart/mixed; boundary="------------A27C105A58B4A587ADA001BD" Content-Language: en-US X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: dwz@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Dwz mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 13:04:23 -0000 This is a multi-part message in MIME format. --------------A27C105A58B4A587ADA001BD Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit [ was: Re: [PATCH] Fix CK_BAD propagation for --odr ] On 2/16/21 10:11 AM, Tom de Vries wrote: > We can catch the problem of the checksum much earlier, with an assert: > ... > static void > partition_found_dups (dw_die_ref die, struct obstack *vec) > { > + assert (die->die_ck_state == CK_KNOWN); > ... Committed assert for now. Thanks, - Tom --------------A27C105A58B4A587ADA001BD Content-Type: text/x-patch; charset=UTF-8; name="0001-Add-assert-in-partition_found_dups.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="0001-Add-assert-in-partition_found_dups.patch" Add assert in partition_found_dups With the reproducer from PR26252 we get: ... $ dwz -m 3 --odr 1 2 dwz: 1: DWARF compression not beneficial - old size 317760 new size 317760 dwz: dwz.c:12431: write_die: \ Assertion `value && refdcu->cu_kind != CU_ALT' failed. Aborted (core dumped) ... The assertion fails when writing out the contribution of file 2 to the multifile. It's trying to write out a copy of this DIE: ... <3><9f3e>: Abbrev Number: 149 (DW_TAG_subprogram) <9f40> DW_AT_name : _M_access > <9f44> DW_AT_decl_file : 11 <9f45> DW_AT_decl_line : 92 <9f46> DW_AT_decl_column : 7 <9f47> DW_AT_type : <0x1a2a5> <9f4b> DW_AT_declaration : 1 <9f4b> DW_AT_object_pointer: <0x9f5c> <9f4f> DW_AT_sibling : <0x9f62> ... and specifically, for the DW_AT_type attribute it attempts to write out the reference to the copy of the DIE at 0x1a2a5: ... <1><1a2a5>: Abbrev Number: 9 (DW_TAG_reference_type) <1a2a6> DW_AT_byte_size : 8 <1a2a7> DW_AT_type : <0x27cd9> ... There is no copy of that DIE, because it has a bad checksum: ... 1a2a5 X d27b2f2a d27b2f2a reference_type (type: 27cd9 structure_type) ... which means that its toplevel DIE 0x9edc: ... <2><9edc>: Abbrev Number: 182 (DW_TAG_union_type) <9ede> DW_AT_name : _Any_data ... should also have a bad checksum, but it doesn't: ... 9edc O 9d6524b4 9d6524b4 _Any_data union_type ... while without --odr, it does: ... 9edc X d8f947f3 5100c9e1 _Any_data union_type ... Add an assert partition_found_dups such that we can catch the problem of the checksum much earlier: ... static void partition_found_dups (dw_die_ref die, struct obstack *vec) { + assert (die->die_ck_state == CK_KNOWN); ... which means we can reproduce with just one file: ... $ dwz 2 --odr dwz: dwz.c:7372: partition_found_dups: \ Assertion `die->die_ck_state == CK_KNOWN' failed. Aborted (core dumped) ... 2021-02-18 Tom de Vries * dwz.c (partition_found_dups): Assert that die->die_ck_state == CK_KNOWN. --- dwz.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dwz.c b/dwz.c index d037e1e..0b751fc 100644 --- a/dwz.c +++ b/dwz.c @@ -7393,6 +7393,7 @@ partition_cmp (const void *p, const void *q) static void partition_found_dups (dw_die_ref die, struct obstack *vec) { + assert (die->die_ck_state == CK_KNOWN); obstack_ptr_grow (vec, die); if (unlikely (verify_dups_p)) verify_dups (die, true); --------------A27C105A58B4A587ADA001BD--