[obv] varobj.c: Fix GCC false warning

Jan Kratochvil
2010-10-17T08:45:52Z

Hi,

CFLAGS=-O0 ./configure --without-python; make
varobj.c: In function ‘value_get_print_value’:
varobj.c:2578:22: error: ‘str_addr’ may be used uninitialized in this function

Reproducible with FSF GCC 4.4, 4.5, HEAD.

Checked in.

Thanks,
Jan

http://sourceware.org/ml/gdb-cvs/2010-10/msg00100.html

--- src/gdb/ChangeLog 2010/10/15 23:08:04 1.12264
+++ src/gdb/ChangeLog 2010/10/17 08:43:45 1.12265
@@ -1,3 +1,8 @@
+2010-10-17 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Fix GCC false warning.
+ * varobj.c (value_get_print_value) <str_addr>: Initialize it.
+
2010-10-16 Pierre Muller <muller@ics.u-strasbg.fr>

* p-typeprint.c (pascal_type_print_method_args): Fix problem in
--- src/gdb/varobj.c 2010/10/15 18:54:13 1.162
+++ src/gdb/varobj.c 2010/10/17 08:43:46 1.163
@@ -2486,7 +2486,8 @@
long len = 0;
char *encoding = NULL;
struct gdbarch *gdbarch = NULL;
- CORE_ADDR str_addr;
+ /* Initialize it just to avoid a GCC false warning. */
+ CORE_ADDR str_addr = 0;
int string_print = 0;

if (value == NULL)