public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [OB] dwarf2read.c: fix build error
@ 2010-08-13  3:21 Hui Zhu
  2010-08-13 15:45 ` Tom Tromey
  0 siblings, 1 reply; 2+ messages in thread
From: Hui Zhu @ 2010-08-13  3:21 UTC (permalink / raw)
  To: gdb-patches ml

Hi,

I got some error with cvs-head:
gcc -g -O2   -I. -I../../src/gdb -I../../src/gdb/common
-I../../src/gdb/config -DLOCALEDIR="\"/usr/local/share/locale\""
-DHAVE_CONFIG_H -I../../src/gdb/../include/opcode
-I../../src/gdb/../opcodes/.. -I../../src/gdb/../readline/.. -I../bfd
-I../../src/gdb/../bfd -I../../src/gdb/../include -I../libdecnumber
-I../../src/gdb/../libdecnumber  -I../../src/gdb/gnulib -Ignulib
-DMI_OUT=1 -DTUI=1  -DGDBTK -I/usr/include -I/usr/include  -Wall
-Wdeclaration-after-statement -Wpointer-arith -Wformat-nonliteral
-Wno-pointer-sign -Wno-unused -Wunused-value -Wunused-function
-Wno-switch -Wno-char-subscripts -Werror -c -o dwarf2read.o -MT
dwarf2read.o -MMD -MP -MF .deps/dwarf2read.Tpo
../../src/gdb/dwarf2read.c
cc1: warnings being treated as errors
../../src/gdb/dwarf2read.c: In function 'load_full_comp_unit':
../../src/gdb/dwarf2read.c:7977: warning: 'back_to' may be used
uninitialized in this function
../../src/gdb/dwarf2read.c:7977: note: 'back_to' was declared here
make[2]: *** [dwarf2read.o] Error 1


gcc -g -O2   -I. -I../../src/gdb -I../../src/gdb/common
-I../../src/gdb/config -DLOCALEDIR="\"/usr/local/share/locale\""
-DHAVE_CONFIG_H -I../../src/gdb/../include/opcode
-I../../src/gdb/../opcodes/.. -I../../src/gdb/../readline/.. -I../bfd
-I../../src/gdb/../bfd -I../../src/gdb/../include -I../libdecnumber
-I../../src/gdb/../libdecnumber  -I../../src/gdb/gnulib -Ignulib
-DMI_OUT=1 -DTUI=1  -DGDBTK -I/usr/include -I/usr/include  -Wall
-Wdeclaration-after-statement -Wpointer-arith -Wformat-nonliteral
-Wno-pointer-sign -Wno-unused -Wunused-value -Wunused-function
-Wno-switch -Wno-char-subscripts -Werror -c -o dwarf2read.o -MT
dwarf2read.o -MMD -MP -MF .deps/dwarf2read.Tpo
../../src/gdb/dwarf2read.c
cc1: warnings being treated as errors
../../src/gdb/dwarf2read.c: In function 'find_partial_die':
../../src/gdb/dwarf2read.c:3250: warning: 'free_cu_cleanup' may be
used uninitialized in this function
../../src/gdb/dwarf2read.c:3250: note: 'free_cu_cleanup' was declared here
make[2]: *** [dwarf2read.o] Error 1



  if (this_cu->cu == NULL)
    {
      cu = alloc_one_comp_unit (objfile);

      read_cu = 1;

      /* If an error occurs while loading, release our storage.  */
      free_cu_cleanup = make_cleanup (free_one_comp_unit, cu);

  if (read_cu)
    {
      /* We've successfully allocated this compilation unit.  Let our
	 caller clean it up when finished with it.  */
      discard_cleanups (free_cu_cleanup);
    }


  if (cu->dwarf2_abbrevs == NULL)
    {
      dwarf2_read_abbrevs (cu->objfile->obfd, cu);
      back_to = make_cleanup (dwarf2_free_abbrev_table, cu);
      read_abbrevs = 1;
    }

  if (read_abbrevs)
    do_cleanups (back_to);

So I checked in a patch to fix them.

BTW, I got this error because my gcc is too old?


Thanks,
Hui

2010-08-13  Hui Zhu  <teawater@gmail.com>

	* dwarf2read.c (load_partial_comp_unit): Initialize free_cu_cleanup.
	(read_comp_unit): Initialize back_to.

===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.436
retrieving revision 1.437
diff -u -r1.436 -r1.437
--- src/gdb/dwarf2read.c	2010/08/12 19:55:38	1.436
+++ src/gdb/dwarf2read.c	2010/08/13 03:14:03	1.437
@@ -3247,7 +3247,7 @@
   gdb_byte *info_ptr, *beg_of_comp_unit;
   struct die_info *comp_unit_die;
   struct dwarf2_cu *cu;
-  struct cleanup *free_abbrevs_cleanup, *free_cu_cleanup;
+  struct cleanup *free_abbrevs_cleanup, *free_cu_cleanup = NULL;
   struct attribute *attr;
   int has_children;
   struct die_reader_specs reader_specs;
@@ -7974,7 +7974,7 @@
 {
   struct die_reader_specs reader_specs;
   int read_abbrevs = 0;
-  struct cleanup *back_to;
+  struct cleanup *back_to = NULL;
   struct die_info *die;

   if (cu->dwarf2_abbrevs == NULL)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [OB] dwarf2read.c: fix build error
  2010-08-13  3:21 [OB] dwarf2read.c: fix build error Hui Zhu
@ 2010-08-13 15:45 ` Tom Tromey
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2010-08-13 15:45 UTC (permalink / raw)
  To: Hui Zhu; +Cc: gdb-patches ml

>>>>> ">" == Hui Zhu <teawater@gmail.com> writes:

>> BTW, I got this error because my gcc is too old?

Or just a different version, anyway.  These warnings are dependent on
gcc's optimizations, so version or even option changes can affect the
output.

Tom

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-08-13 15:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-13  3:21 [OB] dwarf2read.c: fix build error Hui Zhu
2010-08-13 15:45 ` Tom Tromey

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