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

Re: FYI: psymtab expansion fix


On 18/05/12 23:55, Tom Tromey wrote:
...
> Index: dwarf2read.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/dwarf2read.c,v
> retrieving revision 1.651
> diff -u -r1.651 dwarf2read.c
> --- dwarf2read.c	16 May 2012 22:10:48 -0000	1.651
> +++ dwarf2read.c	18 May 2012 14:22:08 -0000
> @@ -2992,6 +2992,30 @@
>      }
>  }
>  
> +/* A helper for dw2_find_pc_sect_symtab which finds the most specific
> +   symtab.  */
> +
> +static struct symtab *
> +recursively_find_pc_sect_symtab (struct symtab *symtab, CORE_ADDR pc)
> +{
> +  int i;
> +
> +  if (BLOCKVECTOR (symtab) != NULL
> +      && blockvector_contains_pc (BLOCKVECTOR (symtab), pc))
> +    return symtab;
> +
> +  for (i = 0; symtab->includes[i]; ++i)
> +    {
> +      struct symtab *s;
> +
> +      s = recursively_find_pc_sect_symtab (s, pc);
> +      if (s != NULL)
> +	return s;
> +    }
> +
> +  return NULL;
> +}

Tom,

This fails to compile on "gcc (Ubuntu/Linaro 4.4.4-14ubuntu5.1) 4.4.5":

ccache gcc -g -O2   -I. -I. -I./common -I./config -DLOCALEDIR="\"/usr/local/share/locale\"" -DHAVE_CONFIG_H -I./../include/opcode -I./../opcodes/.. -I./../readline/.. -I../bfd -I./../bfd -I./../include -I../libdecnumber -I./../libdecnumber  -I./gnulib/import -Ibuild-gnulib/import   -DTUI=1  -I/usr/include/python2.6 -I/usr/include/python2.6 -Wall -Wdeclaration-after-statement -Wpointer-arith -Wformat-nonliteral -Wno-pointer-sign -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wmissing-prototypes -Werror -c -o dwarf2read.o -MT dwarf2read.o -MMD -MP -MF .deps/dwarf2read.Tpo dwarf2read.c
cc1: warnings being treated as errors
dwarf2read.c: In function ‘recursively_find_pc_sect_symtab’:
dwarf2read.c:3009: error: ‘s’ may be used uninitialized in this function

Shouldn't s be initialised to symtab->includes[i]?

cheers,

John


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