From patchwork Wed Dec 4 14:48:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 36509 Received: (qmail 45237 invoked by alias); 4 Dec 2019 14:49:00 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 45097 invoked by uid 89); 4 Dec 2019 14:48:45 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=upgraded, HContent-Transfer-Encoding:8bit X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 04 Dec 2019 14:48:44 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 065D5116D2C; Wed, 4 Dec 2019 09:48:38 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id wMftm+8NpWCM; Wed, 4 Dec 2019 09:48:37 -0500 (EST) Received: from murgatroyd.Home (97-118-104-188.hlrn.qwest.net [97.118.104.188]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPSA id B7937116D25; Wed, 4 Dec 2019 09:48:37 -0500 (EST) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [FYI] Silence maybe-uninitialized warning in dwarf2read.c Date: Wed, 4 Dec 2019 07:48:35 -0700 Message-Id: <20191204144835.16690-1-tromey@adacore.com> MIME-Version: 1.0 I upgraded to Fedora 30 recently. It includes GCC 9, which gives a warning for dwarf2read.c: ../../binutils-gdb/gdb/dwarf2read.c:16103:24: warning: ‘discr_offset’ may be used uninitialized in this function [-Wmaybe-uninitialized] This patch fixes the problem by initializing discr_offset. Tested by rebuilding. gdb/ChangeLog 2019-12-04 Tom Tromey * dwarf2read.c (process_structure_scope): Initialize "discr_offset". Change-Id: I76a6157921c9beacb641b8a41e10026006621b95 --- gdb/ChangeLog | 5 +++++ gdb/dwarf2read.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 327837cc3c8..f99061d40db 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -16060,7 +16060,7 @@ process_structure_scope (struct die_info *die, struct dwarf2_cu *cu) read the discriminant member, so we can record it later in the discriminant_info. */ bool is_variant_part = TYPE_FLAG_DISCRIMINATED_UNION (type); - sect_offset discr_offset; + sect_offset discr_offset {}; bool has_template_parameters = false; if (is_variant_part)