public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: gdb-patches@sourceware.org
Subject: [obv] varobj.c: Fix GCC false warning
Date: Sun, 17 Oct 2010 08:45:00 -0000	[thread overview]
Message-ID: <20101017084541.GA32723@host1.dyn.jankratochvil.net> (raw)

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)

             reply	other threads:[~2010-10-17  8:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-17  8:45 Jan Kratochvil [this message]
2010-10-17 10:02 ` Andreas Schwab
2010-10-17 11:54   ` [patch] varobj.c: Reset string_print [Re: [obv] varobj.c: Fix GCC false warning] Jan Kratochvil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101017084541.GA32723@host1.dyn.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).