From patchwork Thu Jan 29 07:38:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Brobecker X-Patchwork-Id: 4842 Received: (qmail 2478 invoked by alias); 29 Jan 2015 07:38:38 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 2469 invoked by uid 89); 29 Jan 2015 07:38:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Thu, 29 Jan 2015 07:38:34 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 81A901165D9; Thu, 29 Jan 2015 02:38:32 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 8VRywXgTu8Xq; Thu, 29 Jan 2015 02:38:32 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 1A952116381; Thu, 29 Jan 2015 02:38:31 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id D8D81491CD; Thu, 29 Jan 2015 11:38:27 +0400 (RET) Date: Thu, 29 Jan 2015 11:38:27 +0400 From: Joel Brobecker To: Alexander Klimov Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] Work-around for a bug in GCC5. Message-ID: <20150129073827.GF5193@adacore.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) 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 > , > 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. From 7a270e0c9ba0eb738a4c30258ab29c09963fcd4d Mon Sep 17 00:00:00 2001 From: Alexander Klimov 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 , 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 (tiny patch) + + * symfile.c (unmap_overlay_command): Initialize sec to NULL. + 2015-01-27 Doug Evans * 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