From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-x230.google.com (mail-wr0-x230.google.com [IPv6:2a00:1450:400c:c0c::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 120BC21AE2646 for ; Tue, 20 Jun 2017 04:59:27 -0700 (PDT) Received: by mail-wr0-x230.google.com with SMTP id y25so51237457wrd.2 for ; Tue, 20 Jun 2017 05:00:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=vw0rQuMBn7n/4Tu1Cd2TtE3DaQVsgfxVljijEVHgPZ8=; b=jD2cQMOltjg9/BWxrxdELPi6RX3S13l5qdSUz1Y3sW4qBosvnrhsudS2g+bFi7igVE 65z51s4NrGlmKgnRvNJa25dL3YHBWnPp7UC4a7m1yeBUmUdibD33BlJ75cPXkadfnY/k XkFUoDLrr/UL90C63nFJLI3NxRNYFH8bXeDwA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=vw0rQuMBn7n/4Tu1Cd2TtE3DaQVsgfxVljijEVHgPZ8=; b=QUiAtruHl9MrUh/By/T4/G+jUp1r7IERovYJjmJMZoKTnfK3cgsYPZzYrb/BSHumaD HH2wcuo1mgh4QMxZYMxw1KD+kWhJrxbAnpixyYeycIFEvE7gezBnPho3ATlS7GrE79pd Ou60jpLrm+Sp9keaKhY+f7E/YtrXZWNQUiqs1flS8p76VGX6LgR6TGPuHBUSjbcVjngV QRa2rz1NQpWxDde51giPW8s/VXOeh2wPtdKCa1MGOYLtVArbeYuvDcEB8aaXGPyn8Wjx /prEVPCNQGbAa6zHSxX1dxbzSSlUeG7rV2GTiHIp6ocNVeN1SWdOOo40v5gbTEhohfRj M7dQ== X-Gm-Message-State: AKS2vOxVJpWFObaxIE8WGw9D+3efJrT5rVYUBbGbr64YBaMriU881H2p om47a1Sx+Ft/Zusf X-Received: by 10.223.138.167 with SMTP id y36mr8275600wry.93.1497960048397; Tue, 20 Jun 2017 05:00:48 -0700 (PDT) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id v96sm12067535wrc.53.2017.06.20.05.00.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Jun 2017 05:00:47 -0700 (PDT) Date: Tue, 20 Jun 2017 13:00:46 +0100 From: Leif Lindholm To: Ard Biesheuvel Cc: Laszlo Ersek , "edk2-devel@lists.01.org" , Ryan Harkin Message-ID: <20170620120046.GZ26676@bivouac.eciton.net> References: <20170620110008.24413-1-leif.lindholm@linaro.org> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) 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 11:59:27 -0000 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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. / Leif > > ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.c b/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.c > > index da93eb5829..18491c7378 100644 > > --- a/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.c > > +++ b/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.c > > @@ -343,6 +343,7 @@ ArmJunoSetNicMacAddress () > > return Status; > > } > > > > + PciRegBase = 0; > > Status = InitPciDev (PciIo, &PciRegBase, &OldPciAttr); > > if (EFI_ERROR (Status)) { > > return Status; > > -- > > 2.11.0 > >