* [OB] Fix xcoffread.c build error
@ 2011-05-19 6:56 Hui Zhu
2011-05-19 9:59 ` Pedro Alves
0 siblings, 1 reply; 7+ messages in thread
From: Hui Zhu @ 2011-05-19 6:56 UTC (permalink / raw)
To: gdb-patches ml
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 -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 xcoffread.o -MT xcoffread.o -MMD -MP -MF
.deps/xcoffread.Tpo ../../src/gdb/xcoffread.c
cc1: warnings being treated as errors
../../src/gdb/xcoffread.c: In function 'xcoff_psymtab_to_symtab_1':
../../src/gdb/xcoffread.c:964:25: error:
'fcn_aux_saved$x_sym$x_misc$x_fsize' may be used uninitialized in this
function
make[2]: *** [xcoffread.o] Error 1
make[2]: Leaving directory `/home/teawater/gdb/cvs/ba/gdb'
make[1]: *** [all-gdb] Error 2
make[1]: Leaving directory `/home/teawater/gdb/cvs/ba'
make: *** [all] Error 2
2011-05-19 Hui Zhu <teawater@gmail.com>
* xcoffread.c (read_xcoff_symtab): Initialize fcn_aux_saved.
===================================================================
RCS file: /cvs/src/src/gdb/xcoffread.c,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -r1.87 -r1.88
--- src/gdb/xcoffread.c 2011/04/19 14:33:09 1.87
+++ src/gdb/xcoffread.c 2011/05/19 06:54:30 1.88
@@ -961,7 +961,7 @@
struct coff_symbol fcn_stab_saved = { 0 };
/* fcn_cs_saved is global because process_xcoff_symbol needs it. */
- union internal_auxent fcn_aux_saved;
+ union internal_auxent fcn_aux_saved = main_aux;
struct context_stack *new;
char *filestring = " _start_ "; /* Name of the current file. */
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [OB] Fix xcoffread.c build error 2011-05-19 6:56 [OB] Fix xcoffread.c build error Hui Zhu @ 2011-05-19 9:59 ` Pedro Alves 2011-05-20 5:13 ` Hui Zhu 0 siblings, 1 reply; 7+ messages in thread From: Pedro Alves @ 2011-05-19 9:59 UTC (permalink / raw) To: gdb-patches; +Cc: Hui Zhu On Thursday 19 May 2011 07:56:00, Hui Zhu wrote: > 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 -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 xcoffread.o -MT xcoffread.o -MMD -MP -MF > .deps/xcoffread.Tpo ../../src/gdb/xcoffread.c > cc1: warnings being treated as errors > ../../src/gdb/xcoffread.c: In function 'xcoff_psymtab_to_symtab_1': > ../../src/gdb/xcoffread.c:964:25: error: > 'fcn_aux_saved$x_sym$x_misc$x_fsize' may be used uninitialized in this > function > make[2]: *** [xcoffread.o] Error 1 > make[2]: Leaving directory `/home/teawater/gdb/cvs/ba/gdb' > make[1]: *** [all-gdb] Error 2 > make[1]: Leaving directory `/home/teawater/gdb/cvs/ba' > make: *** [all] Error 2 > > 2011-05-19 Hui Zhu <teawater@gmail.com> > > * xcoffread.c (read_xcoff_symtab): Initialize fcn_aux_saved. > =================================================================== > RCS file: /cvs/src/src/gdb/xcoffread.c,v > retrieving revision 1.87 > retrieving revision 1.88 > diff -u -r1.87 -r1.88 > --- src/gdb/xcoffread.c 2011/04/19 14:33:09 1.87 > +++ src/gdb/xcoffread.c 2011/05/19 06:54:30 1.88 > @@ -961,7 +961,7 @@ > struct coff_symbol fcn_stab_saved = { 0 }; > > /* fcn_cs_saved is global because process_xcoff_symbol needs it. */ > - union internal_auxent fcn_aux_saved; > + union internal_auxent fcn_aux_saved = main_aux; Hmm? Initializing fcn_aux_saved with the also uninitialized main_aux makes the warning go away? This appears to be hiding a real bug. > struct context_stack *new; > > char *filestring = " _start_ "; /* Name of the current file. */ > -- Pedro Alves ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [OB] Fix xcoffread.c build error 2011-05-19 9:59 ` Pedro Alves @ 2011-05-20 5:13 ` Hui Zhu 2011-05-24 16:28 ` Pedro Alves 0 siblings, 1 reply; 7+ messages in thread From: Hui Zhu @ 2011-05-20 5:13 UTC (permalink / raw) To: Pedro Alves; +Cc: gdb-patches On Thu, May 19, 2011 at 17:59, Pedro Alves <pedro@codesourcery.com> wrote: > On Thursday 19 May 2011 07:56:00, Hui Zhu wrote: >> 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 -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 xcoffread.o -MT xcoffread.o -MMD -MP -MF >> .deps/xcoffread.Tpo ../../src/gdb/xcoffread.c >> cc1: warnings being treated as errors >> ../../src/gdb/xcoffread.c: In function 'xcoff_psymtab_to_symtab_1': >> ../../src/gdb/xcoffread.c:964:25: error: >> 'fcn_aux_saved$x_sym$x_misc$x_fsize' may be used uninitialized in this >> function >> make[2]: *** [xcoffread.o] Error 1 >> make[2]: Leaving directory `/home/teawater/gdb/cvs/ba/gdb' >> make[1]: *** [all-gdb] Error 2 >> make[1]: Leaving directory `/home/teawater/gdb/cvs/ba' >> make: *** [all] Error 2 >> >> 2011-05-19 Hui Zhu <teawater@gmail.com> >> >> * xcoffread.c (read_xcoff_symtab): Initialize fcn_aux_saved. >> =================================================================== >> RCS file: /cvs/src/src/gdb/xcoffread.c,v >> retrieving revision 1.87 >> retrieving revision 1.88 >> diff -u -r1.87 -r1.88 >> --- src/gdb/xcoffread.c 2011/04/19 14:33:09 1.87 >> +++ src/gdb/xcoffread.c 2011/05/19 06:54:30 1.88 >> @@ -961,7 +961,7 @@ >> struct coff_symbol fcn_stab_saved = { 0 }; >> >> /* fcn_cs_saved is global because process_xcoff_symbol needs it. */ >> - union internal_auxent fcn_aux_saved; >> + union internal_auxent fcn_aux_saved = main_aux; > > Hmm? Initializing fcn_aux_saved with the also uninitialized > main_aux makes the warning go away? > > This appears to be hiding a real bug. > >> struct context_stack *new; >> >> char *filestring = " _start_ "; /* Name of the current file. */ >> > > -- > Pedro Alves > I am sorry that I just make it can be build but looks didn't fix it. I checked all of this function: while (symnum < max_symnum) { if ((cs->c_sclass == C_EXT || cs->c_sclass == C_HIDEXT) && cs->c_naux == 1) { bfd_coff_swap_aux_in (abfd, raw_auxptr, cs->c_type, cs->c_sclass, 0, cs->c_naux, &main_aux); case XTY_LD: case XMC_PR: fcn_aux_saved = main_aux; case C_FCN: else if (strcmp (cs->c_name, ".ef") == 0) finish_block (new->name, &local_symbols, new->old_blocks, new->start_addr, (fcn_cs_saved.c_value + fcn_aux_saved.x_sym.x_misc.x_fsize + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile))), objfile); Not sure I can fixed it or not. What about add a "fcn_aux_saved = main_aux;" after "bfd_coff_swap_aux_in"? Thanks, Hui ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [OB] Fix xcoffread.c build error 2011-05-20 5:13 ` Hui Zhu @ 2011-05-24 16:28 ` Pedro Alves 2011-05-24 16:29 ` Pedro Alves 2011-05-25 7:21 ` Tristan Gingold 0 siblings, 2 replies; 7+ messages in thread From: Pedro Alves @ 2011-05-24 16:28 UTC (permalink / raw) To: Hui Zhu; +Cc: gdb-patches, Tristan Gingold On Friday 20 May 2011 06:12:11, Hui Zhu wrote: > On Thu, May 19, 2011 at 17:59, Pedro Alves <pedro@codesourcery.com> wrote: > > On Thursday 19 May 2011 07:56:00, Hui Zhu wrote: > >> 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 -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 xcoffread.o -MT xcoffread.o -MMD -MP -MF > >> .deps/xcoffread.Tpo ../../src/gdb/xcoffread.c > >> cc1: warnings being treated as errors > >> ../../src/gdb/xcoffread.c: In function 'xcoff_psymtab_to_symtab_1': > >> ../../src/gdb/xcoffread.c:964:25: error: > >> 'fcn_aux_saved$x_sym$x_misc$x_fsize' may be used uninitialized in this > >> function > >> make[2]: *** [xcoffread.o] Error 1 > >> make[2]: Leaving directory `/home/teawater/gdb/cvs/ba/gdb' > >> make[1]: *** [all-gdb] Error 2 > >> make[1]: Leaving directory `/home/teawater/gdb/cvs/ba' > >> make: *** [all] Error 2 > >> > >> 2011-05-19 Hui Zhu <teawater@gmail.com> > >> > >> * xcoffread.c (read_xcoff_symtab): Initialize fcn_aux_saved. > >> =================================================================== > >> RCS file: /cvs/src/src/gdb/xcoffread.c,v > >> retrieving revision 1.87 > >> retrieving revision 1.88 > >> diff -u -r1.87 -r1.88 > >> --- src/gdb/xcoffread.c 2011/04/19 14:33:09 1.87 > >> +++ src/gdb/xcoffread.c 2011/05/19 06:54:30 1.88 > >> @@ -961,7 +961,7 @@ > >> struct coff_symbol fcn_stab_saved = { 0 }; > >> > >> /* fcn_cs_saved is global because process_xcoff_symbol needs it. */ > >> - union internal_auxent fcn_aux_saved; > >> + union internal_auxent fcn_aux_saved = main_aux; > > > > Hmm? Initializing fcn_aux_saved with the also uninitialized > > main_aux makes the warning go away? > > > > This appears to be hiding a real bug. > > > >> struct context_stack *new; > >> > >> char *filestring = " _start_ "; /* Name of the current file. */ > >> > > > > -- > > Pedro Alves > > > > I am sorry that I just make it can be build but looks didn't fix it. > > I checked all of this function: > while (symnum < max_symnum) > { > if ((cs->c_sclass == C_EXT || cs->c_sclass == C_HIDEXT) > && cs->c_naux == 1) > { > bfd_coff_swap_aux_in (abfd, raw_auxptr, cs->c_type, cs->c_sclass, > 0, cs->c_naux, &main_aux); > > case XTY_LD: > case XMC_PR: > fcn_aux_saved = main_aux; > > > case C_FCN: > else if (strcmp (cs->c_name, ".ef") == 0) > finish_block (new->name, &local_symbols, new->old_blocks, > new->start_addr, > (fcn_cs_saved.c_value > + fcn_aux_saved.x_sym.x_misc.x_fsize > + ANOFFSET (objfile->section_offsets, > SECT_OFF_TEXT (objfile))), > objfile); > > > Not sure I can fixed it or not. What about add a "fcn_aux_saved = > main_aux;" after "bfd_coff_swap_aux_in"? It that were possible, then why would we need fcn_aux_saved at all? This is a bit hard to follow without a file to test with, but ISTM that fcn_aux_saved is needed because main_aux no longer contains what we need at the time time fcn_aux_saved is used (that is, we've moved to another symbol/aux). Does gcc still output a warning with this for you? Maybe Tristian can check if this doesn't break something? (I suppose fcn_aux_saved and a bunch other locals should be cleared somewhere, most likely after finish_block, or where we do the complaints.) -- Pedro Alves 2011-05-24 Pedro Alves <pedro@codesourcery.com> gdb/ * xcoffread.c (read_xcoff_symtab): Don't initialize fcn_aux_saved with main_aux. New local fcn_aux_saved_p. Set it when fcn_aux_saved is set. When finishing a function block, if fcn_aux_saved_p is false, ignore the function. --- gdb/xcoffread.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) Index: src/gdb/xcoffread.c =================================================================== --- src.orig/gdb/xcoffread.c 2011-05-19 18:57:19.000000000 +0100 +++ src/gdb/xcoffread.c 2011-05-24 16:44:17.298753682 +0100 @@ -961,7 +961,8 @@ read_xcoff_symtab (struct partial_symtab struct coff_symbol fcn_stab_saved = { 0 }; /* fcn_cs_saved is global because process_xcoff_symbol needs it. */ - union internal_auxent fcn_aux_saved = main_aux; + union internal_auxent fcn_aux_saved; + int fcn_aux_saved_p = 0; struct context_stack *new; char *filestring = " _start_ "; /* Name of the current file. */ @@ -1195,6 +1196,7 @@ read_xcoff_symtab (struct partial_symtab when `.bf' is seen. */ fcn_cs_saved = *cs; fcn_aux_saved = main_aux; + fcn_aux_saved_p = 1; continue; case XMC_GL: @@ -1329,6 +1331,13 @@ read_xcoff_symtab (struct partial_symtab { ef_complaint (cs->c_symnum); within_function = 0; + break; + } + + if (!fcn_aux_saved_p) + { + ef_complaint (cs->c_symnum); + within_function = 0; break; } ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [OB] Fix xcoffread.c build error 2011-05-24 16:28 ` Pedro Alves @ 2011-05-24 16:29 ` Pedro Alves 2011-05-25 7:21 ` Tristan Gingold 1 sibling, 0 replies; 7+ messages in thread From: Pedro Alves @ 2011-05-24 16:29 UTC (permalink / raw) To: gdb-patches; +Cc: Hui Zhu, Tristan Gingold On Tuesday 24 May 2011 17:27:43, Pedro Alves wrote: > Maybe Tristian can check if this doesn't break something? Whoops, apologies for typoing your name. -- Pedro Alves ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [OB] Fix xcoffread.c build error 2011-05-24 16:28 ` Pedro Alves 2011-05-24 16:29 ` Pedro Alves @ 2011-05-25 7:21 ` Tristan Gingold 2011-05-25 21:01 ` Joel Brobecker 1 sibling, 1 reply; 7+ messages in thread From: Tristan Gingold @ 2011-05-25 7:21 UTC (permalink / raw) To: Pedro Alves; +Cc: Hui Zhu, gdb-patches On May 24, 2011, at 6:27 PM, Pedro Alves wrote: [...] > It that were possible, then why would we need fcn_aux_saved > at all? This is a bit hard to follow without a > file to test with, but ISTM that fcn_aux_saved is needed because > main_aux no longer contains what we need at the time time > fcn_aux_saved is used (that is, we've moved to > another symbol/aux). > > Does gcc still output a warning with this for you? > > Maybe Tristian can check if this doesn't break something? I can do a sanity check if you need (please confirm), but a full regression (using AdaCore testsuite) will be done when Joel updates our head branch. > (I suppose fcn_aux_saved and a bunch other locals should be > cleared somewhere, most likely after finish_block, or > where we do the complaints.) Your change looks safe, but as fcn_aux_saved_p is never cleared, it will catch only if the missing PR symbol is the first one. IMHO (and just IMHO), to get rid of the warning why not saving only the fsize field (instead of the whole aux entry) and initialize to 0 ? Tristan. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [OB] Fix xcoffread.c build error 2011-05-25 7:21 ` Tristan Gingold @ 2011-05-25 21:01 ` Joel Brobecker 0 siblings, 0 replies; 7+ messages in thread From: Joel Brobecker @ 2011-05-25 21:01 UTC (permalink / raw) To: Tristan Gingold; +Cc: Pedro Alves, Hui Zhu, gdb-patches > I can do a sanity check if you need (please confirm), but a full > regression (using AdaCore testsuite) will be done when Joel updates > our head branch. I was planning on doing that early next week (a bit tied up this week), but I can do that tomorrow if that helps. Just let me know. -- Joel ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-05-25 21:01 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2011-05-19 6:56 [OB] Fix xcoffread.c build error Hui Zhu 2011-05-19 9:59 ` Pedro Alves 2011-05-20 5:13 ` Hui Zhu 2011-05-24 16:28 ` Pedro Alves 2011-05-24 16:29 ` Pedro Alves 2011-05-25 7:21 ` Tristan Gingold 2011-05-25 21:01 ` Joel Brobecker
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox