From patchwork Tue Jan 27 18:14:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Klimov X-Patchwork-Id: 4829 Received: (qmail 2188 invoked by alias); 27 Jan 2015 18:14:52 -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 2119 invoked by uid 89); 27 Jan 2015 18:14:49 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=AWL, FREEMAIL_FROM, SPF_SOFTFAIL, TVD_RCVD_IP autolearn=no version=3.3.2 X-HELO: mx.eitan.edu Received: from 62.128.58.36.static.012.net.il (HELO mx.eitan.edu) (62.128.58.36) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Tue, 27 Jan 2015 18:14:42 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by mx.eitan.edu (8.13.8/8.13.8) with ESMTP id t0RIEd6T025290 for ; Tue, 27 Jan 2015 20:14:39 +0200 Date: Tue, 27 Jan 2015 20:14:39 +0200 From: Alexander Klimov To: gdb-patches@sourceware.org Subject: [PATCH] Work-around for a bug in GCC5. Message-ID: MIME-Version: 1.0 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. 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. "