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]

[obv] Fix warning: initialize unused field [Re: [commit] [patch] Fix crash on empty DWARF expressions NULL DATA vs. zero SIZE]


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))


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