public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [commit] Fix build error due to uninitialized variable warning
@ 2015-08-03 12:43 Ulrich Weigand
  0 siblings, 0 replies; only message in thread
From: Ulrich Weigand @ 2015-08-03 12:43 UTC (permalink / raw)
  To: gdb-patches; +Cc: derodat

Hello,

as of commit a5fdf78a4402341a0ae23a5ca8a63825e2b5286c, building GDB with
a GCC 4.1 host compiler fails with:
    
gdb/cp-namespace.c: In function 'cp_lookup_symbol_via_imports':
gdb/cp-namespace.c:482: warning: 'sym.block' may be used uninitialized in this function
    
Apparently, more recent compilers are able to deduce that no actual
uninitialized use of sym.block takes place, but GCC 4.1 isn't yet
able to do that.
    
Fixed by adding an explicit initalization.

Bye,
Ulrich

ChangeLog:

    	* cp-namespace.c (cp_lookup_symbol_via_imports): Fix uninitialized
    	variable warning with some compilers.

diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index aa29c92..f5f4bad 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -485,6 +485,7 @@ cp_lookup_symbol_via_imports (const char *scope,
   struct cleanup *searched_cleanup;
 
   sym.symbol = NULL;
+  sym.block = NULL;
 
   /* First, try to find the symbol in the given namespace if requested.  */
   if (search_scope_first)
-- 
  Dr. Ulrich Weigand
  GNU/Linux compilers and toolchain
  Ulrich.Weigand@de.ibm.com

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-08-03 12:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-03 12:43 [commit] Fix build error due to uninitialized variable warning Ulrich Weigand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).