This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

* linespec.c (decode_dollar): Avoid "may be used uninitialized" warning.


Hi.  I'm not sure how you want to fix this.

cc1: warnings being treated as errors
../../src/gdb/linespec.c: In function 'decode_dollar':
../../src/gdb/linespec.c:2549: error: 'values.nelts' may be used uninitialized in this function
../../src/gdb/linespec.c:2549: error: 'values.sals' may be used uninitialized in this function
make[2]: *** [linespec.o] Error 1


2011-12-06  Doug Evans  <dje@google.com>

	* linespec.c (decode_dollar): Avoid "may be used uninitialized" warning.

Index: linespec.c
===================================================================
RCS file: /cvs/src/src/gdb/linespec.c,v
retrieving revision 1.132
diff -u -p -r1.132 linespec.c
--- linespec.c	6 Dec 2011 18:54:39 -0000	1.132
+++ linespec.c	6 Dec 2011 19:31:19 -0000
@@ -2494,6 +2494,10 @@ decode_dollar (struct linespec_state *se
 
       volatile struct gdb_exception exc;
 
+      /* Avoid "may be used uninitialized" warning.  */
+      values.sals = NULL;
+      values.nelts = 0;
+
       TRY_CATCH (exc, RETURN_MASK_ERROR)
 	{
 	  values = decode_variable (self, copy);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]