* [PATCH] Work-around for a bug in GCC5.
@ 2015-01-27 19:35 Alexander Klimov
2015-01-28 12:01 ` Mark Wielaard
2015-01-29 12:43 ` Joel Brobecker
0 siblings, 2 replies; 4+ messages in thread
From: Alexander Klimov @ 2015-01-27 19:35 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: TEXT/PLAIN, Size: 729 bytes --]
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.
--
Regards,
ASK
[-- Attachment #2: Type: TEXT/PLAIN, Size: 752 bytes --]
From 9ab493c21ecbd120eedf5146caf2181db7abf599 Mon Sep 17 00:00:00 2001
From: Alexander Klimov <alserkli@inbox.ru>
Date: Tue, 27 Jan 2015 19:56:45 +0200
Subject: [PATCH] Work-around for a bug in GCC5.
Reported as <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64823>
---
gdb/symfile.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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. "
--
1.7.10.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Work-around for a bug in GCC5.
2015-01-27 19:35 [PATCH] Work-around for a bug in GCC5 Alexander Klimov
@ 2015-01-28 12:01 ` Mark Wielaard
2015-01-29 12:43 ` Joel Brobecker
1 sibling, 0 replies; 4+ messages in thread
From: Mark Wielaard @ 2015-01-28 12:01 UTC (permalink / raw)
To: Alexander Klimov; +Cc: gdb-patches
On Tue, Jan 27, 2015 at 08:14:39PM +0200, Alexander Klimov wrote:
> 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.
Thanks for reducing it to something simpler! I was somewhat embarrassed
I couldn't find a simpler case that showed the issue. I had a different
fix, but I couldn't figure out why it was necessary:
https://sourceware.org/ml/gdb-patches/2015-01/msg00665.html
Your fix is simpler and it is more clear why it is a real workaround.
I think my fix is technically more correct since it makes the code
and error emmitted in this case more like the other commands (although
it isn't clear if that really matters, it is still an error case). But it
isn't immediately clear why it is a good workaround for this GCC5 issue.
What do others think? Could someone approve either of the fixes?
Getting a fix in to make GDB compile with GCC5 would be really welcome.
Thanks,
Mark
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Work-around for a bug in GCC5.
2015-01-27 19:35 [PATCH] Work-around for a bug in GCC5 Alexander Klimov
2015-01-28 12:01 ` Mark Wielaard
@ 2015-01-29 12:43 ` Joel Brobecker
2015-02-17 10:18 ` Alexander Klimov
1 sibling, 1 reply; 4+ messages in thread
From: Joel Brobecker @ 2015-01-29 12:43 UTC (permalink / raw)
To: Alexander Klimov; +Cc: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 2930 bytes --]
Alexander,
On Tue, Jan 27, 2015 at 08:14:39PM +0200, Alexander Klimov wrote:
> 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.
Thanks for the patch.
In deciding whether to apply this patch, I considered the fact that
GCC 5 is currently unreleased, and so I would probably questioned
the idea of a workaround more if it was more intrusive. But since
this patch is very very simple, I did not see the harm.
So I tested the patch on x86_64 and pushed it. I'm not really sure
whether we might want it for 7.9 or not. I think that'll depend on
the likeliness of GCC being fixed by the time GCC 5 gets released.
If we don't know, I'm not opposed to pushing this one to 7.9 as well.
A few comments, for next time:
- I didn't check whether you have a copyright assignment on file
for the GDB project or not. This pach is very small, and therefore
I applied it under the "tiny patch" rule, where we consider patches
smaller than 10-15 lines to not be legally significant.
If you do not have a copyright assignment on file and you are
thinking of making other contributions to GDB, please contact me
in private, and I'll send you the form to get started. The process
takes a few weeks.
- In terms of submitting the patch, we'd like revision log of
the commit be a full description of what the commit does,
what problem it solves, how and why. The nice thing about it
is that you can usually just "git send-email" it to the list.
In this particular case, I used the contents of your of your
email for the revision log.
- Notice also that I've attached a ChangeLog entry. We require
ChangeLog entries at time of patch submission, as we often
use them to see what's changed, and it also allows us to check
that they are properly formatted and complete.
There are two documents that should be useful for helping you understand
how to help us integrate your patches:
gdb/CONTRIBUTE
https://sourceware.org/gdb/wiki/ContributionChecklist
If it looks a bit overwhelming, no worries, we're around to guide
you through them.
gdb/ChangeLog:
* symfile.c (unmap_overlay_command): Initialize sec to NULL.
Tested on x86_64-linux and pushed to master.
--
Joel
[-- Attachment #2: 0001-Fix-build-failure-in-symfile.c-unmap_overlay_command.patch --]
[-- Type: text/x-diff, Size: 1884 bytes --]
From 7a270e0c9ba0eb738a4c30258ab29c09963fcd4d Mon Sep 17 00:00:00 2001
From: Alexander Klimov <alserkli@inbox.ru>
Date: Tue, 27 Jan 2015 19:56:45 +0200
Subject: [PATCH] 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 | 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. "
--
1.9.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Work-around for a bug in GCC5.
2015-01-29 12:43 ` Joel Brobecker
@ 2015-02-17 10:18 ` Alexander Klimov
0 siblings, 0 replies; 4+ messages in thread
From: Alexander Klimov @ 2015-02-17 10:18 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
Hi.
On Thu, 29 Jan 2015, Joel Brobecker wrote:
> I'm not really sure whether we might want it for 7.9 or not. I think
> that'll depend on the likeliness of GCC being fixed by the time
> GCC 5 gets released.
The bug was fixed in GCC 5.0.0 20150217,
the GDB patch is no longer needed.
--
Regards,
ASK
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-02-17 10:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-27 19:35 [PATCH] Work-around for a bug in GCC5 Alexander Klimov
2015-01-28 12:01 ` Mark Wielaard
2015-01-29 12:43 ` Joel Brobecker
2015-02-17 10:18 ` Alexander Klimov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox