Silence maybe-uninitialized warning in dwarf2read.c
authorTom Tromey <tromey@adacore.com>
Wed, 4 Dec 2019 14:46:59 +0000 (07:46 -0700)
committerTom Tromey <tromey@adacore.com>
Wed, 4 Dec 2019 14:48:44 +0000 (07:48 -0700)
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  <tromey@adacore.com>

* dwarf2read.c (process_structure_scope): Initialize
"discr_offset".

Change-Id: I76a6157921c9beacb641b8a41e10026006621b95

gdb/ChangeLog
gdb/dwarf2read.c

index aacc0c9b16c8b4e768c12475e608a17725f16055..f27043da0e42b9f3b628635472f9544a506dbc89 100644 (file)
@@ -1,3 +1,8 @@
+2019-12-04  Tom Tromey  <tromey@adacore.com>
+
+       * dwarf2read.c (process_structure_scope): Initialize
+       "discr_offset".
+
 2019-12-04  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * mi/mi-symbol-cmds.c (mi_symbol_info): Take extra parameter, and
index 327837cc3c83434291590f1c18e983b561d73d46..f99061d40db0246bff701467b3ddd19beca431d1 100644 (file)
@@ -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)