From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29082 invoked by alias); 27 Jan 2015 21:31:37 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 27289 invoked by uid 89); 27 Jan 2015 21:31:35 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 27 Jan 2015 21:31:35 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t0RLVMdU031790 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 27 Jan 2015 16:31:23 -0500 Received: from blokker.wildebeest.org (ovpn-116-80.ams2.redhat.com [10.36.116.80]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t0RLVKhv024129 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 27 Jan 2015 16:31:22 -0500 Received: by blokker.wildebeest.org (Postfix, from userid 1000) id 5BA292062E; Tue, 27 Jan 2015 22:31:20 +0100 (CET) Date: Wed, 28 Jan 2015 12:01:00 -0000 From: Mark Wielaard To: Alexander Klimov Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] Work-around for a bug in GCC5. Message-ID: <20150127213120.GD12565@blokker.redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-SW-Source: 2015-01/txt/msg00730.txt.bz2 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 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