Re: [0/4] RFC: add DWARF index support

Ken Werner
2010-07-26T18:41:14Z

[-- Attachment #1: Type: Text/Plain, Size: 992 bytes --]

On Saturday, July 24, 2010 12:12:03 am Tom Tromey wrote:
> >>>>> "Tom" == Tom Tromey <tromey@redhat.com> writes:
> Tom> Here is what I am testing.
>
> Here is the variant I am checking it. It seems to work with all
> combinations of .debug_types, .gdb_index, and -readnow.
>
> Let me know if you hit any more problems.

Hi Tom,

It seems old GCCs do not recognize that the types_list_elements and types_list
variables of dwarf2read.c:dwarf2_initialize_objfile are accessed under the
same condition as they are initialized. GCC 4.1.2 (RHEL5) issues the following
warning:
<snip>
src/gdb/dwarf2read.c: In function ‘dwarf2_initialize_objfile’:
src/gdb/dwarf2read.c:1839: warning: ‘types_list_elements’ may be used
uninitialized in this function
src/gdb/dwarf2read.c:1838: warning: ‘types_list’ may be used uninitialized in
this function
</snip>

The attached patch initializes the two variables to prevent the warnings.
OK to apply?

Regards
-ken

[-- Attachment #2: dwarf2read-warnings.patch --]
[-- Type: text/x-patch, Size: 893 bytes --]

Changelog:

2010-07-06 Ken Werner <ken.werner@de.ibm.com>

* valops.c (dwarf2_read_index): Initialize the types_list and
types_list_elements variables.

Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.425
diff -p -u -r1.425 dwarf2read.c
--- dwarf2read.c 23 Jul 2010 22:15:13 -0000 1.425
+++ dwarf2read.c 26 Jul 2010 18:06:02 -0000
@@ -1835,8 +1835,10 @@ dwarf2_read_index (struct objfile *objfi
char *addr;
struct mapped_index *map;
offset_type *metadata;
- const gdb_byte *cu_list, *types_list;
- offset_type version, cu_list_elements, types_list_elements;
+ const gdb_byte *cu_list;
+ const gdb_byte *types_list = NULL;
+ offset_type version, cu_list_elements;
+ offset_type types_list_elements = 0;
int i;

if (dwarf2_per_objfile->gdb_index.asection == NULL