This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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]

Your dwarf2dbg.c change caused build errors with non-recent gcc


I guess your gcc is recent; 4.x-ish.  The one at my autotester
is still old and not so smart:

gcc -DHAVE_CONFIG_H -I. -I/h/hp/binutils/cvs_latest/src/gas -I. -D_GNU_SOURCE -I. -I/h/hp/binutils/cvs_latest/src/gas -I../bfd -I/h/hp/binutils/cvs_latest/src/gas/config -I/h/hp/binutils/cvs_latest/src/gas/../include -I/h/hp/binutils/cvs_latest/src/gas/.. -I/h/hp/binutils/cvs_latest/src/gas/../bfd -I/h/hp/binutils/cvs_latest/src/gas/../intl -I../intl -DLOCALEDIR="\"/usr/local/share/locale\""   -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -c /h/hp/binutils/cvs_latest/src/gas/dwarf2dbg.c
cc1: warnings being treated as errors
/h/hp/binutils/cvs_latest/src/gas/dwarf2dbg.c: In function `process_entries':
/h/hp/binutils/cvs_latest/src/gas/dwarf2dbg.c:1061: warning: `last_lab' might be used uninitialized in this function
make[3]: *** [dwarf2dbg.o] Error 1

Data flow here isn't *that* trivial (you have to read the whole
function to see that the warning isn't pointing to a bug).  An
explicit initialization will help future changes.

I'll apply this obvious patch when I get to my keys:

	* dwarf2dbg.c (process_entries): Explicitly initialise last_lab to
	NULL.

Index: dwarf2dbg.c
===================================================================
RCS file: /cvs/src/src/gas/dwarf2dbg.c,v
retrieving revision 1.79
diff -u -p -r1.79 dwarf2dbg.c
--- dwarf2dbg.c	20 Sep 2005 18:24:43 -0000	1.79
+++ dwarf2dbg.c	20 Sep 2005 19:50:48 -0000
@@ -1058,7 +1058,9 @@ 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;
+  /* Silence "might be used uninitialized" warnings from older gcc.  */
+  symbolS *last_lab = NULL;
+  symbolS *lab;
   struct line_entry *next;
 
   while (e)


brgds, H-P


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