Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Hui Zhu <teawater@gmail.com>
To: gdb-patches ml <gdb-patches@sourceware.org>
Subject: [OB] dwarf2read.c: fix build error
Date: Fri, 13 Aug 2010 03:21:00 -0000	[thread overview]
Message-ID: <AANLkTinwbRFepqmcSzrm4Bgdb11siXOTuu1K4eru_R-X@mail.gmail.com> (raw)

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)


             reply	other threads:[~2010-08-13  3:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-13  3:21 Hui Zhu [this message]
2010-08-13 15:45 ` Tom Tromey

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=AANLkTinwbRFepqmcSzrm4Bgdb11siXOTuu1K4eru_R-X@mail.gmail.com \
    --to=teawater@gmail.com \
    --cc=gdb-patches@sourceware.org \
    /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