This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] DWARF-5: Initialization due to a false compiler warning
- From: Jan Kratochvil <jkratoch at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 26 Feb 2017 15:56:29 -0000
- Subject: [binutils-gdb] DWARF-5: Initialization due to a false compiler warning
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a49dd8dd482da6a8131752f8312a06aa6599063c
commit a49dd8dd482da6a8131752f8312a06aa6599063c
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date: Sun Feb 26 16:54:51 2017 +0100
DWARF-5: Initialization due to a false compiler warning
gcc-6.3.1-1.fc25.x86_64
dwarf2read.c: In function â??void create_debug_type_hash_table(dwo_file*, dwarf2_section_info*, htab*&, rcuh_kind)â??:
dwarf2read.c:4776:32: error: â??header.comp_unit_head::type_offset_in_tu.cu_offset::cu_offâ?? may be used uninitialized in this function [-Werror=maybe-uninitialized]
dwarf2read.c:4816:21: error: â??header.comp_unit_head::signatureâ?? may be used uninitialized in this function [-Werror=maybe-uninitialized]
cc1plus: all warnings being treated as errors
gdb/ChangeLog
2017-02-26 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf2read.c (create_debug_type_hash_table): Initialize
header.signature and header.type_offset_in_tu.
Diff:
---
gdb/ChangeLog | 5 +++++
gdb/dwarf2read.c | 4 ++++
2 files changed, 9 insertions(+)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ed697b3..ccfb4e2 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2017-02-26 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * dwarf2read.c (create_debug_type_hash_table): Initialize
+ header.signature and header.type_offset_in_tu.
+
2017-02-24 Pedro Alves <palves@redhat.com>
* symtab.c (make_file_symbol_completion_list_1): Use
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index f119750..40b99d9 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -4728,6 +4728,10 @@ create_debug_type_hash_table (struct dwo_file *dwo_file,
offset.sect_off = ptr - section->buffer;
+ /* Initialize it due to a false compiler warning. */
+ header.signature = -1;
+ header.type_offset_in_tu.cu_off = -1;
+
/* We need to read the type's signature in order to build the hash
table, but we don't need anything else just yet. */