From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by mx.groups.io with SMTP id smtpd.web11.32705.1585210272193084010 for ; Thu, 26 Mar 2020 01:11:12 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=o4C0mptp; spf=pass (domain: linaro.org, ip: 209.85.128.68, mailfrom: ard.biesheuvel@linaro.org) Received: by mail-wm1-f68.google.com with SMTP id a81so5907116wmf.5 for ; Thu, 26 Mar 2020 01:11:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=e6PkHkFfKiok10MNxhKRSSdHlm3oPFO/gSA97605D9k=; b=o4C0mptpYKPk8PdgPTcEYVFigwdcr16npc0v6ESTx+JTR/fjit3O5Q0dfBlxke8tH9 lwwUuifg6vfcpKf9ywNBYJYZgfd+Gny6yFLUPTbDgKgNp1zEgljNGZYLmxMpd01BClNO LW1D17NPcWVqBQfBK1v7gPOjbDoNXxOtUEXJGcKJDrmxkH3/dK7nw2EL5EnJO5N79elX QTrMakxzA6x/1ScCLbGN3yawXc6rQ68nmWTbpafQB4ElnGHEvH0iUE/rWkUq6r6aYFi6 a6thO9bs/bzFFuwQcfheC4JAQdlqP3jANMHYl5Facf2+orbRA1Znz3uPrUSPGXH9X2Ee DEeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=e6PkHkFfKiok10MNxhKRSSdHlm3oPFO/gSA97605D9k=; b=R1Y5uTVYFlJaLDpbzxqHdVbih2bTzAr6iNgXo7GrMl0o8QXsaEmXG2rTQBReus6kZr yYwCt/TMj9pSzsvYtG1G7pCP/uWrZ8feH8UBHveSc299YdZbp+sfIFDT2kyUfe5TcT4M O/57gOyqJWUMAe1EmS79uWpPDIvpltyIP5icTae5HpT7TCKAGYk5DITsxTG5RkD3QWWe iHHUG2NSo5XJfrWcqbdUV0aYyqwJlIEWTkaGTfTyCzg4p5hTZ2ylIBUTASki37ZCy3pV lZElfOQoV8nCJGTNVmMH7wv9g3O8SsEYKNuqy5cnfkps3bGYn8U+lNp0cQ6A+77HB6na 2L2A== X-Gm-Message-State: ANhLgQ3hdW6e5GTXpP/j82SUEU4uU2m7duDMNlt6bMJlPoaUfJqlJ9wS gWsYf/0eTMoc0tvyzgWBmwj39MUcPmy1CR/OtTaK6Q== X-Google-Smtp-Source: ADFU+vu3jnlT3YGp3I1TVYfnmS5TiB6aBtyCx4Oq9pquSZ+S3KRqWAhVppt2qbMG5bVluo1miPwnfWjUMpA2I0gqhJw= X-Received: by 2002:a7b:c050:: with SMTP id u16mr1974687wmc.68.1585210270772; Thu, 26 Mar 2020 01:11:10 -0700 (PDT) MIME-Version: 1.0 References: <20200325091238.24048-1-ard.biesheuvel@linaro.org> In-Reply-To: From: "Ard Biesheuvel" Date: Thu, 26 Mar 2020 09:10:59 +0100 Message-ID: Subject: Re: [edk2-devel] [PATCH] OvmfPkg/X86QemuLoadImageLib: add dummy assignment to work around GCC To: Laszlo Ersek Cc: edk2-devel-groups-io Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, 25 Mar 2020 at 20:08, Laszlo Ersek wrote: > > On 03/25/20 10:12, Ard Biesheuvel wrote: > > GCC 4.8 or 4.9 may throw the following error when building OVMF: > > > > Edk2/OvmfPkg/Library/X86QemuLoadImageLib/X86QemuLoadImageLib.c: > > In function =E2=80=98QemuLoadKernelImage=E2=80=99: > > Edk2/OvmfPkg/Library/X86QemuLoadImageLib/X86QemuLoadImageLib.c:416:30= : > > error: =E2=80=98CommandLine=E2=80=99 may be used uninitialized in= this function > > [-Werror=3Dmaybe-uniniti= alized] > > UnicodeSPrintAsciiFormat ( > > cc1: all warnings being treated as errors > > > > This is due to the fact that older GCCs fail to infer that CommandLine = is > > never actually used unless it has been assigned. So add a redundant NUL= L > > assignment to help these older GCCs understand this. > > > > Link: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2630 > > Fixes: 7c47d89003a6f ("OvmfPkg: implement QEMU loader library for X86 w= ith ...") > > Signed-off-by: Ard Biesheuvel > > --- > > OvmfPkg/Library/X86QemuLoadImageLib/X86QemuLoadImageLib.c | 5 +++++ > > 1 file changed, 5 insertions(+) > > > > diff --git a/OvmfPkg/Library/X86QemuLoadImageLib/X86QemuLoadImageLib.c = b/OvmfPkg/Library/X86QemuLoadImageLib/X86QemuLoadImageLib.c > > index c5bd6862b265..52b14a4462d8 100644 > > --- a/OvmfPkg/Library/X86QemuLoadImageLib/X86QemuLoadImageLib.c > > +++ b/OvmfPkg/Library/X86QemuLoadImageLib/X86QemuLoadImageLib.c > > @@ -291,6 +291,11 @@ QemuLoadKernelImage ( > > CHAR8 *CommandLine; > > UINTN InitrdSize; > > > > + // > > + // Redundant assignment to work around GCC48/GCC49 limitations. > > + // > > + CommandLine =3D NULL; > > + > > // > > // Load the image. This should call back into the QEMU EFI loader fi= le system. > > // > > > > Reviewed-by: Laszlo Ersek > Pushed, thanks.