This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Your dwarf2dbg.c change caused build errors with non-recent gcc
- From: Richard Henderson <rth at redhat dot com>
- To: Hans-Peter Nilsson <hans-peter dot nilsson at axis dot com>
- Cc: binutils at sourceware dot org
- Date: Tue, 20 Sep 2005 14:03:12 -0700
- Subject: Re: Your dwarf2dbg.c change caused build errors with non-recent gcc
- References: <200509202031.j8KKVFKB029469@ignucius.se.axis.com>
On Tue, Sep 20, 2005 at 10:31:15PM +0200, Hans-Peter Nilsson wrote:
> warning: `last_lab' might be used uninitialized in this function
I saw that too, when rebuilding on another machine. I've just fixed it.
At first I thought the warning was about the use at the end of the function,
and thus a do-while loop would fix it, but then I was reminded about the
use in the middle of the loop. I've nonetheless left the do-while, since
there must always be one element in the list.
r~
* dwarf2dbg.c (process_entries): Fix uninitialized variable warning.
Index: dwarf2dbg.c
===================================================================
RCS file: /cvs/src/src/gas/dwarf2dbg.c,v
retrieving revision 1.79
diff -u -p -d -r1.79 dwarf2dbg.c
--- dwarf2dbg.c 20 Sep 2005 18:24:43 -0000 1.79
+++ dwarf2dbg.c 20 Sep 2005 20:59:17 -0000
@@ -1058,10 +1058,10 @@ process_entries (segT seg, struct line_e
unsigned flags = DWARF2_LINE_DEFAULT_IS_STMT ? DWARF2_FLAG_IS_STMT : 0;
fragS *last_frag = NULL, *frag;
addressT last_frag_ofs = 0, frag_ofs;
- symbolS *last_lab, *lab;
+ symbolS *last_lab = NULL, *lab;
struct line_entry *next;
- while (e)
+ do
{
int line_delta;
@@ -1129,6 +1129,7 @@ process_entries (segT seg, struct line_e
free (e);
e = next;
}
+ while (e);
/* Emit a DW_LNE_end_sequence for the end of the section. */
frag = last_frag_for_seg (seg);