Re: [gdbadmin@sourceware.org: make-snapshot gdb current failed]

Alan Modra
2011-07-14T06:22:45Z

On Wed, Jul 13, 2011 at 09:24:15PM -0700, Joel Brobecker wrote:
> linker.c: In function `_bfd_generic_section_already_linked':
> linker.c:3043: warning: 'l_flags' might be used uninitialized in this function

Huh, so the versions of gcc I used to compile this code don't detect
this problem. gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3 and
xgcc (GCC) 4.7.0 20110706 (experimental). Not nice.

* linker.c (_bfd_generic_section_already_linked): Set l_flags.
* elf-bfd.h (struct already_linked): Forward declare.

Index: bfd/linker.c
===================================================================
RCS file: /cvs/src/src/bfd/linker.c,v
retrieving revision 1.86
diff -u -p -r1.86 linker.c
--- bfd/linker.c 9 Jul 2011 06:20:51 -0000 1.86
+++ bfd/linker.c 14 Jul 2011 06:20:16 -0000
@@ -3057,6 +3057,7 @@ _bfd_generic_section_already_linked (bfd
{
l_sec = l->linked.u.sec;
l_owner = l_sec->owner;
+ l_flags = l_sec->flags;
l_comdat = bfd_coff_get_comdat_section (l_sec->owner, l_sec);
}

Index: bfd/elf-bfd.h
===================================================================
RCS file: /cvs/src/src/bfd/elf-bfd.h,v
retrieving revision 1.325
diff -u -p -r1.325 elf-bfd.h
--- bfd/elf-bfd.h 11 Jul 2011 15:03:04 -0000 1.325
+++ bfd/elf-bfd.h 14 Jul 2011 06:20:17 -0000
@@ -1797,6 +1797,7 @@ extern bfd_boolean _bfd_elf_match_sectio
(bfd *, const asection *, bfd *, const asection *);
extern bfd_boolean bfd_elf_is_group_section
(bfd *, const struct bfd_section *);
+struct already_linked;
extern void _bfd_elf_section_already_linked
(bfd *, struct already_linked *, struct bfd_link_info *);
extern void bfd_elf_set_group_contents

--
Alan Modra
Australia Development Lab, IBM