This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Work-around for a bug in GCC5.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]