From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by sourceware.org (Postfix) with ESMTPS id A6FC43858C1F for ; Wed, 30 Aug 2023 19:13:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A6FC43858C1F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 9411E21220 for ; Wed, 30 Aug 2023 19:13:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1693422786; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QO/+uytjHvazUgJ1JUodYmlWjc5bwDUncfzbzueVLf0=; b=uQYryGIz2j0hRpmM36+5uWwhmWhFIfVm+OoY/5pPJeU6DxdgbdKP/huwKhMQf9JwLjVu4c tvTOzy8WD9OikEVqnPnhGb0jk+6KMwTxwLZBsxGPluaDADgmBZUbwunt5U8QkzbHr/rbCq kcaDXvBS5uvMQuTFpOYh/gjiTtFSJgc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1693422786; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QO/+uytjHvazUgJ1JUodYmlWjc5bwDUncfzbzueVLf0=; b=DYx1p0+U17uqrSU6ISQIaimukqoME0Uxuj8/2p6bdKK4tWSZUvp6mbbU/+kRfXaPffHzSX kdj5vaDw76a+VsDw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 77E611353E for ; Wed, 30 Aug 2023 19:13:06 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id uAw9HMKU72Q2IQAAMHmgww (envelope-from ) for ; Wed, 30 Aug 2023 19:13:06 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH 3/6] [gdb/symtab] Do more zero-initialization of type::fields Date: Wed, 30 Aug 2023 21:13:33 +0200 Message-Id: <20230830191336.15885-3-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230830191336.15885-1-tdevries@suse.de> References: <20230830191336.15885-1-tdevries@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,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: Now that we've introduced type::{alloc_fields,copy_fields}, the places where no zero-initialization of allocated fields is done are easy to spot: ... $ find gdb* -type f | grep -v ChangeLog | xargs grep alloc_fields | grep false gdb/coffread.c: type->alloc_fields (nfields, false); gdb/coffread.c: type->alloc_fields (nsyms, false); gdb/stabsread.c: ftype->alloc_fields (nsemi, false); gdb/gdbtypes.c: resolved_type->alloc_fields (nfields, false); gdb/gdbtypes.c: alloc_fields (nfields, false); gdb/gdbtypes.c: alloc_fields (nfields, false); gdb/mdebugread.c: t->alloc_fields (nfields, false); gdb/mdebugread.c: ftype->alloc_fields (nparams, false); ... All hits in gdbtypes.c are ok. There are two hits in the two variants of copy_fields, and there's already a comment for the third. AFAICT, the other ones are not, so fix those by dropping the "false" argument. Tested on x86_64-linux. --- gdb/coffread.c | 4 ++-- gdb/mdebugread.c | 4 ++-- gdb/stabsread.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gdb/coffread.c b/gdb/coffread.c index e132dd1a1f7..e251f110ff8 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -2032,7 +2032,7 @@ coff_read_struct_type (int index, int length, int lastsym, } /* Now create the vector of fields, and record how big it is. */ - type->alloc_fields (nfields, false); + type->alloc_fields (nfields); /* Copy the saved-up fields into the field vector. */ @@ -2110,7 +2110,7 @@ coff_read_enum_type (int index, int length, int lastsym, else /* Assume ints. */ type->set_length (gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT); type->set_code (TYPE_CODE_ENUM); - type->alloc_fields (nsyms, false); + type->alloc_fields (nsyms); /* Find the symbols for the values and put them into the type. The symbols can be found in the symlist that we put them on diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index 688501e157a..ad9967b75fa 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -1034,7 +1034,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, t->set_code (type_code); t->set_length (sh->value); - t->alloc_fields (nfields, false); + t->alloc_fields (nfields); if (type_code == TYPE_CODE_ENUM) { @@ -1195,7 +1195,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, if (nparams > 0) { - ftype->alloc_fields (nparams, false); + ftype->alloc_fields (nparams); iparams = 0; for (struct symbol *sym : block_iterator_range (cblock)) diff --git a/gdb/stabsread.c b/gdb/stabsread.c index c29d1c0d397..ad9258a9f20 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -982,7 +982,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, } /* Allocate parameter information fields and fill them in. */ - ftype->alloc_fields (nsemi, false); + ftype->alloc_fields (nsemi); while (*p++ == ';') { struct type *ptype; -- 2.35.3