DWARF-5: Initialization due to a false compiler warning
authorJan Kratochvil <jan.kratochvil@redhat.com>
Sun, 26 Feb 2017 15:54:51 +0000 (16:54 +0100)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Sun, 26 Feb 2017 15:54:51 +0000 (16:54 +0100)
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.

gdb/ChangeLog
gdb/dwarf2read.c

index ed697b372c8ab8bc150b2647a40f63ee9a018d4a..ccfb4e23c94f43cebbcc53ec8849c02c01effbc3 100644 (file)
@@ -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
index f1197509727c75e7e30253eb303f90555d814aa7..40b99d9cca0e34f45482a9febfd7d0413b3d3991 100644 (file)
@@ -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.  */