From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 4F98421AE2622 for ; Tue, 20 Jun 2017 08:43:36 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 82FF6C003580; Tue, 20 Jun 2017 15:44:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 82FF6C003580 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=lersek@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 82FF6C003580 Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-150.phx2.redhat.com [10.3.116.150]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8966961B60; Tue, 20 Jun 2017 15:44:57 +0000 (UTC) To: Leif Lindholm , Ard Biesheuvel Cc: "edk2-devel@lists.01.org" , Ryan Harkin References: <20170620110008.24413-1-leif.lindholm@linaro.org> <20170620120046.GZ26676@bivouac.eciton.net> From: Laszlo Ersek Message-ID: Date: Tue, 20 Jun 2017 17:44:56 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <20170620120046.GZ26676@bivouac.eciton.net> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 20 Jun 2017 15:44:58 +0000 (UTC) Subject: Re: [PATCH] ArmPlatformPkg: eliminate Juno gcc build warning X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Jun 2017 15:43:36 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit On 06/20/17 14:00, Leif Lindholm wrote: > On Tue, Jun 20, 2017 at 01:28:38PM +0200, Ard Biesheuvel wrote: >> (+ Laszlo) >> >> On 20 June 2017 at 13:00, Leif Lindholm wrote: >>> When building without LTO, gcc incorrectly resolves the hazards for >>> 'PciRegBase’ when inlining, leading to "may be used uninitialized" >>> warnings (and hence build failure with -Werror). >>> Eliminate this warning by explicitly initializing the variable to 0. >>> >>> Contributed-under: TianoCore Contribution Agreement 1.0 >>> Signed-off-by: Leif Lindholm >> >> Reviewed-by: Ard Biesheuvel > > Thanks! > >>> --- >>> >>> For those who have heard me mentioning this before but arguing against >>> upstreaming this patch: I only just tweaked that this warning doesn't >>> go away with more recent toolchains, but simply when switching to GCC5 >>> build profile, and hence LTO. Build failure still reproducible with >>> gcc 6.3.1 and GCC49. >> >> /me annoyed > > +1 > >> We keep hitting this with GCC, and I profoundly dislike having to add >> redundant initialization sequences. Is there any other solution >> possible, e.g., disable this warning for certain builds? > > I would really like to not disable it. > When it gets it right, that's usually a pretty horrific bug caught. > And if we switch to LTO as the norm, I guess these will become less > noticeable over time. > But it does bug me too. Perhaps we should introduce two macros to "MdePkg/Include/Base.h", #define UNUSED_POINTER NULL #define UNUSED_INTEGER 0 These could be used to suppress such warnings, without the risk of misleading programmers (as to the real necessity of the variable assignment at hand). Thanks Laszlo