Avoid two uninitialized warnings from gcc
authorTom Tromey <tom@tromey.com>
Wed, 3 Oct 2018 22:01:12 +0000 (16:01 -0600)
committerTom Tromey <tom@tromey.com>
Thu, 4 Oct 2018 02:55:52 +0000 (20:55 -0600)
This avoids a couple of uninitialized warnings from gcc by
initializing the object in question.  The one in coffread.c seems like
it could be a latent bug.  The one in scm-value.c is harmless, but GCC
can't see that.

gdb/ChangeLog
2018-10-03  Tom Tromey  <tom@tromey.com>

* guile/scm-value.c (gdbscm_value_to_string): Initialize
"buffer_contents".
* coffread.c (coff_symtab_read): Initialize "newobj".

gdb/ChangeLog
gdb/coffread.c
gdb/guile/scm-value.c

index 77531109a42e1aedf16704876be5f17172ab0b0d..d426c88044458d1e3738dda206ecdd369fa224e1 100644 (file)
@@ -1,3 +1,9 @@
+2018-10-03  Tom Tromey  <tom@tromey.com>
+
+       * guile/scm-value.c (gdbscm_value_to_string): Initialize
+       "buffer_contents".
+       * coffread.c (coff_symtab_read): Initialize "newobj".
+
 2018-10-03  Simon Marchi  <simon.marchi@polymtl.ca>
 
        * dwarf2read.c (read_func_scope): Remove struct keyword in
index 81465d63850d0d1c7d92117fdedae0bb87924dea..623467d38bbc0675ea4b6d750b379432bbd18051 100644 (file)
@@ -781,7 +781,7 @@ coff_symtab_read (minimal_symbol_reader &reader,
                  struct objfile *objfile)
 {
   struct gdbarch *gdbarch = get_objfile_arch (objfile);
-  struct context_stack *newobj;
+  struct context_stack *newobj = nullptr;
   struct coff_symbol coff_symbol;
   struct coff_symbol *cs = &coff_symbol;
   static struct internal_syment main_sym;
index 18558605d062a0f362aabeb5d1fcd1c9cbfedb68..ca0c075f5c47bd19053ff93cda640801dedc8eb2 100644 (file)
@@ -966,7 +966,8 @@ gdbscm_value_to_string (SCM self, SCM rest)
   int encoding_arg_pos = -1, errors_arg_pos = -1, length_arg_pos = -1;
   char *encoding = NULL;
   SCM errors = SCM_BOOL_F;
-  gdb_byte *buffer_contents;
+  /* Avoid an uninitialized warning from gcc.  */
+  gdb_byte *buffer_contents = nullptr;
   int length = -1;
   const char *la_encoding = NULL;
   struct type *char_type = NULL;