From patchwork Mon Aug 12 22:45:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Harmstone X-Patchwork-Id: 1971705 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WjV3b3zzZz1yYC for ; Tue, 13 Aug 2024 08:45:46 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 090023858C5F for ; Mon, 12 Aug 2024 22:45:44 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail.burntcomma.com (mail.burntcomma.com [IPv6:2a02:8012:8cf0:250::6d61:696c]) by sourceware.org (Postfix) with ESMTPS id DECC43858D20 for ; Mon, 12 Aug 2024 22:45:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DECC43858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=harmstone.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=harmstone.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org DECC43858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a02:8012:8cf0:250::6d61:696c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723502728; cv=none; b=ebAKTRnaRttalQykOb2CDNbc8eQc3R3aOsI7DmfGQ7DZms5CcAZ6iYHkDrKxtJBv5r6Sf8cw+txq66C8DIlLKV6RwSVqXoAGNDdA25i2PrmjPfNwGs014SOnfMjMBadvsnQ0hVfZ6ZsPAXshwcUG8sR5D6LwzodpyMp2fdbT1Wo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723502728; c=relaxed/simple; bh=iIvhlqM1/nbPCcHpTWOL9V4dyIX2Qvz/pvYzs8my2QE=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:Mime-Version; b=q01IKSq9sj6JY7mlXsTAaEsrg+9afkP9KXkt83TANVR6QXiV26sjydwBgHo3BHeSrzuF7NE4fG0k2A4NiWKSj5Bc29ppMQiqGF4XUGEk79hS8YsvcRs7KLo5vifUBOTDgEzGdOAhOWfPzEIlEUwcC25N21+alYaX/0Pvc5uNPJc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from localhost.localdomain (beren.burntcomma.com [IPv6:2a02:8012:8cf0:0:b62e:99ff:fee9:ad9f]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) by mail.burntcomma.com (Postfix) with ESMTPSA id E30B341873DF; Mon, 12 Aug 2024 23:45:21 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=harmstone.com; s=mail; t=1723502721; bh=tHXlPiKrVKtnVslPCqdz3asY7tRd5A6dOGzbgIu4kjA=; h=From:To:Cc:Subject:Date; b=svizgOYo8hLD1siuWNWjhNvfJLpGyKeUFVWnQO+kgCq3ujupoxsPZuyumFFKwx58Q yY8ZvzJ8uzbuL0E/F9+JBI5VtQPL91qkH6iO3Gfw2b0M083gqffqp5UrB1rN4pnzTR OtXMvl4n/mDAV5jSbrEEF/vLkzK1PGTyshyFsif8= From: Mark Harmstone To: gcc-patches@gcc.gnu.org Cc: Mark Harmstone Subject: [PATCH] Fix maybe-uninitialized CodeView LF_INDEX warning Date: Mon, 12 Aug 2024 23:45:14 +0100 Message-ID: <20240812224514.29126-1-mark@harmstone.com> Mime-Version: 1.0 X-Spam-Status: No, score=-12.6 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, 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org Initialize last_type to 0 to silence two spurious maybe-uninitialized warnings. We issue an LF_INDEX continuation subtype for any LF_FIELDLISTs that overflow, so LF_INDEXes will always have a subtype preceding them (and thus last_type will always be set). gcc/ * dwarf2codeview.cc (get_type_num_enumeration_type): Initialize last_type to 0. (get_type_num_struct): Likewise. --- gcc/dwarf2codeview.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/dwarf2codeview.cc b/gcc/dwarf2codeview.cc index f7107021bc7..7e4faaa9388 100644 --- a/gcc/dwarf2codeview.cc +++ b/gcc/dwarf2codeview.cc @@ -2448,7 +2448,7 @@ get_type_num_enumeration_type (dw_die_ref type, bool in_struct) dw_die_ref first_child; codeview_custom_type *ct; uint16_t count = 0; - uint32_t last_type; + uint32_t last_type = 0; if (get_AT_flag (type, DW_AT_declaration)) return add_enum_forward_def (type); @@ -2726,7 +2726,7 @@ get_type_num_struct (dw_die_ref type, bool in_struct, bool *is_fwd_ref) dw_die_ref first_child; codeview_custom_type *ct; uint16_t num_members = 0; - uint32_t last_type; + uint32_t last_type = 0; const char *name; if ((in_struct && get_AT_string (type, DW_AT_name))