From: Tom Tromey Date: Wed, 3 Oct 2018 22:01:12 +0000 (-0600) Subject: Avoid two uninitialized warnings from gcc X-Git-Tag: users/ARM/embedded-binutils-master-2018q4~540 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=875e539851bb2702f3292f819e220545a8776242;p=external%2Fbinutils.git Avoid two uninitialized warnings from gcc 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 * guile/scm-value.c (gdbscm_value_to_string): Initialize "buffer_contents". * coffread.c (coff_symtab_read): Initialize "newobj". --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7753110..d426c88 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2018-10-03 Tom Tromey + + * guile/scm-value.c (gdbscm_value_to_string): Initialize + "buffer_contents". + * coffread.c (coff_symtab_read): Initialize "newobj". + 2018-10-03 Simon Marchi * dwarf2read.c (read_func_scope): Remove struct keyword in diff --git a/gdb/coffread.c b/gdb/coffread.c index 81465d6..623467d 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -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; diff --git a/gdb/guile/scm-value.c b/gdb/guile/scm-value.c index 1855860..ca0c075 100644 --- a/gdb/guile/scm-value.c +++ b/gdb/guile/scm-value.c @@ -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;