Fix build failure in symfile.c::unmap_overlay_command (GCC5 bug)
authorAlexander Klimov <alserkli@inbox.ru>
Tue, 27 Jan 2015 17:56:45 +0000 (19:56 +0200)
committerJoel Brobecker <brobecker@adacore.com>
Thu, 29 Jan 2015 07:28:02 +0000 (11:28 +0400)
commit7a270e0c9ba0eb738a4c30258ab29c09963fcd4d
tree326f29ce4932651e3231df010bf1ec1b8afa83e7
parentb86ac8e3a5a3117696b1760003b8e09ed13f1de9
Fix build failure in symfile.c::unmap_overlay_command (GCC5 bug)

Compilation of (GDB) 7.9.50.20150127-cvs with (GCC) 5.0.0 20150127
fails with

In file included from symfile.c:32:0:
symfile.c: In function 'unmap_overlay_command':
objfiles.h:628:3: error: 'sec' may be used uninitialized in this
function [-Werror=maybe-uninitialized]
   for (osect = objfile->sections; osect < objfile->sections_end; osect++) \
   ^
symfile.c:3442:23: note: 'sec' was declared here
   struct obj_section *sec;
                       ^
cc1: all warnings being treated as errors
make[2]: *** [symfile.o] Error 1
make[2]: Leaving directory `gdb/gdb'

While the bug was reported to GCC as
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64823>,
the attached patch simply initializes sec with NULL.

gdb/ChangeLog:

        * symfile.c (unmap_overlay_command): Initialize sec to NULL.

Tested on x86_64-linux.
gdb/ChangeLog
gdb/symfile.c
This page took 0.038687 seconds and 4 git commands to generate.