This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Fix build failure in symfile.c::unmap_overlay_command (GCC5 bug)
- From: Joel Brobecker <brobecke at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 29 Jan 2015 07:28:28 -0000
- Subject: [binutils-gdb] Fix build failure in symfile.c::unmap_overlay_command (GCC5 bug)
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7a270e0c9ba0eb738a4c30258ab29c09963fcd4d
commit 7a270e0c9ba0eb738a4c30258ab29c09963fcd4d
Author: Alexander Klimov <alserkli@inbox.ru>
Date: Tue Jan 27 19:56:45 2015 +0200
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.
Diff:
---
gdb/ChangeLog | 4 ++++
gdb/symfile.c | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 03b8712..db4e0b1 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2015-01-29 Joel Brobecker <brobecker@adacore.com> (tiny patch)
+
+ * symfile.c (unmap_overlay_command): Initialize sec to NULL.
+
2015-01-27 Doug Evans <dje@google.com>
* NEWS: Mention gdb.Objfile.username.
diff --git a/gdb/symfile.c b/gdb/symfile.c
index d55e361..86a758a 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -3439,7 +3439,7 @@ static void
unmap_overlay_command (char *args, int from_tty)
{
struct objfile *objfile;
- struct obj_section *sec;
+ struct obj_section *sec = NULL;
if (!overlay_debugging)
error (_("Overlay debugging not enabled. "