Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Yao Qi <yao@codesourcery.com>
Cc: gdb-patches@sourceware.org
Subject: [obv] Fix warning: initialize unused field  [Re: [commit] [patch] Fix crash on empty DWARF expressions NULL DATA vs. zero SIZE]
Date: Thu, 13 Oct 2011 09:38:00 -0000	[thread overview]
Message-ID: <20111013093755.GA14109@host1.jankratochvil.net> (raw)
In-Reply-To: <4E969B83.1030404@codesourcery.com>

On Thu, 13 Oct 2011 10:04:19 +0200, Yao Qi wrote:
> Jan,
> This patch causes a build failure,
[...]
> ../../src/gdb/dwarf2read.c:14204: error: ‘retval.data’ may be used uninitialized in this function

Interesting gcc-4.6.1-10.fc16.x86_64 does not give me the error, even with
-O2.

Checked in.


Thanks,
Jan


http://sourceware.org/ml/gdb-cvs/2011-10/msg00108.html

--- src/gdb/ChangeLog	2011/10/13 08:16:42	1.13429
+++ src/gdb/ChangeLog	2011/10/13 09:36:45	1.13430
@@ -1,3 +1,8 @@
+2011-10-13  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* dwarf2read.c (dwarf2_fetch_die_location_block): Initialize .data even
+	if .size is 0.
+
 2011-10-13  Yao Qi  <yao@codesourcery.com>
 
 	PR gdb/12703
--- src/gdb/dwarf2read.c	2011/10/12 22:04:11	1.572
+++ src/gdb/dwarf2read.c	2011/10/13 09:36:47	1.573
@@ -14217,8 +14217,10 @@
   attr = dwarf2_attr (die, DW_AT_location, cu);
   if (!attr)
     {
-      /* DWARF: "If there is no such attribute, then there is no effect.".  */
+      /* DWARF: "If there is no such attribute, then there is no effect.".
+	 DATA is ignored if SIZE is 0.  */
 
+      retval.data = NULL;
       retval.size = 0;
     }
   else if (attr_form_is_section_offset (attr))


      reply	other threads:[~2011-10-13  9:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-13 17:03 [patch] Fix crash on empty DWARF expressions NULL DATA vs. zero SIZE Jan Kratochvil
2011-10-12 22:04 ` [commit] " Jan Kratochvil
2011-10-13  8:05   ` Yao Qi
2011-10-13  9:38     ` Jan Kratochvil [this message]

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=20111013093755.GA14109@host1.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=yao@codesourcery.com \
    /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