Dear Bug-GDB Team,

This got entered into GCC's Bugzilla as Bug 35534.  It has been closed, but
you can follow events there.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35534

Having downloaded a CVS snapshot of GDB 6.8 code, there is a coded fix for
the problem in the (static) function find_line_common(), which indeed had a
pair of return statements wherein 'exact' was not assigned a value.  Close
human inspection of the code can see that when exact is not set, best_index
is negative so exact is not read.  However, it would be pushing the compiler
to the limits to spot that.

Since the fix is already coded in the dev snapshot, you don't need to open a
bug for this - or you can close the bug created for it if one was already
created.  But be aware that people will run into this problem if they
compile GDB 6.7.1 with GCC 4.3.0.

Sorry for any trouble I have caused.


On Mon, Mar 10, 2008 at 8:24 PM, Jonathan Leffler <
[EMAIL PROTECTED]> wrote:

> I'm not clear whether this is a problem in GCC or in GDB, so I'm asking
> both teams.
>
> Compiling gdb 6.7.1 on Solaris 10 using the newly installed GCC 4.3.0, I
> got a compilation error (because of the -Werror option) as shown:
>
> gcc -c -g -O2    -I. -I.././gdb -I.././gdb/config
> -DLOCALEDIR="\"/usr/gdb/v6.7.1/share/locale\"" -DHAVE_CONFIG_H
> -I.././gdb/../include/opcode -I.././gdb/../readline/.. -I../bfd
> -I.././gdb/../bfd -I.././gdb/../include -I./../intl  -DMI_OUT=1 -DTUI=1
> -Wall -Wdeclaration-after-statement -Wpointer-arith -Wformat-nonliteral
> -Wno-pointer-sign -Wno-unused -Wno-switch -Wno-char-subscripts -Werror
> symtab.c
> cc1: warnings being treated as errors
> symtab.c: In function 'find_line_symtab':
> symtab.c:2252: error: 'exact' may be used uninitialized in this function
> make: *** [symtab.o] Error 1
>
> The fragment in question was 'worked around' by adding the '= 0' to the
> declaration of 'exact' at:
>
> struct symtab *
> find_line_symtab (struct symtab *symtab, int line, int *index, int
> *exact_match)
> {
>   int exact = 0;
>
>   /* BEST_INDEX and BEST_LINETABLE identify the smallest linenumber > LINE
>      so far seen.  */
>
>   int best_index;
>   struct linetable *best_linetable;
>   struct symtab *best_symtab;
>
>   /* First try looking it up in the given symtab.  */
>   best_linetable = LINETABLE (symtab);
>   best_symtab = symtab;
>   best_index = find_line_common (best_linetable, line, &exact);
>   if (best_index < 0 || !exact)
>     {
>
> It is not clear to me that GCC is entitled to complain.  However, given
> that it does, the workaround at least allows the compilation to proceed.
>
> [...]




-- 
Jonathan Leffler <[EMAIL PROTECTED]> #include <disclaimer.h>
Guardian of DBD::Informix - v2008.0229 - http://dbi.perl.org
"Blessed are we who can laugh at ourselves, for we shall never cease to be
amused."
_______________________________________________
bug-gdb mailing list
bug-gdb@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gdb

Reply via email to